|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.widgets
Class MenuItem

java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Item
org.eclipse.swt.widgets.MenuItem
- public class MenuItem
- extends Item
Instances of this class represent a selectable user interface object that issues notification when pressed and released.
- Styles:
- CHECK, CASCADE, PUSH, RADIO, SEPARATOR
- Events:
- Arm, Help, Selection
Note: Only one of the styles CHECK, CASCADE, PUSH, RADIO and SEPARATOR may be specified.
IMPORTANT: This class is not intended to be subclassed.
| Field Summary | |
(package private) int |
accelerator
|
(package private) Menu |
menu
|
(package private) Menu |
parent
|
| 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 | |
MenuItem(Menu parent,
int style)
Constructs a new instance of this class given its parent (which must be a Menu) and a style value
describing its behavior and appearance. |
|
MenuItem(Menu parent,
int style,
int index)
Constructs a new instance of this class given its parent (which must be a Menu), 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 | |
(package private) void |
addAccelerator(long accelGroup)
|
(package private) void |
addAccelerators(long accelGroup)
|
void |
addArmListener(org.eclipse.swt.events.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 ArmListener
interface. |
void |
addHelpListener(org.eclipse.swt.events.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 HelpListener
interface. |
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 |
fixMenus(Decorations newParent)
|
int |
getAccelerator()
Return the widget accelerator. |
(package private) long |
getAccelGroup()
|
boolean |
getEnabled()
Returns true if the receiver is enabled, and
false otherwise. |
Menu |
getMenu()
Returns the receiver's cascade menu if it has one or null if it does not. |
Menu |
getParent()
Returns the receiver's parent, which must be a Menu. |
boolean |
getSelection()
Returns true if the receiver is selected,
and false otherwise. |
(package private) long |
gtk_activate(long widget)
|
(package private) long |
gtk_select(long item)
|
(package private) long |
gtk_show_help(long widget,
long helpType)
|
(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 |
releaseChild()
|
(package private) void |
releaseWidget()
|
(package private) void |
removeAccelerator(long accelGroup)
|
(package private) void |
removeAccelerators(long accelGroup)
|
void |
removeArmListener(org.eclipse.swt.events.ArmListener listener)
Removes the listener from the collection of listeners who will be notified when the arm events are generated for the control. |
void |
removeHelpListener(org.eclipse.swt.events.HelpListener listener)
Removes the listener from the collection of listeners who will be notified when the help events are generated for the control. |
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 |
setAccelerator(int accelerator)
Sets the widget accelerator. |
void |
setEnabled(boolean enabled)
Enables the receiver if the argument is true,
and disables it otherwise. |
void |
setImage(org.eclipse.swt.graphics.Image image)
Sets the image the receiver will display to the argument. |
void |
setMenu(Menu menu)
Sets the receiver's pull down menu to the argument. |
(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. |
(package private) void |
updateAccelerator(long accelGroup,
boolean add)
|
| Methods inherited from class org.eclipse.swt.widgets.Item |
checkSubclass, getImage, getNameText, getText |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
parent
Menu parent
menu
Menu menu
accelerator
int accelerator
| Constructor Detail |
MenuItem
public MenuItem(Menu parent, int style)
- Constructs a new instance of this class given its parent
(which must be a
Menu) 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
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
MenuItem
public MenuItem(Menu parent, int style, int index)
- Constructs a new instance of this class given its parent
(which must be a
Menu), 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
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
| Method Detail |
addAccelerator
void addAccelerator(long accelGroup)
addAccelerators
void addAccelerators(long accelGroup)
addArmListener
public void addArmListener(org.eclipse.swt.events.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
ArmListenerinterface.
addHelpListener
public void addHelpListener(org.eclipse.swt.events.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
HelpListenerinterface.
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
SelectionListenerinterface.When
widgetSelectedis called, the stateMask field of the event object is valid.widgetDefaultSelectedis not called.
checkStyle
static int checkStyle(int style)
createHandle
void createHandle(int index)
- Overrides:
createHandlein classWidget
fixMenus
void fixMenus(Decorations newParent)
getAccelerator
public int getAccelerator()
- Return the widget accelerator. An accelerator is the bit-wise
OR of zero or more modifier masks and a key. Examples:
SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2.
getAccelGroup
long getAccelGroup()
getEnabled
public boolean getEnabled()
- Returns
trueif the receiver is enabled, andfalseotherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
getMenu
public Menu getMenu()
- Returns the receiver's cascade menu if it has one or null
if it does not. Only
CASCADEmenu items can have a pull down menu. The sequence of key strokes, button presses and/or button releases that are used to request a pull down menu is platform specific.
getParent
public Menu getParent()
- Returns the receiver's parent, which must be a
Menu.
getSelection
public boolean getSelection()
- Returns
trueif the receiver is selected, and false otherwise.When the receiver is of type
CHECKorRADIO, it is selected when it is checked.
gtk_activate
long gtk_activate(long widget)
- Overrides:
gtk_activatein classWidget
gtk_select
long gtk_select(long item)
- Overrides:
gtk_selectin classWidget
gtk_show_help
long gtk_show_help(long widget,
long helpType)
- Overrides:
gtk_show_helpin classWidget
hookEvents
void hookEvents()
- Overrides:
hookEventsin classWidget
isEnabled
public boolean isEnabled()
- Returns
trueif the receiver is enabled and all of the receiver's ancestors are enabled, andfalseotherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
releaseChild
void releaseChild()
- Overrides:
releaseChildin classWidget
releaseWidget
void releaseWidget()
- Overrides:
releaseWidgetin classItem
removeAccelerator
void removeAccelerator(long accelGroup)
removeAccelerators
void removeAccelerators(long accelGroup)
removeArmListener
public void removeArmListener(org.eclipse.swt.events.ArmListener listener)
- Removes the listener from the collection of listeners who will
be notified when the arm events are generated for the control.
removeHelpListener
public void removeHelpListener(org.eclipse.swt.events.HelpListener listener)
- Removes the listener from the collection of listeners who will
be notified when the help events are generated for the control.
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()
setAccelerator
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:
SWT.MOD1 | SWT.MOD2 | 'T', SWT.MOD3 | SWT.F2.SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2.
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.
setImage
public void setImage(org.eclipse.swt.graphics.Image image)
- Sets the image the receiver will display to the argument.
Note: This feature is not available on all window systems (for example, Window NT), in which case, calling this method will silently do nothing.
setMenu
public void setMenu(Menu menu)
- Sets the receiver's pull down menu to the argument.
Only
CASCADEmenu items can have a pull down menu. The sequence of key strokes, button presses and/or button releases that are used to request a pull down menu is platform specific.
setRadioSelection
boolean setRadioSelection(boolean value)
setSelection
public void setSelection(boolean selected)
- Sets the selection state of the receiver.
When the receiver is of type
CHECKorRADIO, it is selected when it is checked.
setText
public void setText(java.lang.String string)
- 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.
updateAccelerator
void updateAccelerator(long accelGroup,
boolean add)
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC