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 (package private) org.eclipse.swt.graphics.Color
backgroundColor
(package private) boolean
dropShadows
(package private) int
dropShadowsAlphaStep
protected java.util.ArrayList<org.eclipse.swt.graphics.Color>
dropShadowsColors
Stores colors used in drop shadows(package private) int
dropShadowsSize
(package private) org.eclipse.swt.graphics.Color
foregroundColor
(package private) org.eclipse.swt.graphics.Color
selectionBackgroundColor
(package private) org.eclipse.swt.graphics.Color
selectionForegroundColor
(package private) int
selectionRadius
(package private) boolean
showLabels
(package private) boolean
showRoundedSelectionCorners
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
Modifier and Type Method Description void
dispose()
void
draw(org.eclipse.swt.graphics.GC gc, GalleryItem item, int index, int x, int y, int width, int height)
Draws an item.org.eclipse.swt.graphics.Color
getBackgroundColor()
int
getDropShadowsSize()
org.eclipse.swt.graphics.Font
getFont()
Returns the font used for drawing all item labels or null if system font is used.org.eclipse.swt.graphics.Color
getForegroundColor()
org.eclipse.swt.graphics.Color
getSelectionBackgroundColor()
org.eclipse.swt.graphics.Color
getSelectionForegroundColor()
boolean
isDropShadows()
boolean
isShowLabels()
Returns current label state : enabled or disabledboolean
isShowRoundedSelectionCorners()
void
setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
void
setDropShadows(boolean dropShadows)
void
setDropShadowsSize(int dropShadowsSize)
void
setFont(org.eclipse.swt.graphics.Font font)
Set the font for drawing all item labels or null to use system font.void
setForegroundColor(org.eclipse.swt.graphics.Color foregroundColor)
void
setSelectionBackgroundColor(org.eclipse.swt.graphics.Color selectionBackgroundColor)
void
setSelectionForegroundColor(org.eclipse.swt.graphics.Color selectionForegroundColor)
void
setShowLabels(boolean showLabels)
Enables / disables labels at the bottom of each item.void
setShowRoundedSelectionCorners(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 Details
-
dropShadowsColors
protected java.util.ArrayList<org.eclipse.swt.graphics.Color> dropShadowsColorsStores 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
-
-
Constructor Details
-
DefaultGalleryItemRenderer
public DefaultGalleryItemRenderer()
-
-
Method Details
-
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:AbstractGalleryItemRenderer
Draws an item. -
setDropShadowsSize
public void setDropShadowsSize(int dropShadowsSize) -
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:
dispose
in 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)
-