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

Quick Search    Search Deep

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

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

public class ToolItem
extends Item

Instances of this class represent a selectable user interface object that represents a button in a tool bar.

Styles:
PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN
Events:
Selection

Note: Only one of the styles CHECK, PUSH, RADIO, SEPARATOR and DROP_DOWN may be specified.

IMPORTANT: This class is not intended to be subclassed.


Field Summary
(package private)  long arrowHandle
           
(package private)  long boxHandle
           
(package private)  Control control
           
(package private)  org.eclipse.swt.graphics.Image disabledImage
           
(package private)  boolean drawHotImage
           
(package private)  org.eclipse.swt.graphics.Image hotImage
           
(package private)  long imageHandle
           
(package private)  long labelHandle
           
(package private)  ToolBar parent
           
(package private)  long separatorHandle
           
(package private)  java.lang.String toolTipText
           
 
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
ToolItem(ToolBar parent, int style)
          Constructs a new instance of this class given its parent (which must be a ToolBar) and a style value describing its behavior and appearance.
ToolItem(ToolBar parent, int style, int index)
          Constructs a new instance of this class given its parent (which must be a ToolBar), 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 who will be notified when the control is selected, by sending it one of the messages defined in the SelectionListener interface.
(package private) static int checkStyle(int style)
           
(package private)  void createHandle(int index)
           
(package private)  void deregister()
           
 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 used to fill the bounds of the item when the items is a SEPARATOR.
 org.eclipse.swt.graphics.Image getDisabledImage()
          Returns the receiver's disabled image if it has one, or null if it does not.
 boolean getEnabled()
          Returns true if the receiver is enabled, and false otherwise.
 org.eclipse.swt.graphics.Image getHotImage()
          Returns the receiver's hot image if it has one, or null if it does not.
 ToolBar getParent()
          Returns the receiver's parent, which must be a ToolBar.
 boolean getSelection()
          Returns true if the receiver is selected, and false otherwise.
 java.lang.String getToolTipText()
          Returns the receiver's tool tip text, or null if it has not been set.
 int getWidth()
          Gets the width of the receiver.
(package private)  long gtk_button_press_event(long widget, long event)
           
(package private)  long gtk_button_release_event(long widget, long event)
           
(package private)  long gtk_clicked(long widget)
           
(package private)  long gtk_enter_notify_event(long widget, long event)
           
(package private)  long gtk_event_after(long widget, long gdkEvent)
           
(package private)  long gtk_focus_out_event(long widget, long event)
           
(package private)  long gtk_leave_notify_event(long widget, long event)
           
(package private)  long gtk_mnemonic_activate(long widget, long arg1)
           
(package private)  boolean hasFocus()
           
(package private)  void hookEvents()
           
 boolean isEnabled()
          Returns true if the receiver is enabled and all of the receiver's ancestors are enabled, and false otherwise.
(package private)  void register()
           
(package private)  void releaseHandle()
           
(package private)  void releaseWidget()
           
 void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
          Removes the listener from the collection of listeners who will be notified when the control is selected.
(package private)  void selectRadio()
           
 void setControl(Control control)
          Sets the control that is used to fill the bounds of the item when the items is a SEPARATOR.
 void setDisabledImage(org.eclipse.swt.graphics.Image image)
          Sets the receiver's disabled image to the argument, which may be null indicating that no disabled image should be displayed.
 void setEnabled(boolean enabled)
          Enables the receiver if the argument is true, and disables it otherwise.
(package private)  boolean setFocus()
           
(package private)  void setFontDescription(long font)
           
(package private)  void setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
           
 void setHotImage(org.eclipse.swt.graphics.Image image)
          Sets the receiver's hot image to the argument, which may be null indicating that no hot image should be displayed.
 void setImage(org.eclipse.swt.graphics.Image image)
          Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.
(package private)  boolean setRadioSelection(boolean value)
           
 void setSelection(boolean selected)
          Sets the selection state of the receiver.
 void setText(java.lang.String string)
          Sets the receiver's text.
 void setToolTipText(java.lang.String string)
          Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
 void setWidth(int width)
          Sets the width of the receiver.
 
Methods inherited from class org.eclipse.swt.widgets.Item
checkSubclass, getImage, getNameText, getText
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkOrientation, checkParent, checkWidget, createWidget, destroyWidget, dispose, error, filterProc, filters, fixMnemonic, fontHeight, getData, getData, getDisplay, getName, getStyle, gtk_activate, gtk_changed, gtk_commit, gtk_configure_event, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_event, gtk_expose_event, gtk_focus_in_event, gtk_focus, gtk_hide, gtk_insert_text, gtk_key_press_event, gtk_key_release_event, gtk_map_event, 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, hooks, hoverProc, isDisposed, isListening, isValidSubclass, isValidThread, isValidWidget, menuPositionProc, mnemonicHit, mnemonicMatch, notifyListeners, pixbufCellDataProc, postEvent, postEvent, releaseChild, 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

boxHandle

long boxHandle

arrowHandle

long arrowHandle

separatorHandle

long separatorHandle

labelHandle

long labelHandle

imageHandle

long imageHandle

parent

ToolBar parent

control

Control control

hotImage

org.eclipse.swt.graphics.Image hotImage

disabledImage

org.eclipse.swt.graphics.Image disabledImage

toolTipText

java.lang.String toolTipText

drawHotImage

boolean drawHotImage
Constructor Detail

ToolItem

public ToolItem(ToolBar parent,
                int style)
Constructs a new instance of this class given its parent (which must be a ToolBar) 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.


ToolItem

public ToolItem(ToolBar parent,
                int style,
                int index)
Constructs a new instance of this class given its parent (which must be a ToolBar), 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 who will be notified when the control is selected, by sending it one of the messages defined in the SelectionListener interface.

When widgetSelected is called when the mouse is over the arrow portion of a drop-down tool, the event object detail field contains the value SWT.ARROW. widgetDefaultSelected is not called.


createHandle

void createHandle(int index)
Overrides:
createHandle in class Widget

deregister

void deregister()
Overrides:
deregister in class Widget

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 used to fill the bounds of the item when the items is a SEPARATOR.


getDisabledImage

public org.eclipse.swt.graphics.Image getDisabledImage()
Returns the receiver's disabled image if it has one, or null if it does not.

The disabled image is displayed when the receiver is disabled.


getEnabled

public boolean getEnabled()
Returns true if the receiver is enabled, and false otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.


getHotImage

public org.eclipse.swt.graphics.Image getHotImage()
Returns the receiver's hot image if it has one, or null if it does not.

The hot image is displayed when the mouse enters the receiver.


getParent

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


getSelection

public boolean getSelection()
Returns true if the receiver is selected, and false otherwise.

When the receiver is of type CHECK or RADIO, it is selected when it is checked (which some platforms draw as a pushed in button). If the receiver is of any other type, this method returns false.


getToolTipText

public java.lang.String getToolTipText()
Returns the receiver's tool tip text, or null if it has not been set.


getWidth

public int getWidth()
Gets the width of the receiver.


gtk_button_press_event

long gtk_button_press_event(long widget,
                            long event)
Overrides:
gtk_button_press_event in class Widget

gtk_button_release_event

long gtk_button_release_event(long widget,
                              long event)
Overrides:
gtk_button_release_event in class Widget

gtk_clicked

long gtk_clicked(long widget)
Overrides:
gtk_clicked in class Widget

gtk_enter_notify_event

long gtk_enter_notify_event(long widget,
                            long event)
Overrides:
gtk_enter_notify_event in class Widget

gtk_event_after

long gtk_event_after(long widget,
                     long gdkEvent)
Overrides:
gtk_event_after in class Widget

gtk_focus_out_event

long gtk_focus_out_event(long widget,
                         long event)
Overrides:
gtk_focus_out_event in class Widget

gtk_leave_notify_event

long gtk_leave_notify_event(long widget,
                            long event)
Overrides:
gtk_leave_notify_event in class Widget

gtk_mnemonic_activate

long gtk_mnemonic_activate(long widget,
                           long arg1)
Overrides:
gtk_mnemonic_activate in class Widget

hasFocus

boolean hasFocus()

hookEvents

void hookEvents()
Overrides:
hookEvents in class Widget

isEnabled

public boolean isEnabled()
Returns true if the receiver is enabled and all of the receiver's ancestors are enabled, and false otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.


register

void register()
Overrides:
register in class Widget

releaseHandle

void releaseHandle()
Overrides:
releaseHandle in class Widget

releaseWidget

void releaseWidget()
Overrides:
releaseWidget in class Item

removeSelectionListener

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


selectRadio

void selectRadio()

setControl

public void setControl(Control control)
Sets the control that is used to fill the bounds of the item when the items is a SEPARATOR.


setDisabledImage

public void setDisabledImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's disabled image to the argument, which may be null indicating that no disabled image should be displayed.

The disbled image is displayed when the receiver is disabled.


setEnabled

public void setEnabled(boolean enabled)
Enables the receiver if the argument is true, and disables it otherwise.

A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.


setFocus

boolean setFocus()

setFontDescription

void setFontDescription(long font)

setForegroundColor

void setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)

setHotImage

public void setHotImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's hot image to the argument, which may be null indicating that no hot image should be displayed.

The hot image is displayed when the mouse enters the receiver.


setImage

public void setImage(org.eclipse.swt.graphics.Image image)
Description copied from class: Item
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.

Overrides:
setImage in class Item

setRadioSelection

boolean setRadioSelection(boolean value)

setSelection

public void setSelection(boolean selected)
Sets the selection state of the receiver.

When the receiver is of type CHECK or RADIO, it is selected when it is checked (which some platforms draw as a pushed in button).


setText

public void setText(java.lang.String string)
Sets the receiver's text. The string may include the mnemonic character.

Mnemonics are indicated by an '&' that causes the next character to be the mnemonic. When the user presses a key sequence that matches the mnemonic, a selection event occurs. On most platforms, the mnemonic appears underlined but may be emphasised in a platform specific manner. The mnemonic indicator character '&' can be escaped by doubling it in the string, causing a single '&' to be displayed.

Overrides:
setText in class Item

setToolTipText

public void setToolTipText(java.lang.String string)
Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.


setWidth

public void setWidth(int width)
Sets the width of the receiver.


checkStyle

static int checkStyle(int style)