Class DefaultGalleryItemRenderer
- java.lang.Object
-
- org.eclipse.nebula.widgets.gallery.AbstractGalleryItemRenderer
-
- org.eclipse.nebula.widgets.gallery.DefaultGalleryItemRenderer
-
public class DefaultGalleryItemRenderer extends AbstractGalleryItemRenderer
Default item renderer used by the Gallery widget. Supports single line text, image, drop shadows and decorators.
Decorator images can be set with
Widget.setData(String, Object)by using the following keys :- org.eclipse.nebula.widget.gallery.bottomLeftOverlay
- org.eclipse.nebula.widget.gallery.bottomRightOverlay
- org.eclipse.nebula.widget.gallery.topLeftOverlay
- org.eclipse.nebula.widget.gallery.topRightOverlay
Supported types are org.eclipse.swt.Image for one single decorator and org.eclipse.swt.Image[] for multiple decorators.
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean_drawBackgroundprivate org.eclipse.swt.graphics.Color_drawBackgroundColorprivate org.eclipse.swt.graphics.Color_drawForegroundColorprivate org.eclipse.swt.graphics.Image_drawImage(package private) org.eclipse.swt.graphics.ColorbackgroundColor(package private) booleandropShadows(package private) intdropShadowsAlphaStepprotected java.util.ArrayList<org.eclipse.swt.graphics.Color>dropShadowsColorsStores colors used in drop shadows(package private) intdropShadowsSize(package private) org.eclipse.swt.graphics.ColorforegroundColor(package private) org.eclipse.swt.graphics.ColorselectionBackgroundColor(package private) org.eclipse.swt.graphics.ColorselectionForegroundColor(package private) intselectionRadius(package private) booleanshowLabels(package private) booleanshowRoundedSelectionCorners-
Fields inherited from class org.eclipse.nebula.widgets.gallery.AbstractGalleryItemRenderer
EMPTY_STRING, gallery, galleryBackgroundColor, galleryForegroundColor, OVERLAY_BOTTOM_LEFT, OVERLAY_BOTTOM_RIGHT, OVERLAY_TOP_LEFT, OVERLAY_TOP_RIGHT, selected
-
-
Constructor Summary
Constructors Constructor Description DefaultGalleryItemRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcreateColors()voiddispose()voiddraw(org.eclipse.swt.graphics.GC gc, GalleryItem item, int index, int x, int y, int width, int height)Draws an item.private voidfreeDropShadowsColors()org.eclipse.swt.graphics.ColorgetBackgroundColor()intgetDropShadowsSize()org.eclipse.swt.graphics.FontgetFont()Returns the font used for drawing all item labels or null if system font is used.org.eclipse.swt.graphics.ColorgetForegroundColor()org.eclipse.swt.graphics.ColorgetSelectionBackgroundColor()org.eclipse.swt.graphics.ColorgetSelectionForegroundColor()booleanisDropShadows()booleanisShowLabels()Returns current label state : enabled or disabledbooleanisShowRoundedSelectionCorners()voidsetBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)voidsetDropShadows(boolean dropShadows)voidsetDropShadowsSize(int dropShadowsSize)voidsetFont(org.eclipse.swt.graphics.Font font)Set the font for drawing all item labels or null to use system font.voidsetForegroundColor(org.eclipse.swt.graphics.Color foregroundColor)voidsetSelectionBackgroundColor(org.eclipse.swt.graphics.Color selectionBackgroundColor)voidsetSelectionForegroundColor(org.eclipse.swt.graphics.Color selectionForegroundColor)voidsetShowLabels(boolean showLabels)Enables / disables labels at the bottom of each item.voidsetShowRoundedSelectionCorners(boolean showRoundedSelectionCorners)-
Methods inherited from class org.eclipse.nebula.widgets.gallery.AbstractGalleryItemRenderer
drawAllOverlays, drawOverlayImages, getBackground, getFont, getForeground, getGallery, getImageOverlay, getOverlayRatio, getOverlaySize, isSelected, postDraw, preDraw, setGallery, setSelected
-
-
-
-
Field Detail
-
dropShadowsColors
protected java.util.ArrayList<org.eclipse.swt.graphics.Color> dropShadowsColors
Stores colors used in drop shadows
-
dropShadows
boolean dropShadows
-
dropShadowsSize
int dropShadowsSize
-
dropShadowsAlphaStep
int dropShadowsAlphaStep
-
selectionForegroundColor
org.eclipse.swt.graphics.Color selectionForegroundColor
-
selectionBackgroundColor
org.eclipse.swt.graphics.Color selectionBackgroundColor
-
foregroundColor
org.eclipse.swt.graphics.Color foregroundColor
-
backgroundColor
org.eclipse.swt.graphics.Color backgroundColor
-
showLabels
boolean showLabels
-
showRoundedSelectionCorners
boolean showRoundedSelectionCorners
-
selectionRadius
int selectionRadius
-
_drawBackground
private boolean _drawBackground
-
_drawBackgroundColor
private org.eclipse.swt.graphics.Color _drawBackgroundColor
-
_drawImage
private org.eclipse.swt.graphics.Image _drawImage
-
_drawForegroundColor
private org.eclipse.swt.graphics.Color _drawForegroundColor
-
-
Method Detail
-
isShowLabels
public boolean isShowLabels()
Returns current label state : enabled or disabled- Returns:
- true if labels are enabled.
- See Also:
setShowLabels(boolean)
-
setShowLabels
public void setShowLabels(boolean showLabels)
Enables / disables labels at the bottom of each item.- Parameters:
showLabels-- See Also:
isShowLabels()
-
draw
public void draw(org.eclipse.swt.graphics.GC gc, GalleryItem item, int index, int x, int y, int width, int height)Description copied from class:AbstractGalleryItemRendererDraws an item.
-
setDropShadowsSize
public void setDropShadowsSize(int dropShadowsSize)
-
createColors
private void createColors()
-
freeDropShadowsColors
private void freeDropShadowsColors()
-
isDropShadows
public boolean isDropShadows()
-
setDropShadows
public void setDropShadows(boolean dropShadows)
-
getDropShadowsSize
public int getDropShadowsSize()
-
getFont
public org.eclipse.swt.graphics.Font getFont()
Returns the font used for drawing all item labels or null if system font is used.- Returns:
- the font
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)
Set the font for drawing all item labels or null to use system font.- Parameters:
font- the font to set
-
dispose
public void dispose()
- Specified by:
disposein classAbstractGalleryItemRenderer
-
getForegroundColor
public org.eclipse.swt.graphics.Color getForegroundColor()
-
setForegroundColor
public void setForegroundColor(org.eclipse.swt.graphics.Color foregroundColor)
-
getSelectionForegroundColor
public org.eclipse.swt.graphics.Color getSelectionForegroundColor()
-
setSelectionForegroundColor
public void setSelectionForegroundColor(org.eclipse.swt.graphics.Color selectionForegroundColor)
-
getSelectionBackgroundColor
public org.eclipse.swt.graphics.Color getSelectionBackgroundColor()
-
setSelectionBackgroundColor
public void setSelectionBackgroundColor(org.eclipse.swt.graphics.Color selectionBackgroundColor)
-
getBackgroundColor
public org.eclipse.swt.graphics.Color getBackgroundColor()
-
setBackgroundColor
public void setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
-
isShowRoundedSelectionCorners
public boolean isShowRoundedSelectionCorners()
-
setShowRoundedSelectionCorners
public void setShowRoundedSelectionCorners(boolean showRoundedSelectionCorners)
-
-