Class ListItemRenderer
java.lang.Object
org.eclipse.nebula.widgets.gallery.AbstractGalleryItemRenderer
org.eclipse.nebula.widgets.gallery.ListItemRenderer
public class ListItemRenderer extends AbstractGalleryItemRenderer
Alternate item renderer for the Gallery widget using a list style. Supports multi-line text, image, drop shadows and decorators.
Best with bigger width than height.
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) org.eclipse.swt.graphics.Color
descriptionColor
(package private) org.eclipse.swt.graphics.Font
descriptionFont
(package private) boolean
dropShadows
(package private) int
dropShadowsAlphaStep
protected java.util.ArrayList<org.eclipse.swt.graphics.Color>
dropShadowsColors
(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
(package private) org.eclipse.swt.graphics.Font
textFont
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 ListItemRenderer()
-
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()
org.eclipse.swt.graphics.Color
getDescriptionColor()
org.eclipse.swt.graphics.Font
getDescriptionFont()
Returns the font used for drawing item description or null if system font is used.int
getDropShadowsSize()
org.eclipse.swt.graphics.Color
getForegroundColor()
org.eclipse.swt.graphics.Color
getSelectionBackgroundColor()
org.eclipse.swt.graphics.Color
getSelectionForegroundColor()
org.eclipse.swt.graphics.Font
getTextFont()
Deprecated.UseCanvas.setFont(Font)
orGalleryItem.setFont(Font)
instead.boolean
isDropShadows()
boolean
isShowLabels()
boolean
isShowRoundedSelectionCorners()
void
preDraw(org.eclipse.swt.graphics.GC gc)
This method is called before drawing the first item.void
setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
void
setDescriptionColor(org.eclipse.swt.graphics.Color descriptionColor)
void
setDescriptionFont(org.eclipse.swt.graphics.Font descriptionFont)
Set the font for drawing item description or null to use system font.void
setDropShadows(boolean dropShadows)
void
setDropShadowsSize(int dropShadowsSize)
void
setForegroundColor(org.eclipse.swt.graphics.Color foregroundColor)
void
setSelectionBackgroundColor(org.eclipse.swt.graphics.Color selectionColor)
void
setSelectionForegroundColor(org.eclipse.swt.graphics.Color selectionForegroundColor)
void
setShowLabels(boolean showLabels)
void
setShowRoundedSelectionCorners(boolean showRoundedSelectionCorners)
void
setTextFont(org.eclipse.swt.graphics.Font textFont)
Deprecated.UseCanvas.setFont(Font)
orGalleryItem.setFont(Font)
instead.Methods inherited from class org.eclipse.nebula.widgets.gallery.AbstractGalleryItemRenderer
drawAllOverlays, drawOverlayImages, getBackground, getFont, getForeground, getGallery, getImageOverlay, getOverlayRatio, getOverlaySize, isSelected, postDraw, setGallery, setSelected
-
Field Details
-
dropShadowsColors
protected java.util.ArrayList<org.eclipse.swt.graphics.Color> dropShadowsColors -
dropShadows
boolean dropShadows -
dropShadowsSize
int dropShadowsSize -
dropShadowsAlphaStep
int dropShadowsAlphaStep -
selectionBackgroundColor
org.eclipse.swt.graphics.Color selectionBackgroundColor -
selectionForegroundColor
org.eclipse.swt.graphics.Color selectionForegroundColor -
foregroundColor
org.eclipse.swt.graphics.Color foregroundColor -
backgroundColor
org.eclipse.swt.graphics.Color backgroundColor -
descriptionColor
org.eclipse.swt.graphics.Color descriptionColor -
textFont
org.eclipse.swt.graphics.Font textFont -
descriptionFont
org.eclipse.swt.graphics.Font descriptionFont -
showLabels
boolean showLabels -
showRoundedSelectionCorners
boolean showRoundedSelectionCorners -
selectionRadius
int selectionRadius
-
-
Constructor Details
-
ListItemRenderer
public ListItemRenderer()
-
-
Method Details
-
isShowLabels
public boolean isShowLabels() -
setShowLabels
public void setShowLabels(boolean showLabels) -
preDraw
public void preDraw(org.eclipse.swt.graphics.GC gc)Description copied from class:AbstractGalleryItemRenderer
This method is called before drawing the first item. It may be used to calculate some values (like font metrics) that will be used for each item.- Overrides:
preDraw
in classAbstractGalleryItemRenderer
- See Also:
(org.eclipse.swt.graphics.GC)
-
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() -
dispose
public void dispose()- Specified by:
dispose
in classAbstractGalleryItemRenderer
- See Also:
AbstractGalleryItemRenderer.dispose()
-
getSelectionBackgroundColor
public org.eclipse.swt.graphics.Color getSelectionBackgroundColor() -
setSelectionBackgroundColor
public void setSelectionBackgroundColor(org.eclipse.swt.graphics.Color selectionColor) -
getForegroundColor
public org.eclipse.swt.graphics.Color getForegroundColor() -
setForegroundColor
public void setForegroundColor(org.eclipse.swt.graphics.Color foregroundColor) -
getBackgroundColor
public org.eclipse.swt.graphics.Color getBackgroundColor() -
setBackgroundColor
public void setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor) -
getDescriptionColor
public org.eclipse.swt.graphics.Color getDescriptionColor() -
setDescriptionColor
public void setDescriptionColor(org.eclipse.swt.graphics.Color descriptionColor) -
getSelectionForegroundColor
public org.eclipse.swt.graphics.Color getSelectionForegroundColor() -
setSelectionForegroundColor
public void setSelectionForegroundColor(org.eclipse.swt.graphics.Color selectionForegroundColor) -
getTextFont
public org.eclipse.swt.graphics.Font getTextFont()Deprecated.UseCanvas.setFont(Font)
orGalleryItem.setFont(Font)
instead.Returns the font used for drawing item label or null if system font is used.- Returns:
- the font
-
setTextFont
public void setTextFont(org.eclipse.swt.graphics.Font textFont)Deprecated.UseCanvas.setFont(Font)
orGalleryItem.setFont(Font)
instead.Set the font for drawing item label or null to use system font.- Parameters:
font
- the font to set
-
getDescriptionFont
public org.eclipse.swt.graphics.Font getDescriptionFont()Returns the font used for drawing item description or null if system font is used.- Returns:
- the font
-
setDescriptionFont
public void setDescriptionFont(org.eclipse.swt.graphics.Font descriptionFont)Set the font for drawing item description or null to use system font.- Parameters:
font
- the font to set
-
isShowRoundedSelectionCorners
public boolean isShowRoundedSelectionCorners() -
setShowRoundedSelectionCorners
public void setShowRoundedSelectionCorners(boolean showRoundedSelectionCorners)
-