public class Spinner extends Composite
Note that although this class is a subclass of Composite
,
it does not make sense to add children to it, or set a layout on it.
IMPORTANT: This class is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
(package private) int |
digits |
(package private) static TCHAR |
EditClass |
(package private) static int |
EditProc |
(package private) int |
hwndText |
(package private) int |
hwndUpDown |
(package private) boolean |
ignoreCharacter |
(package private) boolean |
ignoreModify |
static int |
LIMIT
the operating system limit for the number of characters
that the text field in an instance of this class can hold
|
(package private) int |
pageIncrement |
(package private) static TCHAR |
UpDownClass |
(package private) static int |
UpDownProc |
backgroundMode, layout, layoutCount, lpwp, tabList
horizontalBar, verticalBar
accessible, background, backgroundImage, cursor, drawCount, font, foreground, handle, layoutData, menu, parent, region, toolTipText
CANVAS, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, display, DISPOSE_SENT, DISPOSED, DRAG_DETECT, DRAW_BACKGROUND, eventTable, FOREIGN_HANDLE, HIDDEN, IGNORE_WM_CHANGEUISTATE, KEYED_DATA, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, MAJOR, MINOR, MOVE_DEFERRED, MOVE_OCCURRED, PARENT_BACKGROUND, RELEASED, RESIZE_DEFERRED, RESIZE_OCCURRED, SKIN_NEEDED, state, style, THEME_BACKGROUND, TRACK_MOUSE
Constructor and Description |
---|
Spinner(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 |
addModifyListener(ModifyListener listener)
Adds the listener to the collection of listeners who will
be notified when the receiver's text is modified, by sending
it one of the messages defined in the
ModifyListener
interface. |
void |
addSelectionListener(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. |
(package private) void |
addVerifyListener(VerifyListener listener)
Adds the listener to the collection of listeners who will
be notified when the receiver's text is verified, by sending
it one of the messages defined in the
VerifyListener
interface. |
(package private) int |
borderHandle() |
(package private) int |
callWindowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) boolean |
checkHandle(int hwnd) |
(package private) static int |
checkStyle(int style) |
protected void |
checkSubclass()
Checks that this class can be subclassed.
|
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver.
|
Rectangle |
computeTrim(int x,
int y,
int width,
int height)
Given a desired client area for the receiver
(as described by the arguments), returns the bounding
rectangle which would be required to produce that client
area.
|
void |
copy()
Copies the selected text.
|
(package private) void |
createHandle() |
void |
cut()
Cuts the selected text.
|
(package private) int |
defaultBackground() |
(package private) void |
deregister() |
(package private) void |
enableWidget(boolean enabled) |
(package private) java.lang.String |
getDecimalSeparator() |
int |
getDigits()
Returns the number of decimal places used by the receiver.
|
int |
getIncrement()
Returns the amount that the receiver's value will be
modified by when the up/down arrows are pressed.
|
int |
getMaximum()
Returns the maximum value which the receiver will allow.
|
int |
getMinimum()
Returns the minimum value which the receiver will allow.
|
int |
getPageIncrement()
Returns the amount that the receiver's position will be
modified by when the page up/down keys are pressed.
|
int |
getSelection()
Returns the selection, which is the receiver's position.
|
(package private) int |
getSelectionText(boolean[] parseFail) |
java.lang.String |
getText()
Returns a string containing a copy of the contents of the
receiver's text field, or an empty string if there are no
contents.
|
int |
getTextLimit()
Returns the maximum number of characters that the receiver's
text field is capable of holding.
|
(package private) boolean |
hasFocus() |
(package private) int |
mbcsToWcsPos(int mbcsPos) |
void |
paste()
Pastes text from clipboard.
|
(package private) void |
register() |
(package private) void |
releaseHandle() |
void |
removeModifyListener(ModifyListener listener)
Removes the listener from the collection of listeners who will
be notified when the receiver's text is modified.
|
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will
be notified when the control is selected by the user.
|
(package private) void |
removeVerifyListener(VerifyListener listener)
Removes the listener from the collection of listeners who will
be notified when the control is verified.
|
(package private) boolean |
sendKeyEvent(int type,
int msg,
int wParam,
int lParam,
Event event) |
(package private) void |
setBackgroundImage(int hBitmap) |
(package private) void |
setBackgroundPixel(int pixel) |
void |
setDigits(int value)
Sets the number of decimal places used by the receiver.
|
(package private) void |
setForegroundPixel(int pixel) |
void |
setIncrement(int value)
Sets the amount that the receiver's value will be
modified by when the up/down arrows are pressed to
the argument, which must be at least one.
|
void |
setMaximum(int value)
Sets the maximum value that the receiver will allow.
|
void |
setMinimum(int value)
Sets the minimum value that the receiver will allow.
|
void |
setPageIncrement(int value)
Sets the amount that the receiver's position will be
modified by when the page up/down keys are pressed
to the argument, which must be at least one.
|
void |
setSelection(int value)
Sets the selection, which is the receiver's
position, to the argument.
|
(package private) void |
setSelection(int value,
boolean setPos,
boolean setText,
boolean notify) |
void |
setTextLimit(int limit)
Sets the maximum number of characters that the receiver's
text field is capable of holding to be the argument.
|
(package private) void |
setToolTipText(Shell shell,
java.lang.String string) |
void |
setValues(int selection,
int minimum,
int maximum,
int digits,
int increment,
int pageIncrement)
Sets the receiver's selection, minimum value, maximum
value, digits, increment and page increment all at once.
|
(package private) void |
subclass() |
(package private) void |
unsubclass() |
(package private) void |
updateOrientation() |
(package private) java.lang.String |
verifyText(java.lang.String string,
int start,
int end,
Event keyEvent) |
(package private) int |
widgetExtStyle() |
(package private) int |
windowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) LRESULT |
WM_ERASEBKGND(int wParam,
int lParam) |
(package private) LRESULT |
WM_KILLFOCUS(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETFOCUS(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETFONT(int wParam,
int lParam) |
(package private) LRESULT |
WM_SIZE(int wParam,
int lParam) |
(package private) LRESULT |
wmChar(int hwnd,
int wParam,
int lParam) |
(package private) LRESULT |
wmClipboard(int hwndText,
int msg,
int wParam,
int lParam) |
(package private) LRESULT |
wmCommandChild(int wParam,
int lParam) |
(package private) LRESULT |
wmIMEChar(int hwnd,
int wParam,
int lParam) |
(package private) LRESULT |
wmKeyDown(int hwnd,
int wParam,
int lParam) |
(package private) LRESULT |
wmKillFocus(int hwnd,
int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyChild(NMHDR hdr,
int wParam,
int lParam) |
(package private) LRESULT |
wmScrollChild(int wParam,
int lParam) |
_getChildren, _getTabList, changed, checkBuffered, checkComposited, computeTabList, copyArea, drawBackground, findDeferredControl, findMenus, fixChildren, fixTabList, getBackgroundMode, getChildren, getChildrenCount, getLayout, getLayoutDeferred, getTabList, hooksKeys, isLayoutDeferred, layout, layout, layout, layout, layout, markLayout, minimumSize, redrawChildren, releaseChildren, releaseParent, releaseWidget, removeControl, resizeChildren, resizeChildren, resizeEmbeddedHandle, reskinChildren, sendResize, setBackgroundMode, setBounds, setFocus, setLayout, setLayoutDeferred, setResizeChildren, setTabGroupFocus, setTabList, toolTipText, translateMnemonic, translateTraversal, updateBackgroundColor, updateBackgroundImage, updateBackgroundMode, updateFont, updateLayout, updateLayout, updateUIState, widgetStyle, WM_GETDLGCODE, WM_GETFONT, WM_LBUTTONDOWN, WM_NCHITTEST, WM_PAINT, WM_PARENTNOTIFY, WM_PRINTCLIENT, WM_SYSCOLORCHANGE, WM_SYSCOMMAND, WM_UPDATEUISTATE, wmNCPaint, wmNotify
createScrollBar, createWidget, destroyScrollBar, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, scrolledHandle, windowClass, windowProc, WM_HSCROLL, WM_MOUSEWHEEL, WM_VSCROLL, wmScroll, wmScrollWheel
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, binarySearch, checkBackground, checkBorder, checkGesture, checkMirrored, computeSize, computeTabGroup, computeTabRoot, defaultFont, defaultForeground, destroyWidget, dragDetect, dragDetect, dragDetect, drawBackground, drawBackground, drawBackground, drawImageBackground, drawThemeBackground, enableDrag, fillBackground, fillImageBackground, fillThemeBackground, findBackgroundControl, findBrush, findCursor, findImageControl, findMnemonic, findThemeControl, fixFocus, forceFocus, forceResize, getAccessible, getBackground, getBackgroundImage, getBackgroundPixel, getBorderWidth, getBounds, getClipboardText, getCodePage, getCursor, getDragDetect, getDrawing, getEnabled, getFont, getForeground, getForegroundPixel, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getPath, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, hasCursor, internal_dispose_GC, internal_new_GC, isActive, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, mapEvent, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, new_Accessible, new_GC, pack, pack, print, printWidget, redraw, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, sendFocusEvent, sendGestureEvent, sendMove, sendTouchEvent, setBackground, setBackground, setBackgroundImage, setBounds, setBounds, setBounds, setCapture, setCursor, setCursor, setDefaultFont, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRadioFocus, setRadioSelection, setRedraw, setRegion, setSavedFocus, setSize, setSize, setTabItemFocus, setToolTipText, setTouchEnabled, setVisible, showWidget, sort, toControl, toControl, toDisplay, toDisplay, topHandle, translateAccelerator, translateMnemonic, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, update, update, updateImages, widgetCreateStruct, widgetParent, WM_ACTIVATE, WM_CAPTURECHANGED, WM_CHANGEUISTATE, WM_CHAR, WM_CLEAR, WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_CTLCOLOR, WM_CUT, WM_DESTROY, WM_DRAWITEM, WM_ENDSESSION, WM_ENTERIDLE, WM_GESTURE, WM_GETMINMAXINFO, WM_GETOBJECT, WM_HELP, WM_HOTKEY, WM_IME_CHAR, WM_IME_COMPOSITION_START, WM_IME_COMPOSITION, WM_IME_ENDCOMPOSITION, WM_INITMENUPOPUP, WM_INPUTLANGCHANGE, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDBLCLK, WM_LBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSEHWHEEL, WM_MOUSELEAVE, WM_MOUSEMOVE, WM_MOVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCLBUTTONDOWN, WM_NCPAINT, WM_NOTIFY, WM_PALETTECHANGED, WM_PASTE, WM_PRINT, WM_QUERYENDSESSION, WM_QUERYNEWPALETTE, WM_QUERYOPEN, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETREDRAW, WM_SETTINGCHANGE, WM_SHOWWINDOW, WM_SYSCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TABLET_FLICK, WM_TIMER, WM_TOUCH, WM_UNDO, WM_UNINITMENUPOPUP, WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING, WM_XBUTTONDBLCLK, WM_XBUTTONDOWN, WM_XBUTTONUP, wmColorChild, wmDrawChild, wmMeasureChild
_addListener, addDisposeListener, addListener, checkBits, checkOpened, checkOrientation, checkParent, checkWidget, DeferWindowPos, dispose, dragDetect, error, filters, findItem, fixMnemonic, fixMnemonic, getData, getData, getDisplay, getListeners, getName, getNameText, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, notifyListeners, postEvent, postEvent, release, removeDisposeListener, removeListener, removeListener, reskin, reskinWidget, sendDragEvent, sendDragEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, sendMouseWheelEvent, sendSelectionEvent, sendSelectionEvent, setData, setData, setInputState, setKeyState, setLocationMask, SetWindowPos, showMenu, showMenu, toString, updateMenuLocation, wmCaptureChanged, wmContextMenu, wmKeyUp, wmLButtonDblClk, wmLButtonDown, wmLButtonUp, wmMButtonDblClk, wmMButtonDown, wmMButtonUp, wmMouseHover, wmMouseHWheel, wmMouseLeave, wmMouseMove, wmMouseWheel, wmPaint, wmPrint, wmRButtonDblClk, wmRButtonDown, wmRButtonUp, wmSetFocus, wmSysChar, wmSysKeyDown, wmSysKeyUp, wmXButtonDblClk, wmXButtonDown, wmXButtonUp
int hwndText
int hwndUpDown
boolean ignoreModify
boolean ignoreCharacter
int pageIncrement
int digits
static final int EditProc
static final TCHAR EditClass
static final int UpDownProc
static final TCHAR UpDownClass
public static final int LIMIT
public Spinner(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
- SWTException
- SWT.READ_ONLY
,
SWT.WRAP
,
Widget.checkSubclass()
,
Widget.getStyle()
int callWindowProc(int hwnd, int msg, int wParam, int lParam)
callWindowProc
in class Scrollable
static int checkStyle(int style)
boolean checkHandle(int hwnd)
checkHandle
in class Control
protected void checkSubclass()
Widget
The SWT class library is intended to be subclassed
only at specific, controlled points (most notably,
Composite
and Canvas
when
implementing new widgets). This method enforces this
rule unless it is overridden.
IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.
The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.
checkSubclass
in class Composite
void createHandle()
createHandle
in class Composite
public void addModifyListener(ModifyListener listener)
ModifyListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- ModifyListener
,
removeModifyListener(org.eclipse.swt.events.ModifyListener)
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
widgetSelected
is not called for texts.
widgetDefaultSelected
is typically called when ENTER is pressed in a single-line text.
listener
- the listener which should be notified when the control is selected by the userjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
void addVerifyListener(VerifyListener listener)
VerifyListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- VerifyListener
,
removeVerifyListener(org.eclipse.swt.events.VerifyListener)
int borderHandle()
borderHandle
in class Control
public Point computeSize(int wHint, int hHint, boolean changed)
Control
The preferred size of a control is the size that it would
best be displayed at. The width hint and height hint arguments
allow the caller to ask a control questions such as "Given a particular
width, how high does the control need to be to show all of the contents?"
To indicate that the caller does not wish to constrain a particular
dimension, the constant SWT.DEFAULT
is passed for the hint.
If the changed flag is true
, it indicates that the receiver's
contents have changed, therefore any caches that a layout manager
containing the control may have been keeping need to be flushed. When the
control is resized, the changed flag will be false
, so layout
manager caches can be retained.
computeSize
in class Composite
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwiseLayout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack(boolean)
,
"computeTrim, getClientArea for controls that implement them"public Rectangle computeTrim(int x, int y, int width, int height)
Scrollable
In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).
computeTrim
in class Scrollable
x
- the desired x coordinate of the client areay
- the desired y coordinate of the client areawidth
- the desired width of the client areaheight
- the desired height of the client areaScrollable.getClientArea()
public void copy()
The current selection is copied to the clipboard.
SWTException
- public void cut()
The current selection is first copied to the clipboard and then deleted from the widget.
SWTException
- int defaultBackground()
defaultBackground
in class Control
void enableWidget(boolean enabled)
enableWidget
in class Control
void deregister()
deregister
in class Control
public int getDigits()
SWTException
- java.lang.String getDecimalSeparator()
public int getIncrement()
SWTException
- public int getMaximum()
SWTException
- public int getMinimum()
SWTException
- public int getPageIncrement()
SWTException
- public int getSelection()
SWTException
- int getSelectionText(boolean[] parseFail)
public java.lang.String getText()
SWTException
- public int getTextLimit()
setTextLimit()
, it will be the constant
Spinner.LIMIT
.SWTException
- LIMIT
int mbcsToWcsPos(int mbcsPos)
public void paste()
The selected text is deleted from the widget and new text inserted from the clipboard.
SWTException
- void releaseHandle()
releaseHandle
in class Control
public void removeModifyListener(ModifyListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- ModifyListener
,
addModifyListener(org.eclipse.swt.events.ModifyListener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
void removeVerifyListener(VerifyListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- VerifyListener
,
addVerifyListener(org.eclipse.swt.events.VerifyListener)
boolean sendKeyEvent(int type, int msg, int wParam, int lParam, Event event)
sendKeyEvent
in class Widget
void setBackgroundImage(int hBitmap)
setBackgroundImage
in class Control
void setBackgroundPixel(int pixel)
setBackgroundPixel
in class Control
public void setDigits(int value)
The digit setting is used to allow for floating point values in the receiver. For example, to set the selection to a floating point value of 1.37 call setDigits() with a value of 2 and setSelection() with a value of 137. Similarly, if getDigits() has a value of 2 and getSelection() returns 137 this should be interpreted as 1.37. This applies to all numeric APIs.
value
- the new digits (must be greater than or equal to zero)java.lang.IllegalArgumentException
- SWTException
- void setForegroundPixel(int pixel)
setForegroundPixel
in class Control
public void setIncrement(int value)
value
- the new increment (must be greater than zero)SWTException
- public void setMaximum(int value)
value
- the new maximum, which must be greater than or equal to the current minimumSWTException
- public void setMinimum(int value)
value
- the new minimum, which must be less than or equal to the current maximumSWTException
- public void setPageIncrement(int value)
value
- the page increment (must be greater than zero)SWTException
- public void setSelection(int value)
value
- the new selection (must be zero or greater)SWTException
- void setSelection(int value, boolean setPos, boolean setText, boolean notify)
public void setTextLimit(int limit)
To reset this value to the default, use setTextLimit(Spinner.LIMIT)
.
Specifying a limit value larger than Spinner.LIMIT
sets the
receiver's limit to Spinner.LIMIT
.
limit
- new text limitjava.lang.IllegalArgumentException
- SWTException
- LIMIT
void setToolTipText(Shell shell, java.lang.String string)
setToolTipText
in class Control
public void setValues(int selection, int minimum, int maximum, int digits, int increment, int pageIncrement)
Note: This is similar to setting the values individually using the appropriate methods, but may be implemented in a more efficient fashion on some platforms.
selection
- the new selection valueminimum
- the new minimum valuemaximum
- the new maximum valuedigits
- the new digits valueincrement
- the new increment valuepageIncrement
- the new pageIncrement valueSWTException
- void unsubclass()
unsubclass
in class Control
void updateOrientation()
updateOrientation
in class Composite
java.lang.String verifyText(java.lang.String string, int start, int end, Event keyEvent)
int widgetExtStyle()
widgetExtStyle
in class Scrollable
int windowProc(int hwnd, int msg, int wParam, int lParam)
windowProc
in class Control
LRESULT WM_ERASEBKGND(int wParam, int lParam)
WM_ERASEBKGND
in class Composite
LRESULT WM_KILLFOCUS(int wParam, int lParam)
WM_KILLFOCUS
in class Control
LRESULT WM_SETFOCUS(int wParam, int lParam)
WM_SETFOCUS
in class Control
LRESULT WM_SETFONT(int wParam, int lParam)
WM_SETFONT
in class Composite
LRESULT wmClipboard(int hwndText, int msg, int wParam, int lParam)
LRESULT wmCommandChild(int wParam, int lParam)
wmCommandChild
in class Control
LRESULT wmKillFocus(int hwnd, int wParam, int lParam)
wmKillFocus
in class Widget
LRESULT wmNotifyChild(NMHDR hdr, int wParam, int lParam)
wmNotifyChild
in class Control
LRESULT wmScrollChild(int wParam, int lParam)
wmScrollChild
in class Control