CoolItem

Instances of this class are selectable user interface objects that represent the dynamically positionable areas of a <code>CoolBar</code>. <dl> <dt><b>Styles:</b></dt> <dd>DROP_DOWN</dd> <dt><b>Events:</b></dt> <dd>Selection</dd> </dl> <p> IMPORTANT: This class is <em>not</em> intended to be subclassed. </p>

@see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

Constructors

this
this(CoolBar parent, int style)

Constructs a new instance of this class given its parent (which must be a <code>CoolBar</code>) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent. <p> The style value is either one of the style constants defined in class <code>SWT</code> which is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses. </p>

this
this(CoolBar parent, int style, int index)

Constructs a new instance of this class given its parent (which must be a <code>CoolBar</code>), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent. <p> The style value is either one of the style constants defined in class <code>SWT</code> which is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses. </p>

Members

Functions

addSelectionListener
void addSelectionListener(SelectionListener listener)

Adds the listener to the collection of listeners that will be notified when the control is selected by the user, by sending it one of the messages defined in the <code>SelectionListener</code> interface. <p> If <code>widgetSelected</code> is called when the mouse is over the drop-down arrow (or 'chevron') portion of the cool item, the event object detail field contains the value <code>SWT.ARROW</code>, and the x and y fields in the event object represent the point at the bottom left of the chevron, where the menu should be popped up. <code>widgetDefaultSelected</code> is not called. </p>

computeSize
Point computeSize(int wHint, int hHint)

Returns the preferred size of the receiver. <p> The <em>preferred size</em> of a <code>CoolItem</code> is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask the instance questions such as "Given a particular width, how high does it need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint. </p>

getBounds
Rectangle getBounds()

Returns a rectangle describing the receiver's size and location relative to its parent.

getControl
Control getControl()

Returns the control that is associated with the receiver.

getMinimumSize
Point getMinimumSize()

Returns the minimum size that the cool item can be resized to using the cool item's gripper.

getParent
CoolBar getParent()

Returns the receiver's parent, which must be a <code>CoolBar</code>.

getPreferredSize
Point getPreferredSize()

Returns a point describing the receiver's ideal size. The x coordinate of the result is the ideal width of the receiver. The y coordinate of the result is the ideal height of the receiver.

getSize
Point getSize()

Returns a point describing the receiver's size. The x coordinate of the result is the width of the receiver. The y coordinate of the result is the height of the receiver.

removeSelectionListener
void removeSelectionListener(SelectionListener listener)

Removes the listener from the collection of listeners that will be notified when the control is selected by the user.

setControl
void setControl(Control control)

Sets the control that is associated with the receiver to the argument.

setMinimumSize
void setMinimumSize(int width, int height)

Sets the minimum size that the cool item can be resized to using the cool item's gripper, to the point specified by the arguments.

setMinimumSize
void setMinimumSize(Point size)

Sets the minimum size that the cool item can be resized to using the cool item's gripper, to the point specified by the argument.

setPreferredSize
void setPreferredSize(int width, int height)

Sets the receiver's ideal size to the point specified by the arguments.

setPreferredSize
void setPreferredSize(Point size)

Sets the receiver's ideal size to the point specified by the argument.

setSize
void setSize(int width, int height)

Sets the receiver's size to the point specified by the arguments. <p> 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. </p>

setSize
void setSize(Point size)

Sets the receiver's size to the point specified by the argument. <p> Note: Attempting to set the width or height of the receiver to a negative number will cause them to be set to zero instead. </p>

Inherited Members

From Item

getImage
Image getImage()

Returns the receiver's image if it has one, or null if it does not.

getText
String getText()

Returns the receiver's text, which will be an empty string if it has never been set.

setImage
void setImage(Image image)

Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.

setText
void setText(String string)

Sets the receiver's text.

Meta