Package com.iizigo.swt
Class FlatToolbarButton
- All Implemented Interfaces:
Drawable
A button that behaves like a flat button should do, i.e. also works under e.g. Windows 7, where the SWT.FLAT look doesn't work for SWT.PUSH. The button only has an image, no text.
- Author:
- Christopher Mindus
Field Summary
Constructor Summary
ConstructorDescriptionFlatToolbarButton
(Composite parent, String workBenchImage, IFlatToolbarButton listener) Creates the toolbar button.FlatToolbarButton
(Composite parent, Image image, IFlatToolbarButton listener) Creates the toolbar button.FlatToolbarButton
(Composite parent, Image image, Image imageDisabled, IFlatToolbarButton listener) Creates the toolbar button.FlatToolbarButton
(Composite parent, Image image, Image imageHover, Image imageDisabled, IFlatToolbarButton listener) Creates the toolbar button.Method Summary
Modifier and TypeMethodDescriptioncomputeSize
(int wHint, int hHint, boolean changed) Computes the size.boolean
Gets the current selection state when button is a toggle button.void
setDisabledImage
(Image image) The disabled image.void
Sets the double-click listener.void
setEnabled
(boolean on) Overrides the enabled method.void
setHoverImage
(Image image) The hover image.void
Overrides setImage.void
setListener
(IFlatToolbarButton listener) Sets the listener.void
setSelection
(boolean on) Sets the selection state in case the button is used as a toggle button.Methods inherited from class com.iizix.swt.widget.IZ_CLabel
checkSubclass, setBackground, setForeground
Methods inherited from class org.eclipse.swt.custom.CLabel
getAlignment, getBottomMargin, getImage, getLeftMargin, getRightMargin, getStyle, getText, getToolTipText, getTopMargin, setAlignment, setBackground, setBackground, setBackground, setBottomMargin, setFont, setLeftMargin, setMargins, setRightMargin, setText, setToolTipText, setTopMargin, shortenText
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIME
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
Constructor Details
FlatToolbarButton
Creates the toolbar button.- Parameters:
parent
- The parent composite.workBenchImage
- The workbench image (dual), from org.eclipse.ui.ISharedImages.IMG_* (e.g. ISharedImages.IMG_TOOL_CUT).listener
- The button listener, can be null.- Throws:
NullPointerException
- If image is null.
FlatToolbarButton
Creates the toolbar button.- Parameters:
parent
- The parent composite.image
- The normal image, cannot be null, also used as hover image.listener
- The button listener, can be null.- Throws:
NullPointerException
- If image is null.
FlatToolbarButton
public FlatToolbarButton(Composite parent, Image image, Image imageDisabled, IFlatToolbarButton listener) Creates the toolbar button.- Parameters:
parent
- The parent composite.image
- The normal image, cannot be null, also used as hover image.imageDisabled
- The disabled image, if null, a grayed normal image is used.listener
- The button listener, can be null.- Throws:
NullPointerException
- If image is null.
FlatToolbarButton
public FlatToolbarButton(Composite parent, Image image, Image imageHover, Image imageDisabled, IFlatToolbarButton listener) Creates the toolbar button.- Parameters:
parent
- The parent composite.image
- The normal image, cannot be null.imageHover
- The hover image, if null, the normal image is used.imageDisabled
- The disabled image, if null, a grayed normal image is used.listener
- The button listener, can be null.- Throws:
NullPointerException
- If image is null.
Method Details
setSelection
public void setSelection(boolean on) Sets the selection state in case the button is used as a toggle button.getSelection
public boolean getSelection()Gets the current selection state when button is a toggle button.setDoubleClickListener
Sets the double-click listener.setListener
Sets the listener.setEnabled
public void setEnabled(boolean on) Overrides the enabled method.- Overrides:
setEnabled
in classControl
setImage
Overrides setImage.setDisabledImage
The disabled image.setHoverImage
The hover image.computeSize
Computes the size. The size is 23x20.- Overrides:
computeSize
in classCLabel