Class ChartElementImage
java.lang.Object
com._1c.g5.v8.dt.form.ui.internal.chart.editor.ChartElementImage
Represents an image of some chart element to be placed on
ChartControl
's canvas.-
Constructor Summary
ConstructorsConstructorDescriptionChartElementImage
(IModelApi modelApi, AnyChartElement chartElement, org.eclipse.swt.widgets.Canvas canvas, boolean isReadOnlyMode) Creates instance for the specified chart element. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(int x, int y) Checks whether the specified point lies inside this image rectangle.void
dispose()
Disposes the stored image.void
draw
(org.eclipse.swt.graphics.GC gc, boolean isSelected) Draws the image.int
getTrackResizeCursorId
(int x, int y) Returns SWT cursor id for tracking change of image rectangle.boolean
track
(int x, int y) Tracks changing of image bounds by mouse viaTracker
element.void
update
(org.eclipse.swt.graphics.ImageData newImageData) Updates the current image with new image data.
-
Constructor Details
-
ChartElementImage
public ChartElementImage(IModelApi modelApi, AnyChartElement chartElement, org.eclipse.swt.widgets.Canvas canvas, boolean isReadOnlyMode) Creates instance for the specified chart element.- Parameters:
modelApi
- theIModelApi
instance, cannot benull
.chartElement
- the chart element for which to create the image, cannot benull
canvas
- the canvas on which to draw the image, cannot benull
isReadOnlyMode
- the flag indicating that chart editing is not allowed
-
-
Method Details
-
update
public void update(org.eclipse.swt.graphics.ImageData newImageData) Updates the current image with new image data.- Parameters:
newImageData
- the new image data ornull
if there is no image to display
-
dispose
public void dispose()Disposes the stored image. -
contains
public boolean contains(int x, int y) Checks whether the specified point lies inside this image rectangle.- Parameters:
x
- the x-coordinate of the point to checky
- the y-coordinate of the point to check- Returns:
true
if the point is inside of the image rectangle,false
otherwise
-
track
public boolean track(int x, int y) Tracks changing of image bounds by mouse viaTracker
element.- Parameters:
x
- the x-coordinate of the starting pointy
- the y-coordinate of the starting point- Returns:
true
if image rectangle has been changed,false
otherwise
-
getTrackResizeCursorId
public int getTrackResizeCursorId(int x, int y) Returns SWT cursor id for tracking change of image rectangle.- Parameters:
x
- the x-coordinate of the point to checky
- the y-coordinate of the point to check- Returns:
- one of SWT.CURSOR_SIZE* constants or SWT.NONE if checking point is outside of the image
-
draw
public void draw(org.eclipse.swt.graphics.GC gc, boolean isSelected) Draws the image.- Parameters:
gc
- theGC
on which to draw, cannot benull
isSelected
-true
if the image is currently selected
-