public class ToolBar extends Composite
The item children that may be added to instances of this class
must be of type ToolItem
.
Note that although this class is a subclass of Composite
,
it does not make sense to add Control
children to it,
or set a layout on it.
Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.
IMPORTANT: This class is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
(package private) static int |
DEFAULT_HEIGHT |
(package private) static int |
DEFAULT_WIDTH |
(package private) ImageList |
disabledImageList |
(package private) ImageList |
hotImageList |
(package private) boolean |
ignoreMouse |
(package private) boolean |
ignoreResize |
(package private) ImageList |
imageList |
(package private) ToolItem[] |
items |
(package private) int |
lastArrowId |
(package private) int |
lastFocusId |
(package private) int |
lastHotId |
(package private) ToolItem[] |
tabItemList |
(package private) static TCHAR |
ToolBarClass |
(package private) static int |
ToolBarProc |
backgroundMode, layout, layoutCount, lpwp, tabList
horizontalBar, verticalBar
accessible, background, backgroundImage, cursor, drawCount, font, foreground, handle, layoutData, menu, parent, region, toolTipText
CANVAS, data, 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 |
---|
ToolBar(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 |
---|---|
(package private) ToolItem[] |
_getItems() |
(package private) ToolItem[] |
_getTabItemList() |
(package private) int |
callWindowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) void |
checkBuffered() |
(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.
|
(package private) Widget |
computeTabGroup() |
(package private) Widget[] |
computeTabList() |
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.
|
(package private) void |
createHandle() |
(package private) void |
createItem(ToolItem item,
int index) |
(package private) void |
createWidget() |
(package private) int |
defaultBackground() |
(package private) void |
destroyItem(ToolItem item) |
(package private) void |
enableWidget(boolean enabled) |
(package private) ImageList |
getDisabledImageList() |
(package private) ImageList |
getHotImageList() |
(package private) ImageList |
getImageList() |
ToolItem |
getItem(int index)
Returns the item at the given, zero-relative index in the
receiver.
|
ToolItem |
getItem(Point point)
Returns the item at the given point in the receiver
or null if no such item exists.
|
int |
getItemCount()
Returns the number of items contained in the receiver.
|
ToolItem[] |
getItems()
Returns an array of
ToolItem s which are the items
in the receiver. |
int |
getRowCount()
Returns the number of rows in the receiver.
|
int |
indexOf(ToolItem item)
Searches the receiver's list starting at the first item
(index 0) until an item is found that is equal to the
argument, and returns the index of that item.
|
(package private) void |
layoutItems() |
(package private) boolean |
mnemonicHit(char ch) |
(package private) boolean |
mnemonicMatch(char ch) |
(package private) void |
releaseChildren(boolean destroy) |
(package private) void |
releaseWidget() |
(package private) void |
removeControl(Control control) |
(package private) void |
reskinChildren(int flags) |
(package private) void |
setBackgroundImage(int hBitmap) |
(package private) void |
setBackgroundPixel(int pixel) |
(package private) void |
setBackgroundTransparent(boolean transparent) |
(package private) void |
setBounds(int x,
int y,
int width,
int height,
int flags) |
(package private) void |
setDefaultFont() |
(package private) void |
setDisabledImageList(ImageList imageList) |
(package private) void |
setDropDownItems(boolean set) |
void |
setFont(Font font)
Sets the font that the receiver will use to paint textual information
to the font specified by the argument, or to the default font for that
kind of control if the argument is null.
|
(package private) void |
setHotImageList(ImageList imageList) |
(package private) void |
setImageList(ImageList imageList) |
boolean |
setParent(Composite parent)
Changes the parent of the widget to be the one provided if
the underlying operating system supports this feature.
|
void |
setRedraw(boolean redraw)
If the argument is
false , causes subsequent drawing
operations in the receiver to be ignored. |
(package private) void |
setRowCount(int count) |
(package private) boolean |
setTabItemFocus() |
(package private) void |
setTabItemList(ToolItem[] tabList) |
(package private) java.lang.String |
toolTipText(NMTTDISPINFO hdr) |
(package private) void |
updateOrientation() |
(package private) int |
widgetStyle() |
(package private) TCHAR |
windowClass() |
(package private) int |
windowProc() |
(package private) LRESULT |
WM_CAPTURECHANGED(int wParam,
int lParam) |
(package private) LRESULT |
WM_CHAR(int wParam,
int lParam) |
(package private) LRESULT |
WM_COMMAND(int wParam,
int lParam) |
(package private) LRESULT |
WM_ERASEBKGND(int wParam,
int lParam) |
(package private) LRESULT |
WM_GETDLGCODE(int wParam,
int lParam) |
(package private) LRESULT |
WM_KEYDOWN(int wParam,
int lParam) |
(package private) LRESULT |
WM_KILLFOCUS(int wParam,
int lParam) |
(package private) LRESULT |
WM_LBUTTONDOWN(int wParam,
int lParam) |
(package private) LRESULT |
WM_LBUTTONUP(int wParam,
int lParam) |
(package private) LRESULT |
WM_MOUSELEAVE(int wParam,
int lParam) |
(package private) LRESULT |
WM_MOUSEMOVE(int wParam,
int lParam) |
(package private) LRESULT |
WM_NOTIFY(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETFOCUS(int wParam,
int lParam) |
(package private) LRESULT |
WM_SIZE(int wParam,
int lParam) |
(package private) LRESULT |
WM_WINDOWPOSCHANGING(int wParam,
int lParam) |
(package private) LRESULT |
wmCommandChild(int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyChild(NMHDR hdr,
int wParam,
int lParam) |
_getChildren, _getTabList, changed, checkComposited, copyArea, drawBackground, findDeferredControl, findMenus, fixChildren, fixTabList, getBackgroundMode, getChildren, getChildrenCount, getLayout, getLayoutDeferred, getTabList, hooksKeys, isLayoutDeferred, layout, layout, layout, layout, layout, markLayout, minimumSize, redrawChildren, releaseParent, resizeChildren, resizeChildren, resizeEmbeddedHandle, sendResize, setBackgroundMode, setBounds, setFocus, setLayout, setLayoutDeferred, setResizeChildren, setTabGroupFocus, setTabList, translateMnemonic, translateTraversal, updateBackgroundColor, updateBackgroundImage, updateBackgroundMode, updateFont, updateLayout, updateLayout, updateUIState, WM_GETFONT, WM_NCHITTEST, WM_PAINT, WM_PARENTNOTIFY, WM_PRINTCLIENT, WM_SETFONT, WM_SYSCOLORCHANGE, WM_SYSCOMMAND, WM_UPDATEUISTATE, wmNCPaint, wmNotify
createScrollBar, destroyScrollBar, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, scrolledHandle, widgetExtStyle, WM_HSCROLL, WM_MOUSEWHEEL, WM_VSCROLL, wmScroll, wmScrollWheel
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, binarySearch, borderHandle, checkBackground, checkBorder, checkGesture, checkHandle, checkMirrored, computeSize, computeTabRoot, defaultFont, defaultForeground, deregister, 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, hasFocus, internal_dispose_GC, internal_new_GC, isActive, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, mapEvent, menuShell, moveAbove, moveBelow, new_Accessible, new_GC, pack, pack, print, printWidget, redraw, redraw, redraw, register, releaseHandle, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, sendFocusEvent, sendGestureEvent, sendMove, sendTouchEvent, setBackground, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setCursor, setDragDetect, setEnabled, setForeground, setForegroundPixel, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setRadioFocus, setRadioSelection, setRegion, setSavedFocus, setSize, setSize, setToolTipText, setToolTipText, setTouchEnabled, setVisible, showWidget, sort, subclass, toControl, toControl, toDisplay, toDisplay, topHandle, translateAccelerator, translateMnemonic, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, unsubclass, update, update, updateImages, widgetCreateStruct, widgetParent, windowProc, WM_ACTIVATE, WM_CHANGEUISTATE, WM_CLEAR, WM_CLOSE, 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_KEYUP, WM_LBUTTONDBLCLK, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSEHWHEEL, WM_MOVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCLBUTTONDOWN, WM_NCPAINT, 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_XBUTTONDBLCLK, WM_XBUTTONDOWN, WM_XBUTTONUP, wmColorChild, wmDrawChild, wmMeasureChild, wmScrollChild
_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, sendKeyEvent, sendMouseEvent, sendMouseEvent, sendMouseWheelEvent, sendSelectionEvent, sendSelectionEvent, setData, setData, setInputState, setKeyState, setLocationMask, SetWindowPos, showMenu, showMenu, toString, updateMenuLocation, wmCaptureChanged, wmChar, wmContextMenu, wmIMEChar, wmKeyDown, wmKeyUp, wmKillFocus, wmLButtonDblClk, wmLButtonDown, wmLButtonUp, wmMButtonDblClk, wmMButtonDown, wmMButtonUp, wmMouseHover, wmMouseHWheel, wmMouseLeave, wmMouseMove, wmMouseWheel, wmPaint, wmPrint, wmRButtonDblClk, wmRButtonDown, wmRButtonUp, wmSetFocus, wmSysChar, wmSysKeyDown, wmSysKeyUp, wmXButtonDblClk, wmXButtonDown, wmXButtonUp
int lastFocusId
int lastArrowId
int lastHotId
ToolItem[] items
ToolItem[] tabItemList
boolean ignoreResize
boolean ignoreMouse
ImageList imageList
ImageList disabledImageList
ImageList hotImageList
static final int ToolBarProc
static final TCHAR ToolBarClass
static final int DEFAULT_WIDTH
static final int DEFAULT_HEIGHT
public ToolBar(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.FLAT
,
SWT.WRAP
,
SWT.RIGHT
,
SWT.HORIZONTAL
,
SWT.SHADOW_OUT
,
SWT.VERTICAL
,
Widget.checkSubclass()
,
Widget.getStyle()
int callWindowProc(int hwnd, int msg, int wParam, int lParam)
callWindowProc
in class Scrollable
static int checkStyle(int style)
void checkBuffered()
checkBuffered
in class Composite
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
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()
Widget computeTabGroup()
computeTabGroup
in class Control
Widget[] computeTabList()
computeTabList
in class Composite
void createHandle()
createHandle
in class Composite
void createItem(ToolItem item, int index)
void createWidget()
createWidget
in class Scrollable
int defaultBackground()
defaultBackground
in class Control
void destroyItem(ToolItem item)
void enableWidget(boolean enabled)
enableWidget
in class Control
ImageList getDisabledImageList()
ImageList getHotImageList()
ImageList getImageList()
public ToolItem getItem(int index)
index
- the index of the item to returnjava.lang.IllegalArgumentException
- SWTException
- public ToolItem getItem(Point point)
point
- the point used to locate the itemjava.lang.IllegalArgumentException
- SWTException
- public int getItemCount()
SWTException
- public ToolItem[] getItems()
ToolItem
s which are the items
in the receiver.
Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.
SWTException
- ToolItem[] _getItems()
public int getRowCount()
WRAP
style, the
number of rows can be greater than one. Otherwise,
the number of rows is always one.SWTException
- ToolItem[] _getTabItemList()
public int indexOf(ToolItem item)
item
- the search itemjava.lang.IllegalArgumentException
- SWTException
- void layoutItems()
boolean mnemonicHit(char ch)
mnemonicHit
in class Control
boolean mnemonicMatch(char ch)
mnemonicMatch
in class Control
void releaseChildren(boolean destroy)
releaseChildren
in class Composite
void releaseWidget()
releaseWidget
in class Composite
void removeControl(Control control)
removeControl
in class Composite
void reskinChildren(int flags)
reskinChildren
in class Composite
void setBackgroundImage(int hBitmap)
setBackgroundImage
in class Control
void setBackgroundPixel(int pixel)
setBackgroundPixel
in class Control
void setBackgroundTransparent(boolean transparent)
void setBounds(int x, int y, int width, int height, int flags)
void setDefaultFont()
setDefaultFont
in class Control
void setDropDownItems(boolean set)
void setDisabledImageList(ImageList imageList)
public void setFont(Font font)
Control
void setHotImageList(ImageList imageList)
void setImageList(ImageList imageList)
public boolean setParent(Composite parent)
Control
true
if the parent is successfully changed.public void setRedraw(boolean redraw)
Control
false
, causes subsequent drawing
operations in the receiver to be ignored. No drawing of any kind
can occur in the receiver until the flag is set to true.
Graphics operations that occurred while the flag was
false
are lost. When the flag is set to true
,
the entire widget is marked as needing to be redrawn. Nested calls
to this method are stacked.
Note: This operation is a hint and may not be supported on some platforms or for some widgets.
setRedraw
in class Control
redraw
- the new redraw stateControl.redraw(int, int, int, int, boolean)
,
Control.update()
void setRowCount(int count)
void setTabItemList(ToolItem[] tabList)
boolean setTabItemFocus()
setTabItemFocus
in class Control
java.lang.String toolTipText(NMTTDISPINFO hdr)
toolTipText
in class Composite
void updateOrientation()
updateOrientation
in class Composite
int widgetStyle()
widgetStyle
in class Composite
TCHAR windowClass()
windowClass
in class Scrollable
int windowProc()
windowProc
in class Scrollable
LRESULT WM_CAPTURECHANGED(int wParam, int lParam)
WM_CAPTURECHANGED
in class Control
LRESULT WM_COMMAND(int wParam, int lParam)
WM_COMMAND
in class Control
LRESULT WM_ERASEBKGND(int wParam, int lParam)
WM_ERASEBKGND
in class Composite
LRESULT WM_GETDLGCODE(int wParam, int lParam)
WM_GETDLGCODE
in class Composite
LRESULT WM_KEYDOWN(int wParam, int lParam)
WM_KEYDOWN
in class Control
LRESULT WM_KILLFOCUS(int wParam, int lParam)
WM_KILLFOCUS
in class Control
LRESULT WM_LBUTTONDOWN(int wParam, int lParam)
WM_LBUTTONDOWN
in class Composite
LRESULT WM_LBUTTONUP(int wParam, int lParam)
WM_LBUTTONUP
in class Control
LRESULT WM_MOUSELEAVE(int wParam, int lParam)
WM_MOUSELEAVE
in class Control
LRESULT WM_MOUSEMOVE(int wParam, int lParam)
WM_MOUSEMOVE
in class Control
LRESULT WM_SETFOCUS(int wParam, int lParam)
WM_SETFOCUS
in class Control
LRESULT WM_WINDOWPOSCHANGING(int wParam, int lParam)
WM_WINDOWPOSCHANGING
in class Control
LRESULT wmCommandChild(int wParam, int lParam)
wmCommandChild
in class Control
LRESULT wmNotifyChild(NMHDR hdr, int wParam, int lParam)
wmNotifyChild
in class Control