Note
Only one of the styles CHECK, CASCADE, PUSH, RADIO and SEPARATOR may be specified.
Important Note
This class is not intended to be subclassed.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv long | actionHandle
GTK4 only fields |
| pack-priv String | |
| pack-priv long | boxHandle
Feature in Gtk: as of Gtk version 3.10 GtkImageMenuItem is deprecated, meaning that MenuItems in SWT with images can no longer be GtkImageMenuItems after Gtk3.10. |
| pack-priv Image | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv Menu | |
| pack-priv long | modelHandle
GTK4 only fields |
| pack-priv Menu | |
| pack-priv Menu. | |
| pack-priv long | shortcutHandle
GTK4 only fields |
| pack-priv String | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MenuItem(Menu
a menu control which will be the parent of the new instance (cannot be null) parent, int the style of control to construct style, int the zero-relative index to store the receiver in its parent index)Constructs a new instance of this class given its parent
(which must be a |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| pack-priv void | |
| pack-priv void | |
| public void | addArmListener(ArmListener
the listener which should be notified listener)Adds the listener to the collection of listeners who will
be notified when the arm events are generated for the control, by sending
it one of the messages defined in the |
| public void | addHelpListener(HelpListener
the listener which should be notified listener)Adds the listener to the collection of listeners who will
be notified when the help events are generated for the control, by sending
it one of the messages defined in the |
| public void | addSelectionListener(SelectionListener
the listener which should be notified when the menu item is selected by the user listener)Adds the listener to the collection of listeners who will
be notified when the menu item is selected by the user, by sending
it one of the messages defined in the |
| pack-priv void | |
| pack-priv static int | |
| protected void | checkSubclass()
Overrides org. |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv long | |
| pack-priv void | |
| public int | |
| pack-priv long | |
| public boolean | Returns: the receiver's enabled stateReturns |
| public int | |
| private MenuItem. | |
| public Menu | Returns: the receiver's menuReturns the receiver's cascade menu if it has one or null if it does not. |
| pack-priv String | |
| public Menu | |
| public boolean | Returns: the selection stateReturns |
| public String | Returns: the receiver's tool tip textReturns the receiver's tool tip text, or null if it has not been set. |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | |
| pack-priv void | |
| public boolean | Returns: the receiver's enabled stateReturns |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | removeArmListener(ArmListener
the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when the arm events are generated for the control. |
| public void | removeHelpListener(HelpListener
the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when the help events are generated for the control. |
| public void | removeSelectionListener(SelectionListener
the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when the control is selected by the user. |
| pack-priv void | |
| pack-priv void | |
| public void | setAccelerator(int
an integer that is the bit-wise OR of masks and a key accelerator)Sets the widget accelerator. |
| public void | setEnabled(boolean
the new enabled state enabled)Enables the receiver if the argument is |
| public void | setID(int
the new identifier. This must be a non-negative value. System-defined identifiers are negative values. id)Sets the identifier associated with the receiver to the argument. |
| public void | setImage(Image
the image to display on the receiver (may be null) image)Overrides org. |
| public void | |
| pack-priv void | |
| pack-priv boolean | |
| public void | |
| public void | setText(String
the new text string)Overrides org. |
| public void | setToolTipText(String
the new tool tip text (or null) toolTip)Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. |
| pack-priv void | |
| pack-priv boolean |
| accelerator | back to summary |
|---|---|
| pack-priv int accelerator | |
| actionHandle | back to summary |
|---|---|
| pack-priv long actionHandle GTK4 only fields | |
| actionName | back to summary |
|---|---|
| pack-priv String actionName | |
| boxHandle | back to summary |
|---|---|
| pack-priv long boxHandle Feature in Gtk: as of Gtk version 3.10 GtkImageMenuItem is deprecated, meaning that MenuItems in SWT with images can no longer be GtkImageMenuItems after Gtk3.10. The solution to this is to create a GtkMenuItem, add a GtkBox as its child, and pack that box with a GtkLabel and GtkImage. This reproduces the functionality of a GtkImageMenuItem and allows SWT to retain image support for MenuItems. For more information see: https://developer.gnome.org/gtk3/stable/GtkImageMenuItem.html#GtkImageMenuItem.description Bug 470298 | |
| defaultDisableImage | back to summary |
|---|---|
| pack-priv Image defaultDisableImage | |
| enabled | back to summary |
|---|---|
| pack-priv boolean enabled | |
| groupHandle | back to summary |
|---|---|
| pack-priv long groupHandle | |
| imageHandle | back to summary |
|---|---|
| pack-priv long imageHandle | |
| labelHandle | back to summary |
|---|---|
| pack-priv long labelHandle | |
| menu | back to summary |
|---|---|
| pack-priv Menu menu | |
| modelHandle | back to summary |
|---|---|
| pack-priv long modelHandle GTK4 only fields | |
| parent | back to summary |
|---|---|
| pack-priv Menu parent | |
| section | back to summary |
|---|---|
| pack-priv Menu. | |
| shortcutHandle | back to summary |
|---|---|
| pack-priv long shortcutHandle GTK4 only fields | |
| toolTipText | back to summary |
|---|---|
| pack-priv String toolTipText | |
| userId | back to summary |
|---|---|
| pack-priv int userId | |
| MenuItem | back to summary |
|---|---|
| public MenuItem(Menu parent, int style) Constructs a new instance of this class given its parent
(which must be a
The style value is either one of the style constants defined in
class
| |
| MenuItem | back to summary |
|---|---|
| public MenuItem(Menu parent, int style, int index) Constructs a new instance of this class given its parent
(which must be a
The style value is either one of the style constants defined in
class
| |
| _setEnabledOrDisabledImage | back to summary |
|---|---|
| private void _setEnabledOrDisabledImage() | |
| _setImage | back to summary |
|---|---|
| private void _setImage(Image image) | |
| addAccelerator | back to summary |
|---|---|
| pack-priv void addAccelerator(long accelGroup) | |
| addAccelerators | back to summary |
|---|---|
| pack-priv void addAccelerators(long accelGroup) | |
| addArmListener | back to summary |
|---|---|
| public void addArmListener(ArmListener listener) Adds the listener to the collection of listeners who will
be notified when the arm events are generated for the control, by sending
it one of the messages defined in the
| |
| addHelpListener | back to summary |
|---|---|
| public void addHelpListener(HelpListener listener) Adds the listener to the collection of listeners who will
be notified when the help events are generated for the control, by sending
it one of the messages defined in the
| |
| addSelectionListener | back to summary |
|---|---|
| public void addSelectionListener(SelectionListener listener) Adds the listener to the collection of listeners who will
be notified when the menu item is selected by the user, by sending
it one of the messages defined in the
When
When the
| |
| addShortcut | back to summary |
|---|---|
| pack-priv void addShortcut(int accelerator) | |
| checkStyle | back to summary |
|---|---|
| pack-priv static int checkStyle(int style) | |
| checkSubclass | back to summary |
|---|---|
| protected void checkSubclass() Overrides org. Doc from org. Checks that this class can be subclassed.
The SWT class library is intended to be subclassed
only at specific, controlled points (most notably,
Important Note 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.
| |
| createHandle | back to summary |
|---|---|
| pack-priv void createHandle(int index) Overrides org.
| |
| destroyWidget | back to summary |
|---|---|
| pack-priv void destroyWidget() Overrides org.
| |
| disposeDefaultDisabledImage | back to summary |
|---|---|
| private void disposeDefaultDisabledImage() | |
| dpiChanged | back to summary |
|---|---|
| pack-priv long dpiChanged(long object, long arg0) Overrides org.
| |
| fixMenus | back to summary |
|---|---|
| pack-priv void fixMenus(Decorations newParent) | |
| getAccelerator | back to summary |
|---|---|
| public int getAccelerator() Returns the widget accelerator. An accelerator is the bit-wise
OR of zero or more modifier masks and a key. Examples:
| |
| getAccelGroup | back to summary |
|---|---|
| pack-priv long getAccelGroup() | |
| getEnabled | back to summary |
|---|---|
| public boolean getEnabled() Returns
| |
| getID | back to summary |
|---|---|
| public int getID() Gets the identifier associated with the receiver.
| |
| getMaskKeysym | back to summary |
|---|---|
| private MenuItem. | |
| getMenu | back to summary |
|---|---|
| public Menu getMenu() Returns the receiver's cascade menu if it has one or null
if it does not. Only
| |
| getNameText | back to summary |
|---|---|
| pack-priv String getNameText() Overrides org.
| |
| getParent | back to summary |
|---|---|
| public Menu getParent() Returns the receiver's parent, which must be a
| |
| getSelection | back to summary |
|---|---|
| public boolean getSelection() Returns
When the receiver is of type
| |
| getToolTipText | back to summary |
|---|---|
| public String getToolTipText() Returns the receiver's tool tip text, or null if it has not been set.
| |
| gtk3_show_help | back to summary |
|---|---|
| pack-priv long gtk3_show_help(long widget, long helpType) Overrides org.
| |
| gtk_activate | back to summary |
|---|---|
| pack-priv long gtk_activate(long widget) Overrides org.
| |
| gtk_select | back to summary |
|---|---|
| pack-priv long gtk_select(long item) Overrides org.
| |
| hookEvents | back to summary |
|---|---|
| pack-priv void hookEvents() Overrides org.
| |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled() Returns
| |
| releaseChildren | back to summary |
|---|---|
| pack-priv void releaseChildren(boolean destroy) Overrides org.
| |
| releaseParent | back to summary |
|---|---|
| pack-priv void releaseParent() Overrides org.
| |
| releaseWidget | back to summary |
|---|---|
| pack-priv void releaseWidget() Overrides org.
| |
| removeAccelerator | back to summary |
|---|---|
| pack-priv void removeAccelerator(long accelGroup) | |
| removeAccelerators | back to summary |
|---|---|
| pack-priv void removeAccelerators(long accelGroup) | |
| removeArmListener | back to summary |
|---|---|
| public void removeArmListener(ArmListener listener) Removes the listener from the collection of listeners who will be notified when the arm events are generated for the control.
| |
| removeHelpListener | back to summary |
|---|---|
| public void removeHelpListener(HelpListener listener) Removes the listener from the collection of listeners who will be notified when the help events are generated for the control.
| |
| removeSelectionListener | back to summary |
|---|---|
| public void removeSelectionListener(SelectionListener listener) Removes the listener from the collection of listeners who will be notified when the control is selected by the user.
| |
| reskinChildren | back to summary |
|---|---|
| pack-priv void reskinChildren(int flags) Overrides org.
| |
| selectRadio | back to summary |
|---|---|
| pack-priv void selectRadio() | |
| setAccelerator | back to summary |
|---|---|
| public void setAccelerator(int accelerator) Sets the widget accelerator. An accelerator is the bit-wise
OR of zero or more modifier masks and a key. Examples:
| |
| setEnabled | back to summary |
|---|---|
| public void setEnabled(boolean enabled) Enables the receiver if the argument is
| |
| setID | back to summary |
|---|---|
| public void setID(int id) Sets the identifier associated with the receiver to the argument.
| |
| setImage | back to summary |
|---|---|
| public void setImage(Image image) Overrides org. Sets the receiver's image to the argument, which may be null indicating that no image should be displayed. Note This operation is a HINT and is not supported on platforms that do not have this concept (for example, Windows NT). Some platforms (such as GTK3) support images alongside check boxes.
| |
| setMenu | back to summary |
|---|---|
| public void setMenu(Menu menu) Sets the receiver's pull down menu to the argument.
Only Note Disposing of a menu item that has a pull down menu will dispose of the menu. To avoid this behavior, set the menu to null before the menu item is disposed.
| |
| setOrientation | back to summary |
|---|---|
| pack-priv void setOrientation(boolean create) Overrides org.
| |
| setRadioSelection | back to summary |
|---|---|
| pack-priv boolean setRadioSelection(boolean value) | |
| setSelection | back to summary |
|---|---|
| public void setSelection(boolean selected) Sets the selection state of the receiver.
When the receiver is of type
| |
| setText | back to summary |
|---|---|
| public void setText(String string) Overrides org. Sets the receiver's text. The string may include the mnemonic character and accelerator text. 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. Accelerator text is indicated by the '\t' character. On platforms that support accelerator text, the text that follows the '\t' character is displayed to the user, typically indicating the key stroke that will cause the item to become selected. On most platforms, the accelerator text appears right aligned in the menu. Setting the accelerator text does not install the accelerator key sequence. The accelerator key sequence is installed using #setAccelerator.
| |
| setToolTipText | back to summary |
|---|---|
| public void setToolTipText(String toolTip) Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a menu item that has a default tool tip, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown. The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string. Note Tooltips are currently not shown for top-level menu items in the
Note This operation is a hint and behavior is platform specific, on Windows for CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltip.
| |
| updateAccelerator | back to summary |
|---|---|
| pack-priv void updateAccelerator(long accelGroup, boolean add) | |
| updateAcceleratorText | back to summary |
|---|---|
| pack-priv boolean updateAcceleratorText(boolean show) | |
| Access | Constructor and Description |
|---|---|
| private |
| MaskKeysym | back to summary |
|---|---|
| private MaskKeysym() | |