public class CoolBar extends Composite
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.
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_COOLBAR_HEIGHT |
(package private) static int |
DEFAULT_COOLBAR_WIDTH |
(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 TCHAR |
ReBarClass |
(package private) static int |
ReBarProc |
(package private) static int |
SEPARATOR_WIDTH |
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 |
---|
CoolBar(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) int |
callWindowProc(int hwnd,
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)
Returns the preferred size of the receiver.
|
(package private) void |
createHandle() |
(package private) void |
createItem(CoolItem item,
int index) |
(package private) void |
createWidget() |
(package private) void |
destroyItem(CoolItem item) |
(package private) void |
drawThemeBackground(int hDC,
int hwnd,
RECT rect) |
(package private) Control |
findThemeControl() |
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
CoolItem s in the order
in which they are currently being displayed. |
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.
|
(package private) int |
getLastIndexOfRow(int index) |
boolean |
getLocked()
Returns whether or not the receiver is 'locked'.
|
(package private) int |
getMargin(int index) |
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) boolean |
isLastItemOfRow(int index) |
(package private) void |
releaseChildren(boolean destroy) |
(package private) void |
removeControl(Control control) |
(package private) void |
resizeToMaximumWidth(int index) |
(package private) void |
resizeToPreferredWidth(int index) |
(package private) void |
reskinChildren(int flags) |
(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)
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)
Sets whether or not the receiver is 'locked'.
|
void |
setWrapIndices(int[] indices)
Sets the indices of all item(s) in the receiver that will
begin on a new row.
|
(package private) int |
widgetStyle() |
(package private) TCHAR |
windowClass() |
(package private) int |
windowProc() |
(package private) LRESULT |
WM_COMMAND(int wParam,
int lParam) |
(package private) LRESULT |
WM_ERASEBKGND(int wParam,
int lParam) |
(package private) LRESULT |
WM_NOTIFY(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETREDRAW(int wParam,
int lParam) |
(package private) LRESULT |
WM_SIZE(int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyChild(NMHDR hdr,
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, releaseParent, releaseWidget, resizeChildren, resizeChildren, resizeEmbeddedHandle, sendResize, setBackgroundMode, setBounds, setFocus, setLayout, setLayoutDeferred, setResizeChildren, setTabGroupFocus, setTabList, toolTipText, translateMnemonic, translateTraversal, updateBackgroundColor, updateBackgroundImage, updateBackgroundMode, updateFont, updateLayout, updateLayout, updateOrientation, updateUIState, WM_GETDLGCODE, WM_GETFONT, WM_LBUTTONDOWN, WM_NCHITTEST, WM_PAINT, WM_PARENTNOTIFY, WM_PRINTCLIENT, WM_SETFONT, WM_SYSCOLORCHANGE, WM_SYSCOMMAND, WM_UPDATEUISTATE, wmNCPaint, wmNotify
computeTrim, 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, computeTabGroup, computeTabRoot, defaultBackground, defaultFont, defaultForeground, deregister, destroyWidget, dragDetect, dragDetect, dragDetect, drawBackground, drawBackground, drawBackground, drawImageBackground, enableDrag, enableWidget, fillBackground, fillImageBackground, fillThemeBackground, findBackgroundControl, findBrush, findCursor, findImageControl, findMnemonic, 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, mnemonicHit, mnemonicMatch, 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, 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, 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_CAPTURECHANGED, WM_CHANGEUISTATE, WM_CHAR, 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_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_MOUSEHWHEEL, WM_MOUSELEAVE, WM_MOUSEMOVE, 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_SETFOCUS, 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, wmCommandChild, 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
CoolItem[] items
CoolItem[] originalItems
boolean locked
boolean ignoreResize
static final int ReBarProc
static final TCHAR ReBarClass
static final int SEPARATOR_WIDTH
static final int MAX_WIDTH
static final int DEFAULT_COOLBAR_WIDTH
static final int DEFAULT_COOLBAR_HEIGHT
public CoolBar(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
,
SWT.FLAT
,
SWT.HORIZONTAL
,
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)
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"void createHandle()
createHandle
in class Composite
void createItem(CoolItem item, int index)
void createWidget()
createWidget
in class Scrollable
void destroyItem(CoolItem item)
void drawThemeBackground(int hDC, int hwnd, RECT rect)
drawThemeBackground
in class Control
Control findThemeControl()
findThemeControl
in class Control
int getMargin(int index)
public CoolItem getItem(int index)
index
- the visual index of the item to returnjava.lang.IllegalArgumentException
- SWTException
- public int getItemCount()
SWTException
- public int[] getItemOrder()
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.
SWTException
- public CoolItem[] getItems()
CoolItem
s 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.
SWTException
- public Point[] getItemSizes()
SWTException
- int getLastIndexOfRow(int index)
boolean isLastItemOfRow(int index)
public boolean getLocked()
SWTException
- public int[] getWrapIndices()
SWTException
- public int indexOf(CoolItem item)
item
- the search itemjava.lang.IllegalArgumentException
- SWTException
- void resizeToPreferredWidth(int index)
void resizeToMaximumWidth(int index)
void releaseChildren(boolean destroy)
releaseChildren
in class Composite
void removeControl(Control control)
removeControl
in class Composite
void reskinChildren(int flags)
reskinChildren
in class Composite
void setBackgroundPixel(int pixel)
setBackgroundPixel
in class Control
void setForegroundPixel(int pixel)
setForegroundPixel
in class Control
void setItemColors(int foreColor, int backColor)
public void setItemLayout(int[] itemOrder, int[] wrapIndices, Point[] sizes)
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.
itemOrder
- an array of indices that describe the new order to display the items inwrapIndices
- an array of wrap indices, or nullsizes
- an array containing the new sizes for each of the receiver's items in visual orderSWTException
- java.lang.IllegalArgumentException
- void setItemOrder(int[] itemOrder)
void setItemSizes(Point[] sizes)
public void setLocked(boolean locked)
locked
- lock the coolbar if true, otherwise unlock the coolbarSWTException
- public void setWrapIndices(int[] indices)
indices
- an array of wrap indices, or nullSWTException
- int widgetStyle()
widgetStyle
in class Composite
TCHAR windowClass()
windowClass
in class Scrollable
int windowProc()
windowProc
in class Scrollable
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_SETREDRAW(int wParam, int lParam)
WM_SETREDRAW
in class Control
LRESULT wmNotifyChild(NMHDR hdr, int wParam, int lParam)
wmNotifyChild
in class Control