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.Button
Instances 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
-
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
Modifier and Type Method Description 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.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 theSelectionListener
interface.protected void
checkSubclass()
org.eclipse.swt.graphics.Point
computeSize(int wHint, int hHint, boolean changed)
org.eclipse.swt.widgets.Menu
getMenu()
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.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.void
setMenu(org.eclipse.swt.widgets.Menu menu)
Methods inherited from class org.eclipse.swt.widgets.Button
getAlignment, getGrayed, getImage, getSelection, getText, setAlignment, setBackground, setFocus, 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, 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, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString
-
Constructor Details
-
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
SWT
which 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 thoseSWT
style 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 Details
-
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 theSelectionListener
interface.widgetDefaultSelected
is not called.- Overrides:
addSelectionListener
in 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:
removeSelectionListener
in 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:
addListener
in 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:
removeListener
in 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:
getMenu
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.getMenu()
-
setMenu
public void setMenu(org.eclipse.swt.widgets.Menu menu)- Overrides:
setMenu
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setMenu(org.eclipse.swt.widgets.Menu)
-
checkSubclass
protected void checkSubclass()- Overrides:
checkSubclass
in classorg.eclipse.swt.widgets.Widget
- See Also:
Widget.checkSubclass()
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)- Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.computeSize(int, int, boolean)
-