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
ConstructorsConstructorDescriptionFlatToolbarButton(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.booleanGets the current selection state when button is a toggle button.voidsetDisabledImage(Image image) The disabled image.voidSets the double-click listener.voidsetEnabled(boolean on) Overrides the enabled method.voidsetHoverImage(Image image) The hover image.voidOverrides setImage.voidsetListener(IFlatToolbarButton listener) Sets the listener.voidsetSelection(boolean on) Sets the selection state in case the button is used as a toggle button.Methods inherited from class org.eclipse.swt.custom.CLabel
getAlignment, getBottomMargin, getImage, getLeftMargin, getRightMargin, getStyle, getText, getToolTipText, getTopMargin, setAlignment, setBackground, setBackground, setBackground, setBackground, setBottomMargin, setFont, setLeftMargin, setMargins, setRightMargin, setText, setToolTipText, setTopMargin, shortenTextMethods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIMEMethods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBarMethods 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, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods 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, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
setEnabledin classControl
setImage
Overrides setImage.setDisabledImage
The disabled image.setHoverImage
The hover image.computeSize
Computes the size. The size is 23x20.- Overrides:
computeSizein classCLabel