public class SwitchButton
extends org.eclipse.swt.widgets.Canvas
Constructor and Description |
---|
SwitchButton(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.
|
Modifier and Type | Method and Description |
---|---|
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 the
SelectionListener interface. |
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed) |
int |
getArc() |
org.eclipse.swt.graphics.Color |
getBorderColor() |
org.eclipse.swt.graphics.Color |
getButtonBackgroundColor1() |
org.eclipse.swt.graphics.Color |
getButtonBackgroundColor2() |
org.eclipse.swt.graphics.Color |
getButtonBorderColor() |
org.eclipse.swt.graphics.Color |
getFocusColor() |
int |
getGap() |
org.eclipse.swt.graphics.Point |
getInsideMargin() |
org.eclipse.swt.graphics.Color |
getSelectedBackgroundColor() |
org.eclipse.swt.graphics.Color |
getSelectedForegroundColor() |
boolean |
getSelection() |
java.lang.String |
getText() |
java.lang.String |
getTextForSelect() |
java.lang.String |
getTextForUnselect() |
org.eclipse.swt.graphics.Color |
getUnselectedBackgroundColor() |
org.eclipse.swt.graphics.Color |
getUnselectedForegroundColor() |
boolean |
isRound() |
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 |
setArc(int arc) |
void |
setBorderColor(org.eclipse.swt.graphics.Color borderColor) |
void |
setButtonBackgroundColor1(org.eclipse.swt.graphics.Color buttonBackgroundColor1) |
void |
setButtonBackgroundColor2(org.eclipse.swt.graphics.Color buttonBackgroundColor2) |
void |
setButtonBorderColor(org.eclipse.swt.graphics.Color buttonBorderColor) |
void |
setFocusColor(org.eclipse.swt.graphics.Color focusColor) |
void |
setGap(int gap) |
void |
setInsideMargin(int insideMarginX,
int insideMarginY) |
void |
setInsideMargin(org.eclipse.swt.graphics.Point insideMargin) |
void |
setRound(boolean round) |
void |
setSelectedBackgroundColor(org.eclipse.swt.graphics.Color selectedBackgroundColor) |
void |
setSelectedForegroundColor(org.eclipse.swt.graphics.Color selectedForegroundColor) |
void |
setSelection(boolean selection) |
void |
setText(java.lang.String text) |
void |
setTextForSelect(java.lang.String textForSelect) |
void |
setTextForUnselect(java.lang.String textForUnselect) |
void |
setUnselectedBackgroundColor(org.eclipse.swt.graphics.Color unselectedBackgroundColor) |
void |
setUnselectedForegroundColor(org.eclipse.swt.graphics.Color unselectedForegroundColor) |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
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, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public SwitchButton(org.eclipse.swt.widgets.Composite parent, int style)
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 the
int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherited from superclasses.
parent
- a composite control which will be the parent of the new
instance (cannot be null)style
- the style of control to constructjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
SelectionListener
interface.
widgetSelected
is called when the control is selected by the
user. widgetDefaultSelected
is not called.
listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class org.eclipse.swt.widgets.Control
Control.computeSize(int, int, boolean)
public boolean getSelection()
org.eclipse.swt.SWTException
- public void setSelection(boolean selection)
selection
- the selection state of the buttonorg.eclipse.swt.SWTException
- public java.lang.String getTextForSelect()
org.eclipse.swt.SWTException
- public void setTextForSelect(java.lang.String textForSelect)
textForSelect
- the text used to display the selectionorg.eclipse.swt.SWTException
- public java.lang.String getTextForUnselect()
org.eclipse.swt.SWTException
- public void setTextForUnselect(java.lang.String textForUnselect)
textForUnselect
- the text used to display the unselected optionorg.eclipse.swt.SWTException
- public java.lang.String getText()
org.eclipse.swt.SWTException
- public void setText(java.lang.String text)
the
- text displayed in the widgetorg.eclipse.swt.SWTException
- public boolean isRound()
org.eclipse.swt.SWTException
- public void setRound(boolean round)
round
- the round flag to set. If true, the widget is composed of
round rectangle instead of rectanglesorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getBorderColor()
org.eclipse.swt.SWTException
- public void setBorderColor(org.eclipse.swt.graphics.Color borderColor)
borderColor
- the border's color. If null, no border is displayed.org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getFocusColor()
org.eclipse.swt.SWTException
- public void setFocusColor(org.eclipse.swt.graphics.Color focusColor)
focusColor
- the focus color to set. If null, no focus effect is
displayed.org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getSelectedForegroundColor()
org.eclipse.swt.SWTException
- public void setSelectedForegroundColor(org.eclipse.swt.graphics.Color selectedForegroundColor)
the
- foreground color of the left part of the widget (selection is
on)org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getSelectedBackgroundColor()
org.eclipse.swt.SWTException
- public void setSelectedBackgroundColor(org.eclipse.swt.graphics.Color selectedBackgroundColor)
the
- background color of the left part of the widget (selection is
on)public org.eclipse.swt.graphics.Color getUnselectedForegroundColor()
org.eclipse.swt.SWTException
- public void setUnselectedForegroundColor(org.eclipse.swt.graphics.Color unselectedForegroundColor)
unselectedForegroundColor
- the foreground color of the left part of
the widget (selection is on)org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getUnselectedBackgroundColor()
org.eclipse.swt.SWTException
- public void setUnselectedBackgroundColor(org.eclipse.swt.graphics.Color unselectedBackgroundColor)
unselectedBackgroundColor
- the background color of the left part of
the widget (selection is on)org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getButtonBorderColor()
org.eclipse.swt.SWTException
- public void setButtonBorderColor(org.eclipse.swt.graphics.Color buttonBorderColor)
buttonBorderColor
- the border color of the switch buttonorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getButtonBackgroundColor1()
org.eclipse.swt.SWTException
- public void setButtonBackgroundColor1(org.eclipse.swt.graphics.Color buttonBackgroundColor1)
buttonBackgroundColor1
- the first color of the toggle buttonorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getButtonBackgroundColor2()
org.eclipse.swt.SWTException
- public void setButtonBackgroundColor2(org.eclipse.swt.graphics.Color buttonBackgroundColor2)
buttonBackgroundColor2
- the second color of the toggle buttonorg.eclipse.swt.SWTException
- public int getGap()
org.eclipse.swt.SWTException
- public void setGap(int gap)
gap
- the gap value to setorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Point getInsideMargin()
org.eclipse.swt.SWTException
- public void setInsideMargin(int insideMarginX, int insideMarginY)
insideMarginX
- the new margin value (horizontal)insideMarginY
- the new margin value (vertical)org.eclipse.swt.SWTException
- public void setInsideMargin(org.eclipse.swt.graphics.Point insideMargin)
insideMargin
- the new margin valueorg.eclipse.swt.SWTException
- public int getArc()
org.eclipse.swt.SWTException
- public void setArc(int arc)
arc
- the arc value to setorg.eclipse.swt.SWTException
-