|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.widgets
Class CoolBar

java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.CoolBar
- All Implemented Interfaces:
- org.eclipse.swt.graphics.Drawable
- public class CoolBar
- extends Composite
Instances of this class provide an area for dynamically positioning the items they contain.
The item children that may be added to instances of this class
must be of type CoolItem.
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.
- Styles:
- FLAT
- Events:
- (none)
IMPORTANT: This class is not intended to be subclassed.
| Field Summary | |
(package private) static int |
CLICK_DISTANCE
|
(package private) org.eclipse.swt.graphics.Cursor |
dragCursor
|
(package private) CoolItem |
dragging
|
(package private) org.eclipse.swt.graphics.Cursor |
hoverCursor
|
(package private) boolean |
inDispose
|
(package private) boolean |
isLocked
|
(package private) CoolItem[][] |
items
|
(package private) int |
itemXOffset
|
(package private) int |
mouseXOffset
|
(package private) CoolItem[] |
originalItems
|
(package private) static int |
ROW_SPACING
|
| Fields inherited from class org.eclipse.swt.widgets.Composite |
embeddedHandle, imHandle, layout, socketHandle, tabList |
| Fields inherited from class org.eclipse.swt.widgets.Scrollable |
horizontalBar, scrolledHandle, verticalBar |
| Fields inherited from class org.eclipse.swt.widgets.Control |
accessible, cursor, drawCount, enableWindow, fixedHandle, font, layoutData, menu, parent, redrawWindow, toolTipText |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
ACTIVATE, BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, CANVAS, CHANGED, CLICKED, COMMIT, CONFIGURE_EVENT, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_RANGE, DELETE_TEXT, DISABLED, display, DISPOSED, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPOSE_EVENT, FOCUS, FOCUS_IN_EVENT, FOCUS_OUT_EVENT, handle, HANDLE, HIDE, INSERT_TEXT, KEY_PRESS_EVENT, KEY_RELEASE_EVENT, KEYED_DATA, LEAVE_NOTIFY_EVENT, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MOTION_NOTIFY_EVENT, OBSCURED, POPUP_MENU, PREEDIT_CHANGED, REALIZE, ROW_ACTIVATED, SCROLL_CHILD, SELECT, SHOW, SHOW_HELP, SIZE_ALLOCATE, state, style, STYLE_SET, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TOGGLED, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, VISIBILITY_NOTIFY_EVENT, WINDOW_STATE_EVENT |
| Constructor Summary | |
CoolBar(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 | |
private static int |
checkStyle(int style)
|
protected void |
checkSubclass()
Checks that this class can be subclassed. |
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver. |
(package private) void |
createItem(CoolItem item,
int index)
|
(package private) void |
destroyItem(CoolItem item)
|
(package private) org.eclipse.swt.graphics.Point |
findItem(CoolItem item)
|
(package private) CoolItem |
getGrabbedItem(int x,
int y)
|
CoolItem |
getItem(int index)
Returns the item that is currently displayed at the given, zero-relative index. |
int |
getItemCount()
Returns the number of items contained in the receiver. |
int[] |
getItemOrder()
Returns an array of zero-relative ints that map the creation order of the receiver's items to the order in which they are currently being displayed. |
CoolItem[] |
getItems()
Returns an array of CoolItems in the order
in which they are currently being displayed. |
org.eclipse.swt.graphics.Point[] |
getItemSizes()
Returns an array of points whose x and y coordinates describe the widths and heights (respectively) of the items in the receiver in the order in which they are currently being displayed. |
boolean |
getLocked()
Returns whether or not the receiver is 'locked'. |
int[] |
getWrapIndices()
Returns an array of ints that describe the zero-relative indices of any item(s) in the receiver that will begin on a new row. |
int |
indexOf(CoolItem item)
Searches the receiver's items in the order they are currently being displayed, 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 |
insertItemIntoRow(CoolItem item,
int rowIndex,
int x_root)
Insert the item into the row. |
(package private) int |
layoutItems()
Return the height of the bar after it has been properly layed out for the given width. |
(package private) void |
moveDown(CoolItem item,
int x_root)
|
(package private) void |
moveLeft(CoolItem item,
int pixels)
|
(package private) void |
moveRight(CoolItem item,
int pixels)
|
(package private) void |
moveUp(CoolItem item,
int x_root)
|
(package private) void |
onDispose()
|
(package private) void |
onMouseDoubleClick(Event event)
|
(package private) void |
onMouseDown(Event event)
|
(package private) void |
onMouseExit()
|
(package private) void |
onMouseMove(Event event)
|
(package private) void |
onMouseUp(Event event)
|
(package private) void |
onPaint(Event event)
|
(package private) void |
relayout()
|
(package private) void |
removeItemFromRow(CoolItem item,
int rowIndex,
boolean disposed)
Remove the item from the row. |
void |
setBounds(int x,
int y,
int width,
int height)
Sets the receiver's size and location to the rectangular area specified by the arguments. |
void |
setItemLayout(int[] itemOrder,
int[] wrapIndices,
org.eclipse.swt.graphics.Point[] sizes)
Sets the receiver's item order, wrap indices, and item sizes all at once. |
(package private) void |
setItemOrder(int[] itemOrder)
|
(package private) void |
setItemSizes(org.eclipse.swt.graphics.Point[] sizes)
|
void |
setLocked(boolean locked)
Sets whether or not the receiver is 'locked'. |
void |
setSize(int width,
int height)
Sets the receiver's size to the point specified by the arguments. |
void |
setWrapIndices(int[] indices)
Sets the indices of all item(s) in the receiver that will begin on a new row. |
(package private) void |
wrapItems(int maxWidth)
|
| Methods inherited from class org.eclipse.swt.widgets.Scrollable |
clientHandle, computeTrim, createScrollBar, createWidget, getBorderWidth, getClientArea, getHorizontalBar, getVerticalBar, hScrollBarWidth, releaseHandle, setOrientation, topHandle, vScrollBarWidth |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
items
CoolItem[][] items
originalItems
CoolItem[] originalItems
hoverCursor
org.eclipse.swt.graphics.Cursor hoverCursor
dragCursor
org.eclipse.swt.graphics.Cursor dragCursor
dragging
CoolItem dragging
mouseXOffset
int mouseXOffset
itemXOffset
int itemXOffset
ROW_SPACING
static final int ROW_SPACING
- See Also:
- Constant Field Values
CLICK_DISTANCE
static final int CLICK_DISTANCE
- See Also:
- Constant Field Values
isLocked
boolean isLocked
inDispose
boolean inDispose
| Constructor Detail |
CoolBar
public CoolBar(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
SWTwhich 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 thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
| Method Detail |
checkStyle
private static int checkStyle(int style)
checkSubclass
protected void checkSubclass()
- Description copied from class:
Widget - Checks that this class can be subclassed.
The SWT class library is intended to be subclassed only at specific, controlled points (most notably,
CompositeandCanvaswhen 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.
- Overrides:
checkSubclassin classComposite
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
- Description copied from class:
Control - Returns the preferred size of the receiver.
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.DEFAULTis 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 befalse, so layout manager caches can be retained.- Overrides:
computeSizein classComposite
getGrabbedItem
CoolItem getGrabbedItem(int x, int y)
getItem
public CoolItem getItem(int index)
- Returns the item that is currently displayed at the given,
zero-relative index. Throws an exception if the index is
out of range.
getItemCount
public int getItemCount()
- Returns the number of items contained in the receiver.
getItems
public CoolItem[] getItems()
- Returns an array of
CoolItems in the order in which they are currently being displayed.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.
findItem
org.eclipse.swt.graphics.Point findItem(CoolItem item)
indexOf
public int indexOf(CoolItem item)
- Searches the receiver's items in the order they are currently
being displayed, 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. If no item is found, returns -1.
insertItemIntoRow
void insertItemIntoRow(CoolItem item, int rowIndex, int x_root)
- Insert the item into the row. Adjust the x and width values
appropriately.
createItem
void createItem(CoolItem item, int index)
destroyItem
void destroyItem(CoolItem item)
moveDown
void moveDown(CoolItem item, int x_root)
moveLeft
void moveLeft(CoolItem item, int pixels)
moveRight
void moveRight(CoolItem item, int pixels)
moveUp
void moveUp(CoolItem item, int x_root)
onDispose
void onDispose()
onMouseDown
void onMouseDown(Event event)
onMouseExit
void onMouseExit()
onMouseMove
void onMouseMove(Event event)
onMouseUp
void onMouseUp(Event event)
onMouseDoubleClick
void onMouseDoubleClick(Event event)
onPaint
void onPaint(Event event)
removeItemFromRow
void removeItemFromRow(CoolItem item, int rowIndex, boolean disposed)
- Remove the item from the row. Adjust the x and width values
appropriately.
layoutItems
int layoutItems()
- Return the height of the bar after it has
been properly layed out for the given width.
relayout
void relayout()
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Description copied from class:
Control - Sets the receiver's size and location to the rectangular
area specified by the arguments. The
xandyarguments are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell. In this case, thexandyarguments are relative to the display.Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
setSize
public void setSize(int width,
int height)
- Description copied from class:
Control - Sets the receiver's size to the point specified by the arguments.
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
getItemOrder
public int[] getItemOrder()
- Returns an array of zero-relative ints that map
the creation order of the receiver's items to the
order in which they are currently being displayed.
Specifically, the indices of the returned array represent the current visual order of the items, and the contents of the array represent the creation order of the items.
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.
setItemOrder
void setItemOrder(int[] itemOrder)
getItemSizes
public org.eclipse.swt.graphics.Point[] getItemSizes()
- Returns an array of points whose x and y coordinates describe
the widths and heights (respectively) of the items in the receiver
in the order in which they are currently being displayed.
setItemSizes
void setItemSizes(org.eclipse.swt.graphics.Point[] sizes)
getLocked
public boolean getLocked()
- Returns whether or not the receiver is 'locked'. When a coolbar
is locked, its items cannot be repositioned.
- Since:
- 2.0
getWrapIndices
public int[] getWrapIndices()
- Returns an array of ints that describe the zero-relative
indices of any item(s) in the receiver that will begin on
a new row. The 0th visible item always begins the first row,
therefore it does not count as a wrap index.
setLocked
public void setLocked(boolean locked)
- Sets whether or not the receiver is 'locked'. When a coolbar
is locked, its items cannot be repositioned.
- Since:
- 2.0
setWrapIndices
public void setWrapIndices(int[] indices)
- Sets the indices of all item(s) in the receiver that will
begin on a new row. The indices are given in the order in
which they are currently being displayed. The 0th item
always begins the first row, therefore it does not count
as a wrap index. If indices is null or empty, the items
will be placed on one line.
setItemLayout
public void setItemLayout(int[] itemOrder,
int[] wrapIndices,
org.eclipse.swt.graphics.Point[] sizes)
- Sets the receiver's item order, wrap indices, and item sizes
all at once. This method is typically used to restore the
displayed state of the receiver to a previously stored state.
The item order is the order in which the items in the receiver should be displayed, given in terms of the zero-relative ordering of when the items were added.
The wrap indices are the indices of all item(s) in the receiver that will begin on a new row. The indices are given in the order specified by the item order. The 0th item always begins the first row, therefore it does not count as a wrap index. If wrap indices is null or empty, the items will be placed on one line.
The sizes are specified in an array of points whose x and y coordinates describe the new widths and heights (respectively) of the receiver's items in the order specified by the item order.
wrapItems
void wrapItems(int maxWidth)
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC