public abstract class AbstractGalleryItemRenderer
extends java.lang.Object
Base class used to implement a custom gallery item renderer.
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT.
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
EMPTY_STRING |
protected Gallery |
gallery |
(package private) org.eclipse.swt.graphics.Color |
galleryBackgroundColor |
(package private) org.eclipse.swt.graphics.Color |
galleryForegroundColor |
static java.lang.String |
OVERLAY_BOTTOM_LEFT
Id for decorators located at the bottom left of the item image
Example : item.setData( AbstractGalleryItemRenderer.OVERLAY_BOTTOM_RIGHT
,
|
static java.lang.String |
OVERLAY_BOTTOM_RIGHT
Id for decorators located at the bottom right of the item image
Example : item.setData( AbstractGalleryItemRenderer.OVERLAY_BOTTOM_RIGHT
,
|
static java.lang.String |
OVERLAY_TOP_LEFT
Id for decorators located at the top left of the item image
Example : item.setData( AbstractGalleryItemRenderer.OVERLAY_BOTTOM_RIGHT
,
|
static java.lang.String |
OVERLAY_TOP_RIGHT
Id for decorators located at the top right of the item image
Example : item.setData( AbstractGalleryItemRenderer.OVERLAY_BOTTOM_RIGHT
,
|
protected boolean |
selected |
Constructor and Description |
---|
AbstractGalleryItemRenderer() |
Modifier and Type | Method and Description |
---|---|
abstract void |
dispose() |
abstract void |
draw(org.eclipse.swt.graphics.GC gc,
GalleryItem item,
int index,
int x,
int y,
int width,
int height)
Draws an item.
|
protected void |
drawAllOverlays(org.eclipse.swt.graphics.GC gc,
GalleryItem item,
int x,
int y,
org.eclipse.swt.graphics.Point imageSize,
int xShift,
int yShift)
Draw image overlays.
|
protected void |
drawOverlayImages(org.eclipse.swt.graphics.GC gc,
int x,
int y,
double ratio,
org.eclipse.swt.graphics.Image[] images)
Draw overlay images for one corner.
|
protected org.eclipse.swt.graphics.Color |
getBackground(GalleryItem item)
Check the GalleryItem, Gallery, and Display in order for the active
background color for the given GalleryItem.
|
protected org.eclipse.swt.graphics.Font |
getFont(GalleryItem item)
Check the GalleryItem, Gallery, and Display in order for the active font
for the given GalleryItem.
|
protected org.eclipse.swt.graphics.Color |
getForeground(GalleryItem item)
Check the GalleryItem, Gallery, and Display in order for the active
foreground color for the given GalleryItem.
|
Gallery |
getGallery()
Get current gallery.
|
protected org.eclipse.swt.graphics.Image[] |
getImageOverlay(GalleryItem item,
java.lang.String id)
Returns an array of images or null of no overlay was defined for this
image.
|
protected double |
getOverlayRatio(org.eclipse.swt.graphics.Point imageSize,
org.eclipse.swt.graphics.Point overlaySizeTopLeft,
org.eclipse.swt.graphics.Point overlaySizeTopRight,
org.eclipse.swt.graphics.Point overlaySizeBottomLeft,
org.eclipse.swt.graphics.Point overlaySizeBottomRight)
Returns the best size ratio for overlay images.
|
protected org.eclipse.swt.graphics.Point |
getOverlaySize(org.eclipse.swt.graphics.Image[] images)
Return overlay size, summing all images sizes
|
boolean |
isSelected()
true is the current item is selected
|
void |
postDraw(org.eclipse.swt.graphics.GC gc)
This method is called after drawing the last item.
|
void |
preDraw(org.eclipse.swt.graphics.GC gc)
This method is called before drawing the first item.
|
void |
setGallery(Gallery gallery)
Set the current gallery.
|
void |
setSelected(boolean selected) |
public static final java.lang.String OVERLAY_BOTTOM_RIGHT
public static final java.lang.String OVERLAY_BOTTOM_LEFT
public static final java.lang.String OVERLAY_TOP_RIGHT
public static final java.lang.String OVERLAY_TOP_LEFT
protected static final java.lang.String EMPTY_STRING
protected Gallery gallery
org.eclipse.swt.graphics.Color galleryBackgroundColor
org.eclipse.swt.graphics.Color galleryForegroundColor
protected boolean selected
public boolean isSelected()
public void setSelected(boolean selected)
public abstract void draw(org.eclipse.swt.graphics.GC gc, GalleryItem item, int index, int x, int y, int width, int height)
gc
- item
- index
- x
- y
- width
- height
- public abstract void dispose()
public void preDraw(org.eclipse.swt.graphics.GC gc)
gc
- public void postDraw(org.eclipse.swt.graphics.GC gc)
gc
- public Gallery getGallery()
public void setGallery(Gallery gallery)
Gallery.setItemRenderer(AbstractGalleryItemRenderer)
. There is
not need to call it from user code.gallery
- protected double getOverlayRatio(org.eclipse.swt.graphics.Point imageSize, org.eclipse.swt.graphics.Point overlaySizeTopLeft, org.eclipse.swt.graphics.Point overlaySizeTopRight, org.eclipse.swt.graphics.Point overlaySizeBottomLeft, org.eclipse.swt.graphics.Point overlaySizeBottomRight)
imageSize
- overlaySizeTopLeft
- overlaySizeTopRight
- overlaySizeBottomLeft
- overlaySizeBottomRight
- protected void drawAllOverlays(org.eclipse.swt.graphics.GC gc, GalleryItem item, int x, int y, org.eclipse.swt.graphics.Point imageSize, int xShift, int yShift)
protected void drawOverlayImages(org.eclipse.swt.graphics.GC gc, int x, int y, double ratio, org.eclipse.swt.graphics.Image[] images)
gc
- x
- y
- ratio
- images
- protected org.eclipse.swt.graphics.Point getOverlaySize(org.eclipse.swt.graphics.Image[] images)
images
- protected org.eclipse.swt.graphics.Image[] getImageOverlay(GalleryItem item, java.lang.String id)
item
- id
- protected org.eclipse.swt.graphics.Color getBackground(GalleryItem item)
item
- protected org.eclipse.swt.graphics.Color getForeground(GalleryItem item)
item
- protected org.eclipse.swt.graphics.Font getFont(GalleryItem item)
item
-