org.eclipse.swt.widgets
Class CoolBar

java.lang.Object
  |
  +--org.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:
Drawable

public class CoolBar
extends Composite

Safe:


Field Summary
(package private)  boolean ignoreResize
           
(package private)  CoolItem[] items
           
(package private)  boolean locked
           
(package private) static int MAX_WIDTH
           
(package private)  CoolItem[] originalItems
           
(package private) static org.eclipse.swt.internal.win32.TCHAR ReBarClass
           
(package private) static int ReBarProc
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
font, layout, lpwp, tabList
 
Fields inherited from class org.eclipse.swt.widgets.Scrollable
horizontalBar, verticalBar
 
Fields inherited from class org.eclipse.swt.widgets.Control
ACCENTS, accessible, background, drawCount, foreground, handle, hCursor, layoutData, menu, parent, toolTipText
 
Fields inherited from class org.eclipse.swt.widgets.Widget
CANVAS, COMCTL32_MAJOR, COMCTL32_MINOR, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, DISPOSED, eventTable, HIDDEN, keys, MAJOR, MINOR, Mnemonic, state, style, values
 
Constructor Summary
CoolBar(Composite parent, int style)
          Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
(package private)  int callWindowProc(int msg, int wParam, int lParam)
           
(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)
          Enabled:
(package private)  void createHandle()
           
(package private)  void createItem(CoolItem item, int index)
           
(package private)  void createWidget()
           
(package private)  void destroyItem(CoolItem item)
           
 CoolItem getItem(int index)
          Enabled: Returns the item that is currently displayed at the given, zero-relative index.
 int getItemCount()
          Enabled: Returns the number of items contained in the receiver.
 int[] getItemOrder()
          Enabled: 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()
          Enabled: Returns an array of CoolItems in the order in which they are currently being displayed.
 Point[] getItemSizes()
          Enabled: 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.
(package private)  int getLastIndexOfRow(int index)
           
 boolean getLocked()
          Enabled: Returns whether or not the receiver is 'locked'.
 int[] getWrapIndices()
          Enabled: 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)
          Enabled: 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 releaseWidget()
           
(package private)  void resizeToMaximumWidth(int index)
           
(package private)  void resizeToPreferredWidth(int index)
           
(package private)  void setBackgroundPixel(int pixel)
           
(package private)  void setForegroundPixel(int pixel)
           
(package private)  void setItemColors(int foreColor, int backColor)
           
 void setItemLayout(int[] itemOrder, int[] wrapIndices, Point[] sizes)
          Enabled: Sets the receiver's item order, wrap indices, and item sizes all at once.
(package private)  void setItemOrder(int[] itemOrder)
           
(package private)  void setItemSizes(Point[] sizes)
           
 void setLocked(boolean locked)
          Enabled: Sets whether or not the receiver is 'locked'.
 void setWrapIndices(int[] indices)
          Enabled: Sets the indices of all item(s) in the receiver that will begin on a new row.
(package private)  int widgetStyle()
           
(package private)  org.eclipse.swt.internal.win32.TCHAR windowClass()
           
(package private)  int windowProc()
           
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_COMMAND(int wParam, int lParam)
           
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_ERASEBKGND(int wParam, int lParam)
           
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_NOTIFY(int wParam, int lParam)
           
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_SETREDRAW(int wParam, int lParam)
           
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_SIZE(int wParam, int lParam)
           
(package private)  org.eclipse.swt.internal.win32.LRESULT wmNotifyChild(int wParam, int lParam)
           
 
Methods inherited from class org.eclipse.swt.widgets.Composite
_getChildren, _getTabList, computeTabList, getChildren, getChildrenCount, getLayout, getTabList, hooksKeys, layout, layout, minimumSize, moveAbove, moveBelow, releaseChildren, resizeChildren, resizeChildren, setFocus, setLayout, setResizeChildren, setTabGroupFocus, setTabItemFocus, setTabList, toolTipText, translateMnemonic, updateFont, WM_GETDLGCODE, WM_GETFONT, WM_LBUTTONDOWN, WM_PAINT, WM_SETFONT, WM_SYSCOLORCHANGE, WM_SYSCOMMAND
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, createScrollBar, getClientArea, getHorizontalBar, getVerticalBar, widgetExtStyle, WM_HSCROLL, WM_MOUSEWHEEL, WM_VSCROLL, wmScroll
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, checkOrientation, computeSize, computeTabGroup, computeTabRoot, defaultBackground, defaultFont, defaultForeground, deregister, destroyWidget, drawBackground, drawBackground, findBrush, findCursor, findMnemonic, fixFocus, forceFocus, forceResize, getAccessible, getBackground, getBackgroundPixel, getBorderWidth, getBounds, getCodePage, getDisplay, getEnabled, getFont, getForeground, getForegroundPixel, getLayoutData, getLocation, getMenu, getParent, getPath, getShell, getSize, getToolTipText, getVisible, hasCursor, hasFocus, internal_dispose_GC, internal_new_GC, isActive, isDisposed, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, new_Accessible, pack, pack, redraw, redraw, register, releaseHandle, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, sendKeyEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, setBackground, setBounds, setBounds, setBounds, setCapture, setCursor, setDefaultFont, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRadioFocus, setRadioSelection, setRedraw, setSavedFocus, setSize, setSize, setToolTipText, setVisible, sort, subclass, toControl, toControl, toDisplay, toDisplay, transferActive, transferFocus, translateAccelerator, translateMnemonic, translateTraversal, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, unsubclass, update, update, windowProc, WM_ACTIVATE, WM_CHAR, WM_CLEAR, WM_CLOSE, WM_CONTEXTMENU, WM_CTLCOLOR, WM_CUT, WM_DESTROY, WM_DRAWITEM, WM_ENDSESSION, WM_GETOBJECT, WM_HELP, WM_HOTKEY, WM_IME_CHAR, WM_IME_COMPOSITION, WM_INITMENUPOPUP, WM_KEYDOWN, WM_KEYUP, WM_KILLFOCUS, WM_LBUTTONDBLCLK, WM_LBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSELEAVE, WM_MOUSEMOVE, WM_MOVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCHITTEST, WM_PALETTECHANGED, WM_PASTE, WM_PRINTCLIENT, WM_QUERYENDSESSION, WM_QUERYNEWPALETTE, WM_QUERYOPEN, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETFOCUS, WM_SETTINGCHANGE, WM_SHOWWINDOW, WM_SYSCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TIMER, WM_UNDO, WM_WINDOWPOSCHANGING, wmColorChild, wmCommandChild, wmDrawChild, wmMeasureChild, wmScrollChild
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkParent, checkWidget, dispose, error, filters, getData, getData, getName, getNameText, getStyle, hooks, isListening, isValidSubclass, isValidThread, mbcsToWcs, mbcsToWcs, notifyListeners, postEvent, postEvent, releaseChild, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, toString, wcsToMbcs, wcsToMbcs
 
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

locked

boolean locked

ignoreResize

boolean ignoreResize

ReBarProc

static final int ReBarProc

ReBarClass

static final org.eclipse.swt.internal.win32.TCHAR ReBarClass

MAX_WIDTH

static final int MAX_WIDTH
Constructor Detail

CoolBar

public CoolBar(Composite parent,
               int style)
Enabled: 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 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.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()
Method Detail

callWindowProc

int callWindowProc(int msg,
                   int wParam,
                   int lParam)
Overrides:
callWindowProc in class Scrollable

checkStyle

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, 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.

Overrides:
checkSubclass in class Composite

computeSize

public Point computeSize(int wHint,
                         int hHint,
                         boolean changed)
Enabled:

Overrides:
computeSize in class Composite
Parameters:
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 otherwise
Returns:
the preferred size of the control.
See Also:
Layout, Control.getBorderWidth(), Control.getBounds(), Control.getSize(), Control.pack(), "computeTrim, getClientArea for controls that implement them"

createHandle

void createHandle()
Overrides:
createHandle in class Composite

createItem

void createItem(CoolItem item,
                int index)

createWidget

void createWidget()
Overrides:
createWidget in class Scrollable

destroyItem

void destroyItem(CoolItem item)

getItem

public CoolItem getItem(int index)
Enabled: Returns the item that is currently displayed at the given, zero-relative index. Throws an exception if the index is out of range.

Parameters:
index - the visual index of the item to return
Returns:
the item at the given visual index

getItemCount

public int getItemCount()
Enabled: Returns the number of items contained in the receiver.

Returns:
the number of items

getItemOrder

public int[] getItemOrder()
Enabled: 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.

Returns:
the current visual order of the receiver's items

getItems

public CoolItem[] getItems()
Enabled: 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.

Returns:
the receiver's items in their current visual order

getItemSizes

public Point[] getItemSizes()
Enabled: 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.

Returns:
the receiver's item sizes in their current visual order

getLastIndexOfRow

int getLastIndexOfRow(int index)

getLocked

public boolean getLocked()
Enabled: Returns whether or not the receiver is 'locked'. When a coolbar is locked, its items cannot be repositioned.

Returns:
true if the coolbar is locked, false otherwise
Since:
2.0

getWrapIndices

public int[] getWrapIndices()
Enabled: 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.

Returns:
an array containing the receiver's wrap indices, or an empty array if all items are in one row

indexOf

public int indexOf(CoolItem item)
Enabled: 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.

Parameters:
item - the search item
Returns:
the visual order index of the search item, or -1 if the item is not found

resizeToPreferredWidth

void resizeToPreferredWidth(int index)

resizeToMaximumWidth

void resizeToMaximumWidth(int index)

releaseWidget

void releaseWidget()
Overrides:
releaseWidget in class Composite

setBackgroundPixel

void setBackgroundPixel(int pixel)
Overrides:
setBackgroundPixel in class Control

setForegroundPixel

void setForegroundPixel(int pixel)
Overrides:
setForegroundPixel in class Control

setItemColors

void setItemColors(int foreColor,
                   int backColor)

setItemLayout

public void setItemLayout(int[] itemOrder,
                          int[] wrapIndices,
                          Point[] sizes)
Enabled: 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.

Parameters:
itemOrder - an array of indices that describe the new order to display the items in
wrapIndices - an array of wrap indices, or null
sizes - an array containing the new sizes for each of the receiver's items in visual order

setItemOrder

void setItemOrder(int[] itemOrder)

setItemSizes

void setItemSizes(Point[] sizes)

setLocked

public void setLocked(boolean locked)
Enabled: Sets whether or not the receiver is 'locked'. When a coolbar is locked, its items cannot be repositioned.

Parameters:
locked - lock the coolbar if true, otherwise unlock the coolbar
Since:
2.0

setWrapIndices

public void setWrapIndices(int[] indices)
Enabled: 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.

Parameters:
indices - an array of wrap indices, or null

widgetStyle

int widgetStyle()
Overrides:
widgetStyle in class Composite

windowClass

org.eclipse.swt.internal.win32.TCHAR windowClass()
Overrides:
windowClass in class Scrollable

windowProc

int windowProc()
Overrides:
windowProc in class Scrollable

WM_COMMAND

org.eclipse.swt.internal.win32.LRESULT WM_COMMAND(int wParam,
                                                  int lParam)
Overrides:
WM_COMMAND in class Control

WM_ERASEBKGND

org.eclipse.swt.internal.win32.LRESULT WM_ERASEBKGND(int wParam,
                                                     int lParam)
Overrides:
WM_ERASEBKGND in class Composite

WM_NOTIFY

org.eclipse.swt.internal.win32.LRESULT WM_NOTIFY(int wParam,
                                                 int lParam)
Overrides:
WM_NOTIFY in class Composite

WM_SETREDRAW

org.eclipse.swt.internal.win32.LRESULT WM_SETREDRAW(int wParam,
                                                    int lParam)
Overrides:
WM_SETREDRAW in class Control

WM_SIZE

org.eclipse.swt.internal.win32.LRESULT WM_SIZE(int wParam,
                                               int lParam)
Overrides:
WM_SIZE in class Composite

wmNotifyChild

org.eclipse.swt.internal.win32.LRESULT wmNotifyChild(int wParam,
                                                     int lParam)
Overrides:
wmNotifyChild in class Control


comments?