Class SplitButton
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Button
-
- org.eclipse.nebula.widgets.splitbutton.SplitButton
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class SplitButton extends org.eclipse.swt.widgets.ButtonInstances of this class represent a selectable user interface object that issues notification when pressed and released. A menu can be attached to this button- Styles:
- PUSH, TOGGLE
- Events:
- Selection
Note: Only one of the styles PUSH or TOGGLE may be specified.
Note: Only one of the styles LEFT, RIGHT, and CENTER may be specified.
-
-
Field Summary
Fields Modifier and Type Field Description private static intEXTRA_WIDTHprivate java.util.List<org.eclipse.swt.widgets.Listener>listenersprivate org.eclipse.swt.widgets.Menumenuprivate intsplitButtonAreaBottomprivate intsplitButtonAreaLeftprivate intsplitButtonAreaRightprivate intsplitButtonAreaTop
-
Constructor Summary
Constructors Constructor Description SplitButton(org.eclipse.swt.widgets.Composite parent, int style)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(int eventType, org.eclipse.swt.widgets.Listener listener)Adds the listener to the collection of listeners who will be notified when an event of the given type occurs.private voidaddMouseDownListener()private voidaddPaintListener()voidaddSelectionListener(org.eclipse.swt.events.SelectionListener listener)Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in theSelectionListenerinterface.private static intcheckBits(int style, int int0, int int1, int int2)private static intcheckStyle(int style)protected voidcheckSubclass()org.eclipse.swt.graphics.PointcomputeSize(int wHint, int hHint, boolean changed)org.eclipse.swt.widgets.MenugetMenu()voidremoveListener(int eventType, org.eclipse.swt.widgets.Listener listener)Removes the listener from the collection of listeners who will be notified when an event of the given type occurs.voidremoveSelectionListener(org.eclipse.swt.events.SelectionListener listener)Removes the listener from the collection of listeners who will be notified when the control is selected by the user.voidsetMenu(org.eclipse.swt.widgets.Menu menu)-
Methods inherited from class org.eclipse.swt.widgets.Button
getAlignment, getGrayed, getImage, getSelection, getText, setAlignment, setGrayed, setImage, setSelection, setText
-
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, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFocus, setFont, setForeground, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
-
-
-
Field Detail
-
EXTRA_WIDTH
private static final int EXTRA_WIDTH
- See Also:
- Constant Field Values
-
listeners
private final java.util.List<org.eclipse.swt.widgets.Listener> listeners
-
splitButtonAreaLeft
private int splitButtonAreaLeft
-
splitButtonAreaTop
private int splitButtonAreaTop
-
splitButtonAreaRight
private int splitButtonAreaRight
-
splitButtonAreaBottom
private int splitButtonAreaBottom
-
menu
private org.eclipse.swt.widgets.Menu menu
-
-
Constructor Detail
-
SplitButton
public SplitButton(org.eclipse.swt.widgets.Composite parent, int style)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to construct- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
SWT.PUSH,SWT.TOGGLE,Widget.getStyle()
-
-
Method Detail
-
checkStyle
private static int checkStyle(int style)
-
checkBits
private static int checkBits(int style, int int0, int int1, int int2)
-
addPaintListener
private void addPaintListener()
-
addMouseDownListener
private void addMouseDownListener()
-
addSelectionListener
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in theSelectionListenerinterface.widgetDefaultSelectedis not called.- Overrides:
addSelectionListenerin classorg.eclipse.swt.widgets.Button- Parameters:
listener- the listener which should be notified when the control is selected by the user,- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
SelectionListener,removeSelectionListener(org.eclipse.swt.events.SelectionListener),SelectionEvent
-
removeSelectionListener
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the control is selected by the user.- Overrides:
removeSelectionListenerin classorg.eclipse.swt.widgets.Button- Parameters:
listener- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
SelectionListener,addSelectionListener(org.eclipse.swt.events.SelectionListener)
-
addListener
public void addListener(int eventType, org.eclipse.swt.widgets.Listener listener)Adds the listener to the collection of listeners who will be notified when an event of the given type occurs. When the event does occur in the widget, the listener is notified by sending it thehandleEvent()message. The event type is one of the event constants defined in classSWT.- Overrides:
addListenerin classorg.eclipse.swt.widgets.Widget- Parameters:
eventType- the type of event to listen forlistener- the listener which should be notified when the event occurs- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
Listener,SWT,Widget.getListeners(int),removeListener(int, Listener),Widget.notifyListeners(int, org.eclipse.swt.widgets.Event)
-
removeListener
public void removeListener(int eventType, org.eclipse.swt.widgets.Listener listener)Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in classSWT.- Overrides:
removeListenerin classorg.eclipse.swt.widgets.Widget- Parameters:
eventType- the type of event to listen forlistener- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
Listener,SWT,addListener(int, org.eclipse.swt.widgets.Listener),Widget.getListeners(int),Widget.notifyListeners(int, org.eclipse.swt.widgets.Event)
-
getMenu
public org.eclipse.swt.widgets.Menu getMenu()
- Overrides:
getMenuin classorg.eclipse.swt.widgets.Control- See Also:
Control.getMenu()
-
setMenu
public void setMenu(org.eclipse.swt.widgets.Menu menu)
- Overrides:
setMenuin classorg.eclipse.swt.widgets.Control- See Also:
Control.setMenu(org.eclipse.swt.widgets.Menu)
-
checkSubclass
protected void checkSubclass()
- Overrides:
checkSubclassin classorg.eclipse.swt.widgets.Widget- See Also:
Widget.checkSubclass()
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)- Overrides:
computeSizein classorg.eclipse.swt.widgets.Control- See Also:
Control.computeSize(int, int, boolean)
-
-