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.
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 |
---|---|
protected void |
checkSubclass()
Checks that this class can be subclassed.
|
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.
|
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.
|
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. |
changed, 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, 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, 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, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, 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 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 constructIllegalArgumentException
- SWTException
- SWT.FLAT
,
SWT.WRAP
,
SWT.RIGHT
,
SWT.HORIZONTAL
,
SWT.SHADOW_OUT
,
SWT.VERTICAL
,
Widget.checkSubclass()
,
Widget.getStyle()
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 ToolItem getItem(int index)
index
- the index of the item to returnIllegalArgumentException
- SWTException
- public ToolItem getItem(Point point)
point
- the point used to locate the itemIllegalArgumentException
- 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
- public int getRowCount()
WRAP
style, the
number of rows can be greater than one. Otherwise,
the number of rows is always one.SWTException
- public int indexOf(ToolItem item)
item
- the search itemIllegalArgumentException
- SWTException
- public void setFont(Font font)
Control
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()
Copyright © 2017. All Rights Reserved.