public class DefaultGalleryGroupRenderer extends AbstractGridGroupRenderer
Default group renderer used by the Gallery widget. Supports multi-line text, images, animation and several other features.
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT.
Modifier and Type | Field and Description |
---|---|
protected boolean |
animation |
protected IMovement |
animationCloseMovement |
protected int |
animationLength |
protected IMovement |
animationOpenMovement |
protected static java.lang.String |
DATA_ANIMATION |
(package private) boolean |
marginCalculated
True if margins have already been calculated.
|
autoMargin, DEFAULT_SIZE, EMPTY_STRING, H_COUNT, itemHeight, itemWidth, margin, minMargin, V_COUNT
expanded, gallery
Constructor and Description |
---|
DefaultGalleryGroupRenderer()
This group renderer draws a title line, then items in a grid layout.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(org.eclipse.swt.graphics.GC gc,
GalleryItem group,
int x,
int y,
int clipX,
int clipY,
int clipWidth,
int clipHeight)
Group size informations can be retrieved from group.
|
protected void |
drawGroup(org.eclipse.swt.graphics.GC gc,
GalleryItem group,
int x,
int y,
int clipX,
int clipY,
int clipWidth,
int clipHeight) |
protected void |
drawGroupBackground(org.eclipse.swt.graphics.GC gc,
GalleryItem item,
int x,
int y,
int width,
int height)
Draw group background using system default gradient or the user-defined
color.
|
protected int |
drawGroupToggleButton(org.eclipse.swt.graphics.GC gc,
int x,
int y,
GalleryItem group)
Draw the toggle button.
|
protected void |
drawItem(org.eclipse.swt.graphics.GC gc,
int index,
boolean selected,
GalleryItem parent,
int offsetY)
Draw a child item.
|
IMovement |
getAnimationCloseMovement() |
int |
getAnimationLength() |
IMovement |
getAnimationOpenMovement()
Get the current movement used for animation
|
org.eclipse.swt.graphics.Font |
getFont()
Returns the font used for drawing the group title or null if
system font is used.
|
protected int |
getGroupHeight(GalleryItem group) |
protected int |
getGroupOffset(GalleryItem item)
Returns a group offset (size of title + margin)
|
protected java.lang.String |
getGroupTitle(GalleryItem group) |
GalleryItem |
getItem(GalleryItem group,
org.eclipse.swt.graphics.Point coords)
Returns the item at coords relative to the parent group.
|
int |
getMaxImageHeight() |
int |
getMaxImageWidth() |
int |
getScrollBarIncrement()
Returns the preferred Scrollbar increment for the current gallery layout.
|
org.eclipse.swt.graphics.Rectangle |
getSize(GalleryItem item)
Returns the size of a group.
|
org.eclipse.swt.graphics.Color |
getTitleBackground() |
org.eclipse.swt.graphics.Color |
getTitleBackground2() |
org.eclipse.swt.graphics.Color |
getTitleForeground()
Get group title text color.
|
protected org.eclipse.swt.graphics.Rectangle |
getToggleButtonBounds() |
boolean |
isAnimation() |
boolean |
isFillIfSingleColumn() |
protected boolean |
isGroupExpanded(GalleryItem item)
Return item expand state (item.isExpanded()) Returns always true is
alwaysExpanded is set to true.
|
boolean |
isTitleBackgroundGradient() |
void |
layout(org.eclipse.swt.graphics.GC gc,
GalleryItem group)
This method is called on each root item when the Gallery changes (resize,
item addition or removal) in order to update the gallery size.
|
boolean |
mouseDown(GalleryItem group,
org.eclipse.swt.widgets.Event e,
org.eclipse.swt.graphics.Point coords)
This method can be implemented to handle mouse down events at the group
level.
|
void |
preDraw(org.eclipse.swt.graphics.GC gc)
This method is called before drawing the first item.
|
void |
preLayout(org.eclipse.swt.graphics.GC gc)
This method is called before the layout of the first item.
|
void |
setAnimation(boolean animation)
Enable animation for group expand/collapse.
|
void |
setAnimationCloseMovement(IMovement animationMovement)
Set the movement used for close animation.
|
void |
setAnimationLength(int animationLength)
Set the length of the animation
|
void |
setAnimationOpenMovement(IMovement animationMovement)
Set the movement used for open animation.
|
void |
setFillIfSingleColumn(boolean fillIfSingle)
Experimental feature.
|
void |
setFont(org.eclipse.swt.graphics.Font font)
Set the font for drawing the group title or null to use system
font.
|
void |
setGallery(Gallery gallery) |
void |
setMaxImageHeight(int imageHeight)
Set the maximum height for a group image in the title bar.
|
void |
setMaxImageWidth(int imageWidth)
Set the maximum width for a group image in the title bar.
|
void |
setTitleBackground(org.eclipse.swt.graphics.Color titleBackground) |
void |
setTitleBackgroundGradient(org.eclipse.swt.graphics.Color gradientBackground,
org.eclipse.swt.graphics.Color gradientForeground) |
void |
setTitleForeground(org.eclipse.swt.graphics.Color titleColor)
Change group title text color.
|
protected void |
startGroupAnimation(GalleryItem group,
boolean doOpen) |
calculateMargins, dispose, getItem, getItemHeight, getItemWidth, getLayoutData, getMinMargin, getNextItem, getSize, getSize, getVisibleItems, gridLayout, isAlwaysExpanded, isAutoMargin, mouseDown, setAlwaysExpanded, setAutoMargin, setItemHeight, setItemSize, setItemWidth, setMinMargin
getBackground, getFont, getForeground, getGallery, getGroupPosition, getGroupSize, isDebugMode, isExpanded, notifyTreeListeners, postDraw, postLayout, setExpanded, setGroupSize, updateScrollBarsProperties, updateStructuralValues
boolean marginCalculated
protected boolean animation
protected int animationLength
protected IMovement animationOpenMovement
protected IMovement animationCloseMovement
protected static final java.lang.String DATA_ANIMATION
public DefaultGalleryGroupRenderer()
public void setGallery(Gallery gallery)
setGallery
in class AbstractGalleryGroupRenderer
setGallery (org.eclipse.nebula.widgets.gallery.Gallery)
protected void drawGroupBackground(org.eclipse.swt.graphics.GC gc, GalleryItem item, int x, int y, int width, int height)
gc
- item
- TODOx
- y
- width
- height
- protected int drawGroupToggleButton(org.eclipse.swt.graphics.GC gc, int x, int y, GalleryItem group)
gc
- x
- y
- group
- protected org.eclipse.swt.graphics.Rectangle getToggleButtonBounds()
protected int getGroupHeight(GalleryItem group)
protected void drawGroup(org.eclipse.swt.graphics.GC gc, GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight)
protected java.lang.String getGroupTitle(GalleryItem group)
protected int getGroupOffset(GalleryItem item)
item
- public void draw(org.eclipse.swt.graphics.GC gc, GalleryItem group, int x, int y, int clipX, int clipY, int clipWidth, int clipHeight)
AbstractGalleryGroupRenderer
draw
in class AbstractGridGroupRenderer
org.eclipse.nebula.widgets.gallery.AbstractGridGroupRenderer#draw(org
.eclipse.swt.graphics.GC,
org.eclipse.nebula.widgets.gallery.GalleryItem, int, int, int, int,
int, int)
public void layout(org.eclipse.swt.graphics.GC gc, GalleryItem group)
AbstractGalleryGroupRenderer
layout
in class AbstractGridGroupRenderer
public void preDraw(org.eclipse.swt.graphics.GC gc)
AbstractGalleryGroupRenderer
preDraw
in class AbstractGalleryGroupRenderer
public void preLayout(org.eclipse.swt.graphics.GC gc)
AbstractGalleryGroupRenderer
preLayout
in class AbstractGridGroupRenderer
(org.eclipse.swt.graphics.GC)
public GalleryItem getItem(GalleryItem group, org.eclipse.swt.graphics.Point coords)
AbstractGalleryGroupRenderer
getItem
in class AbstractGridGroupRenderer
AbstractGridGroupRenderer.getItem(
org.eclipse.nebula.widgets.gallery.GalleryItem,
org.eclipse.swt.graphics.Point)
protected void startGroupAnimation(GalleryItem group, boolean doOpen)
public boolean mouseDown(GalleryItem group, org.eclipse.swt.widgets.Event e, org.eclipse.swt.graphics.Point coords)
AbstractGalleryGroupRenderer
mouseDown
in class AbstractGalleryGroupRenderer
group
- The group on which the mouse click occurede
- The original mouse eventcoords
- The pointer coordinates relative to the groupAbstractGalleryGroupRenderer.mouseDown(org.eclipse.nebula.widgets.gallery.GalleryItem,
org.eclipse.swt.widgets.Event, org.eclipse.swt.graphics.Point)
public org.eclipse.swt.graphics.Rectangle getSize(GalleryItem item)
AbstractGalleryGroupRenderer
getSize
in class AbstractGridGroupRenderer
AbstractGridGroupRenderer.getSize(
org.eclipse.nebula.widgets.gallery.GalleryItem)
public org.eclipse.swt.graphics.Color getTitleForeground()
public void setTitleForeground(org.eclipse.swt.graphics.Color titleColor)
titleColor
- Color or null to revert to default.public org.eclipse.swt.graphics.Color getTitleBackground()
public void setTitleBackground(org.eclipse.swt.graphics.Color titleBackground)
public void setTitleBackgroundGradient(org.eclipse.swt.graphics.Color gradientBackground, org.eclipse.swt.graphics.Color gradientForeground)
public org.eclipse.swt.graphics.Font getFont()
public void setFont(org.eclipse.swt.graphics.Font font)
font
- the font to setprotected void drawItem(org.eclipse.swt.graphics.GC gc, int index, boolean selected, GalleryItem parent, int offsetY)
AbstractGridGroupRenderer
public int getScrollBarIncrement()
AbstractGalleryGroupRenderer
getScrollBarIncrement
in class AbstractGalleryGroupRenderer
getScrollBarIncrement()
public boolean isFillIfSingleColumn()
setFillIfSingleColumn(boolean)
public void setFillIfSingleColumn(boolean fillIfSingle)
Experimental feature.
If set to true, this will enable a special behavior when the items are so large that only one can fit in the client area. In this case, items are always resized and centered to fit best in the client area.
See bug 266613 : https://bugs.eclipse.org/266613
fillIfSingle
- public int getMaxImageWidth()
setMaxImageWidth(int)
public void setMaxImageWidth(int imageWidth)
imageWidth
- GalleryItem.setImage(Image)
public int getMaxImageHeight()
setMaxImageHeight(int)
public void setMaxImageHeight(int imageHeight)
imageHeight
- GalleryItem.setImage(Image)
public boolean isAnimation()
setAnimation(boolean)
public void setAnimation(boolean animation)
animation
- setAnimationLength(int)
,
setAnimationOpenMovement(IMovement)
public int getAnimationLength()
setAnimationLength(int)
public void setAnimationLength(int animationLength)
animationLength
- setAnimation(boolean)
,
setAnimationOpenMovement(IMovement)
public IMovement getAnimationOpenMovement()
setAnimationOpenMovement(IMovement)
public IMovement getAnimationCloseMovement()
setAnimationCloseMovement(IMovement)
public void setAnimationOpenMovement(IMovement animationMovement)
animationMovement
- setAnimation(boolean)
,
setAnimationLength(int)
public void setAnimationCloseMovement(IMovement animationMovement)
animationMovement
- setAnimation(boolean)
,
setAnimationLength(int)
protected boolean isGroupExpanded(GalleryItem item)
AbstractGridGroupRenderer
isGroupExpanded
in class AbstractGridGroupRenderer
isGroupExpanded (org.eclipse.nebula.widgets.gallery.GalleryItem)
public boolean isTitleBackgroundGradient()
public org.eclipse.swt.graphics.Color getTitleBackground2()