ToolItem

Instances of this class represent a selectable user interface object that represents a button in a tool bar. <dl> <dt><b>Styles:</b></dt> <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd> <dt><b>Events:</b></dt> <dd>Selection</dd> </dl> <p> Note: Only one of the styles CHECK, PUSH, RADIO, SEPARATOR and DROP_DOWN may be specified. </p><p> IMPORTANT: This class is <em>not</em> intended to be subclassed. </p>

@see <a href="http://www.eclipse.org/swt/snippets/#toolbar">ToolBar, ToolItem snippets</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

class ToolItem : Item {}

Constructors

this
this(ToolBar parent, int style)

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

Constructs a new instance of this class given its parent (which must be a <code>ToolBar</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

Aliases

setForegroundColor
alias setForegroundColor = Item.setForegroundColor
Undocumented in source.
setForegroundColor
alias setForegroundColor = Item.setForegroundColor
Undocumented in source.

Functions

addSelectionListener
void addSelectionListener(SelectionListener listener)

Adds the listener to the collection of listeners who 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> When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool, the event object detail field contains the value <code>SWT.ARROW</code>. <code>widgetDefaultSelected</code> is not called. </p>

checkSubclass
void checkSubclass()
Undocumented in source. Be warned that the author may not have intended to support it.
createHandle
void createHandle(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
createWidget
void createWidget(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
deregister
void deregister()
Undocumented in source. Be warned that the author may not have intended to support it.
dispose
void dispose()
Undocumented in source. Be warned that the author may not have intended to support it.
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 used to fill the bounds of the item when the item is a <code>SEPARATOR</code>.

getDisabledImage
Image getDisabledImage()

Returns the receiver's disabled image if it has one, or null if it does not. <p> The disabled image is displayed when the receiver is disabled. </p>

getEnabled
bool getEnabled()

Returns <code>true</code> if the receiver is enabled, and <code>false</code> otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

getHotImage
Image getHotImage()

Returns the receiver's hot image if it has one, or null if it does not. <p> The hot image is displayed when the mouse enters the receiver. </p>

getParent
ToolBar getParent()

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

getSelection
bool getSelection()

Returns <code>true</code> if the receiver is selected, and false otherwise. <p> When the receiver is of type <code>CHECK</code> or <code>RADIO</code>, 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. </p>

getToolTipText
String getToolTipText()

Returns the receiver's tool tip text, or null if it has not been set.

getWidth
int getWidth()

Gets the width of the receiver.

gtk_button_press_event
int gtk_button_press_event(GtkWidget* widget, GdkEventButton* gdkEvent)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_button_release_event
int gtk_button_release_event(GtkWidget* widget, GdkEventButton* gdkEvent)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_clicked
int gtk_clicked(GtkWidget* widget)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_enter_notify_event
int gtk_enter_notify_event(GtkWidget* widget, GdkEventCrossing* event)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_event_after
int gtk_event_after(GtkWidget* widget, GdkEvent* gdkEvent)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_focus_out_event
int gtk_focus_out_event(GtkWidget* widget, GdkEventFocus* event)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_leave_notify_event
int gtk_leave_notify_event(GtkWidget* widget, GdkEventCrossing* event)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_map
int gtk_map(GtkWidget* widget)
Undocumented in source. Be warned that the author may not have intended to support it.
gtk_mnemonic_activate
int gtk_mnemonic_activate(GtkWidget* widget, ptrdiff_t arg1)
Undocumented in source. Be warned that the author may not have intended to support it.
hasFocus
bool hasFocus()
Undocumented in source. Be warned that the author may not have intended to support it.
hookEvents
void hookEvents()
Undocumented in source. Be warned that the author may not have intended to support it.
isEnabled
bool isEnabled()

Returns <code>true</code> if the receiver is enabled and all of the receiver's ancestors are enabled, and <code>false</code> otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

register
void register()
Undocumented in source. Be warned that the author may not have intended to support it.
releaseHandle
void releaseHandle()
Undocumented in source. Be warned that the author may not have intended to support it.
releaseWidget
void releaseWidget()
Undocumented in source. Be warned that the author may not have intended to support it.
removeSelectionListener
void removeSelectionListener(SelectionListener listener)

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

resizeControl
void resizeControl()
Undocumented in source. Be warned that the author may not have intended to support it.
selectRadio
void selectRadio()
Undocumented in source. Be warned that the author may not have intended to support it.
setControl
void setControl(Control control)

Sets the control that is used to fill the bounds of the item when the item is a <code>SEPARATOR</code>.

setDisabledImage
void setDisabledImage(Image image)

Sets the receiver's disabled image to the argument, which may be null indicating that no disabled image should be displayed. <p> The disabled image is displayed when the receiver is disabled. </p>

setEnabled
void setEnabled(bool enabled)

Enables the receiver if the argument is <code>true</code>, and disables it otherwise. <p> A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look. </p>

setFocus
bool setFocus()
Undocumented in source. Be warned that the author may not have intended to support it.
setFontDescription
void setFontDescription(PangoFontDescription* font)
Undocumented in source. Be warned that the author may not have intended to support it.
setForegroundColor
void setForegroundColor(GdkColor* color)
Undocumented in source. Be warned that the author may not have intended to support it.
setHotImage
void setHotImage(Image image)

Sets the receiver's hot image to the argument, which may be null indicating that no hot image should be displayed. <p> The hot image is displayed when the mouse enters the receiver. </p>

setImage
void setImage(Image image)
Undocumented in source. Be warned that the author may not have intended to support it.
setOrientation
void setOrientation()
Undocumented in source. Be warned that the author may not have intended to support it.
setRadioSelection
bool setRadioSelection(bool value)
Undocumented in source. Be warned that the author may not have intended to support it.
setSelection
void setSelection(bool selected)

Sets the selection state of the receiver. <p> When the receiver is of type <code>CHECK</code> or <code>RADIO</code>, it is selected when it is checked (which some platforms draw as a pushed in button). </p>

setText
void setText(String string)

Sets the receiver's text. The string may include the mnemonic character. </p> <p> Mnemonics are indicated by an '&amp;' 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 '&amp;' can be escaped by doubling it in the string, causing a single '&amp;' to be displayed. </p>

setToolTipText
void setToolTipText(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.

setToolTipText
void setToolTipText(Shell shell, String newString)
Undocumented in source. Be warned that the author may not have intended to support it.
setWidth
void setWidth(int width)

Sets the width of the receiver, for <code>SEPARATOR</code> ToolItems.

showWidget
void showWidget(int index)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

checkStyle
int checkStyle(int style)
arrowBoxHandle
GtkWidget* arrowBoxHandle;
arrowHandle
GtkWidget* arrowHandle;
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

boxHandle
GtkWidget* boxHandle;
Undocumented in source.
control
Control control;
disabledImage
Image disabledImage;
Undocumented in source.
drawHotImage
bool drawHotImage;
Undocumented in source.
hotImage
Image hotImage;
imageHandle
GtkWidget* imageHandle;
labelHandle
GtkWidget* labelHandle;
Undocumented in source.
parent
ToolBar parent;
separatorHandle
GtkWidget* separatorHandle;
Undocumented in source.
toolTipText
String toolTipText;
Undocumented in source.

Inherited Members

From Item

text
String text;
Undocumented in source.
image
Image image;
Undocumented in source.
checkSubclass
void checkSubclass()
Undocumented in source. Be warned that the author may not have intended to support it.
getImage
Image getImage()

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

getNameText
String getNameText()
Undocumented in source. Be warned that the author may not have intended to support it.
getText
String getText()

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

releaseWidget
void releaseWidget()
Undocumented in source. Be warned that the author may not have intended to support it.
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