Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.widgets
Class CoolItem  view CoolItem download CoolItem.java

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Item
          extended byorg.eclipse.swt.widgets.CoolItem

public class CoolItem
extends Item

Instances of this class are selectable user interface objects that represent the dynamically positionable areas of a CoolBar.

Styles:
DROP_DOWN
Events:
Selection

IMPORTANT: This class is not intended to be subclassed.


Field Summary
(package private)  org.eclipse.swt.graphics.Image arrowImage
           
(package private)  ToolBar chevron
           
private  int CHEVRON_HORIZONTAL_TRIM
           
private static int CHEVRON_IMAGE_WIDTH
           
private static int CHEVRON_LEFT_MARGIN
           
private  int CHEVRON_VERTICAL_TRIM
           
(package private)  Control control
           
(package private) static int GRABBER_WIDTH
           
(package private)  boolean ideal
           
(package private)  org.eclipse.swt.graphics.Rectangle itemBounds
           
(package private) static int MARGIN_WIDTH
           
(package private) static int MINIMUM_WIDTH
           
(package private)  int minimumHeight
           
(package private)  int minimumWidth
           
(package private)  CoolBar parent
           
(package private)  int preferredHeight
           
(package private)  int preferredWidth
           
(package private)  int requestedWidth
           
(package private)  boolean wrap
           
 
Fields inherited from class org.eclipse.swt.widgets.Item
image, text
 
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
CoolItem(CoolBar parent, int style)
          Constructs a new instance of this class given its parent (which must be a CoolBar) and a style value describing its behavior and appearance.
CoolItem(CoolBar parent, int style, int index)
          Constructs a new instance of this class given its parent (which must be a CoolBar), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.
 
Method Summary
 void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
          Adds the listener to the collection of listeners that will be notified when the control is selected, by sending it one of the messages defined in the SelectionListener interface.
(package private)  void calculateChevronTrim()
           
protected  void checkSubclass()
          Checks that this class can be subclassed.
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint)
          Returns the preferred size of the receiver.
(package private)  org.eclipse.swt.graphics.Image createArrowImage(int width, int height)
           
 void dispose()
          Disposes of the operating system resources associated with the receiver and all its descendents.
 org.eclipse.swt.graphics.Rectangle getBounds()
          Returns a rectangle describing the receiver's size and location relative to its parent.
 Control getControl()
          Returns the control that is associated with the receiver.
 org.eclipse.swt.graphics.Point getMinimumSize()
          Returns the minimum size that the cool item can be resized to using the cool item's gripper.
 CoolBar getParent()
          Returns the receiver's parent, which must be a CoolBar.
 org.eclipse.swt.graphics.Point getPreferredSize()
          Returns a point describing the receiver's ideal size.
 org.eclipse.swt.graphics.Point getSize()
          Returns a point describing the receiver's size.
(package private)  int internalGetMinimumWidth()
           
(package private)  void onSelection(Event ev)
           
 void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
          Removes the listener from the collection of listeners that will be notified when the control is selected.
(package private)  void setBounds(int x, int y, int width, int height)
           
 void setControl(Control control)
          Sets the control that is associated with the receiver to the argument.
 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.
 void setMinimumSize(org.eclipse.swt.graphics.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.
 void setPreferredSize(int width, int height)
          Sets the receiver's ideal size to the point specified by the arguments.
 void setPreferredSize(org.eclipse.swt.graphics.Point size)
          Sets the receiver's ideal size to the point specified by the argument.
 void setSize(int width, int height)
          Sets the receiver's size to the point specified by the arguments.
 void setSize(org.eclipse.swt.graphics.Point size)
          Sets the receiver's size to the point specified by the argument.
(package private)  void updateChevron()
           
 
Methods inherited from class org.eclipse.swt.widgets.Item
getImage, getNameText, getText, releaseWidget, setImage, setText
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkOrientation, checkParent, checkWidget, createHandle, createWidget, deregister, destroyWidget, error, filterProc, filters, fixMnemonic, fontHeight, getData, getData, getDisplay, getName, getStyle, gtk_activate, gtk_button_press_event, gtk_button_release_event, gtk_changed, gtk_clicked, gtk_commit, gtk_configure_event, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_enter_notify_event, gtk_event_after, gtk_event, gtk_expose_event, gtk_focus_in_event, gtk_focus_out_event, gtk_focus, gtk_hide, gtk_insert_text, gtk_key_press_event, gtk_key_release_event, gtk_leave_notify_event, gtk_map_event, gtk_mnemonic_activate, gtk_motion_notify_event, gtk_popup_menu, gtk_preedit_changed, gtk_realize, gtk_row_activated, gtk_scroll_child, gtk_select, gtk_show_help, gtk_show, gtk_size_allocate, gtk_style_set, gtk_switch_page, gtk_test_collapse_row, gtk_test_expand_row, gtk_timer, gtk_toggled, gtk_unmap_event, gtk_unrealize, gtk_value_changed, gtk_visibility_notify_event, gtk_window_state_event, hookEvents, hooks, hoverProc, isDisposed, isListening, isValidSubclass, isValidThread, isValidWidget, menuPositionProc, mnemonicHit, mnemonicMatch, notifyListeners, pixbufCellDataProc, postEvent, postEvent, register, releaseChild, releaseHandle, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, setOrientation, shellMapProc, textCellDataProc, timerProc, topHandle, toString, translateTraversal, treeSelectionProc, windowProc, windowProc, windowProc, windowProc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

control

Control control

parent

CoolBar parent

ideal

boolean ideal

preferredWidth

int preferredWidth

preferredHeight

int preferredHeight

minimumWidth

int minimumWidth

minimumHeight

int minimumHeight

requestedWidth

int requestedWidth

itemBounds

org.eclipse.swt.graphics.Rectangle itemBounds

MARGIN_WIDTH

static final int MARGIN_WIDTH
See Also:
Constant Field Values

GRABBER_WIDTH

static final int GRABBER_WIDTH
See Also:
Constant Field Values

MINIMUM_WIDTH

static final int MINIMUM_WIDTH
See Also:
Constant Field Values

CHEVRON_HORIZONTAL_TRIM

private int CHEVRON_HORIZONTAL_TRIM

CHEVRON_VERTICAL_TRIM

private int CHEVRON_VERTICAL_TRIM

CHEVRON_LEFT_MARGIN

private static final int CHEVRON_LEFT_MARGIN
See Also:
Constant Field Values

CHEVRON_IMAGE_WIDTH

private static final int CHEVRON_IMAGE_WIDTH
See Also:
Constant Field Values

chevron

ToolBar chevron

wrap

boolean wrap

arrowImage

org.eclipse.swt.graphics.Image arrowImage
Constructor Detail

CoolItem

public CoolItem(CoolBar parent,
                int style)
Constructs a new instance of this class given its parent (which must be a CoolBar) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.

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.


CoolItem

public CoolItem(CoolBar parent,
                int style,
                int index)
Constructs a new instance of this class given its parent (which must be a CoolBar), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.

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.

Method Detail

addSelectionListener

public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners that will be notified when the control is selected, by sending it one of the messages defined in the SelectionListener interface.

If widgetSelected 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 SWT.ARROW, 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. widgetDefaultSelected is not called.

Since:
2.0

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 Item

calculateChevronTrim

void calculateChevronTrim()

computeSize

public org.eclipse.swt.graphics.Point computeSize(int wHint,
                                                  int hHint)
Returns the preferred size of the receiver.

The preferred size of a CoolItem 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 SWT.DEFAULT is passed for the hint.


dispose

public void dispose()
Description copied from class: Widget
Disposes of the operating system resources associated with the receiver and all its descendents. After this method has been invoked, the receiver and all descendents will answer true when sent the message isDisposed(). Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection.

NOTE: This method is not called recursively on the descendents of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the Dispose event.

Overrides:
dispose in class Widget

createArrowImage

org.eclipse.swt.graphics.Image createArrowImage(int width,
                                                int height)

getBounds

public org.eclipse.swt.graphics.Rectangle getBounds()
Returns a rectangle describing the receiver's size and location relative to its parent.


getControl

public Control getControl()
Returns the control that is associated with the receiver.


getMinimumSize

public org.eclipse.swt.graphics.Point getMinimumSize()
Returns the minimum size that the cool item can be resized to using the cool item's gripper.

Since:
2.0

getParent

public CoolBar getParent()
Returns the receiver's parent, which must be a CoolBar.


getPreferredSize

public org.eclipse.swt.graphics.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

public org.eclipse.swt.graphics.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.


internalGetMinimumWidth

int internalGetMinimumWidth()

onSelection

void onSelection(Event ev)

removeSelectionListener

public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners that will be notified when the control is selected.

Since:
2.0

setBounds

void setBounds(int x,
               int y,
               int width,
               int height)

setControl

public void setControl(Control control)
Sets the control that is associated with the receiver to the argument.


setMinimumSize

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

Since:
2.0

setMinimumSize

public void setMinimumSize(org.eclipse.swt.graphics.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.

Since:
2.0

setPreferredSize

public void setPreferredSize(int width,
                             int height)
Sets the receiver's ideal size to the point specified by the arguments.


setPreferredSize

public void setPreferredSize(org.eclipse.swt.graphics.Point size)
Sets the receiver's ideal size to the point specified by the argument.


setSize

public void setSize(int width,
                    int height)
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.


setSize

public void setSize(org.eclipse.swt.graphics.Point size)
Sets the receiver's size to the point specified by the argument.

Note: Attempting to set the width or height of the receiver to a negative number will cause them to be set to zero instead.


updateChevron

void updateChevron()