|
|||||||||
| 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 Menu

java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Menu
- public class Menu
- extends Widget
Instances of this class are user interface objects that contain menu items.
- Styles:
- BAR, DROP_DOWN, POP_UP, NO_RADIO_GROUP
- LEFT_TO_RIGHT, RIGHT_TO_LEFT
- Events:
- Help, Hide, Show
Note: Only one of BAR, DROP_DOWN and POP_UP may be specified. Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.
IMPORTANT: This class is not intended to be subclassed.
| Field Summary | |
(package private) MenuItem |
cascade
|
(package private) boolean |
hasLocation
|
(package private) long |
imHandle
|
(package private) long |
imItem
|
(package private) long |
imSeparator
|
(package private) Decorations |
parent
|
(package private) MenuItem |
selectedItem
|
(package private) int |
x
|
(package private) int |
y
|
| 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 | |
Menu(Control parent)
Constructs a new instance of this class given its parent, and sets the style for the instance so that the instance will be a popup menu on the given parent's shell. |
|
Menu(Decorations parent,
int style)
Constructs a new instance of this class given its parent (which must be a Decorations) and a style value
describing its behavior and appearance. |
|
Menu(Menu parentMenu)
Constructs a new instance of this class given its parent (which must be a Menu) and sets the style
for the instance so that the instance will be a drop-down
menu on the given parent's parent. |
|
Menu(MenuItem parentItem)
Constructs a new instance of this class given its parent (which must be a MenuItem) and sets the style
for the instance so that the instance will be a drop-down
menu on the given parent's parent menu. |
|
| Method Summary | |
void |
_setVisible(boolean visible)
|
(package private) void |
addAccelerators(long accelGroup)
|
void |
addHelpListener(org.eclipse.swt.events.HelpListener listener)
Adds the listener to the collection of listeners who will be notified when help events are generated for the control, by sending it one of the messages defined in the HelpListener interface. |
void |
addMenuListener(org.eclipse.swt.events.MenuListener listener)
Adds the listener to the collection of listeners who will be notified when menus are hidden or shown, by sending it one of the messages defined in the MenuListener
interface. |
(package private) static Control |
checkNull(Control control)
|
(package private) static Menu |
checkNull(Menu menu)
|
(package private) static MenuItem |
checkNull(MenuItem item)
|
(package private) static int |
checkStyle(int style)
|
(package private) void |
createHandle(int index)
|
(package private) void |
createIMMenu(long imHandle)
|
(package private) void |
createWidget(int index)
|
(package private) void |
fixMenus(Decorations newParent)
|
MenuItem |
getDefaultItem()
Returns the default menu item or null if none has been previously set. |
boolean |
getEnabled()
Returns true if the receiver is enabled, and
false otherwise. |
MenuItem |
getItem(int index)
Returns the item at the given, zero-relative index in the receiver. |
int |
getItemCount()
Returns the number of items contained in the receiver. |
MenuItem[] |
getItems()
Returns an array of MenuItems which are the items
in the receiver. |
(package private) java.lang.String |
getNameText()
|
Decorations |
getParent()
Returns the receiver's parent, which must be a Decorations. |
MenuItem |
getParentItem()
Returns the receiver's parent item, which must be a MenuItem or null when the receiver is a
root. |
Menu |
getParentMenu()
Returns the receiver's parent item, which must be a Menu or null when the receiver is a
root. |
Shell |
getShell()
Returns the receiver's shell. |
(package private) org.eclipse.swt.graphics.Point |
getSize()
|
boolean |
getVisible()
Returns true if the receiver is visible, and
false otherwise. |
(package private) long |
gtk_hide(long widget)
|
(package private) long |
gtk_show_help(long widget,
long helpType)
|
(package private) long |
gtk_show(long widget)
|
(package private) void |
hookEvents()
|
int |
indexOf(MenuItem item)
Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item. |
boolean |
isEnabled()
Returns true if the receiver is enabled and all
of the receiver's ancestors are enabled, and false
otherwise. |
boolean |
isVisible()
Returns true if the receiver is visible and all
of the receiver's ancestors are visible and false
otherwise. |
(package private) long |
menuPositionProc(long menu,
long x,
long y,
long push_in,
long user_data)
|
(package private) void |
releaseChild()
|
(package private) void |
releaseWidget()
|
(package private) void |
removeAccelerators(long accelGroup)
|
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 |
removeMenuListener(org.eclipse.swt.events.MenuListener listener)
Removes the listener from the collection of listeners who will be notified when the menu events are generated for the control. |
(package private) boolean |
sendHelpEvent(long helpType)
|
void |
setDefaultItem(MenuItem item)
Sets the default menu item to the argument or removes the default emphasis when the argument is null. |
void |
setEnabled(boolean enabled)
Enables the receiver if the argument is true,
and disables it otherwise. |
void |
setLocation(int x,
int y)
Sets the receiver's location to the point specified by the arguments which are relative to the display. |
void |
setLocation(org.eclipse.swt.graphics.Point location)
Sets the receiver's location to the point specified by the arguments which are relative to the display. |
void |
setVisible(boolean visible)
Marks the receiver as visible if the argument is true,
and marks it invisible otherwise. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
x
int x
y
int y
hasLocation
boolean hasLocation
cascade
MenuItem cascade
selectedItem
MenuItem selectedItem
parent
Decorations parent
imItem
long imItem
imSeparator
long imSeparator
imHandle
long imHandle
| Constructor Detail |
Menu
public Menu(Control parent)
- Constructs a new instance of this class given its parent,
and sets the style for the instance so that the instance
will be a popup menu on the given parent's shell.
Menu
public Menu(Decorations parent, int style)
- Constructs a new instance of this class given its parent
(which must be a
Decorations) and a style value describing its behavior and appearance.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.
Menu
public Menu(Menu parentMenu)
- Constructs a new instance of this class given its parent
(which must be a
Menu) and sets the style for the instance so that the instance will be a drop-down menu on the given parent's parent.
Menu
public Menu(MenuItem parentItem)
- Constructs a new instance of this class given its parent
(which must be a
MenuItem) and sets the style for the instance so that the instance will be a drop-down menu on the given parent's parent menu.
| Method Detail |
checkNull
static Control checkNull(Control control)
checkNull
static Menu checkNull(Menu menu)
checkNull
static MenuItem checkNull(MenuItem item)
checkStyle
static int checkStyle(int style)
_setVisible
public void _setVisible(boolean visible)
addAccelerators
void addAccelerators(long accelGroup)
addMenuListener
public void addMenuListener(org.eclipse.swt.events.MenuListener listener)
- Adds the listener to the collection of listeners who will
be notified when menus are hidden or shown, by sending it
one of the messages defined in the
MenuListenerinterface.
addHelpListener
public void addHelpListener(org.eclipse.swt.events.HelpListener listener)
- Adds the listener to the collection of listeners who will
be notified when help events are generated for the control,
by sending it one of the messages defined in the
HelpListenerinterface.
createHandle
void createHandle(int index)
- Overrides:
createHandlein classWidget
createIMMenu
void createIMMenu(long imHandle)
createWidget
void createWidget(int index)
- Overrides:
createWidgetin classWidget
fixMenus
void fixMenus(Decorations newParent)
getDefaultItem
public MenuItem getDefaultItem()
- Returns the default menu item or null if none has
been previously set.
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.
getItem
public MenuItem getItem(int index)
- Returns the item at the given, zero-relative index in the
receiver. Throws an exception if the index is out of range.
getItemCount
public int getItemCount()
- Returns the number of items contained in the receiver.
getItems
public MenuItem[] getItems()
- Returns an array of
MenuItems which are the items in the receiver.Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.
getNameText
java.lang.String getNameText()
- Overrides:
getNameTextin classWidget
getParent
public Decorations getParent()
- Returns the receiver's parent, which must be a
Decorations.
getParentItem
public MenuItem getParentItem()
- Returns the receiver's parent item, which must be a
MenuItemor null when the receiver is a root.
getParentMenu
public Menu getParentMenu()
- Returns the receiver's parent item, which must be a
Menuor null when the receiver is a root.
getShell
public Shell getShell()
- Returns the receiver's shell. For all controls other than
shells, this simply returns the control's nearest ancestor
shell. Shells return themselves, even if they are children
of other shells.
getSize
org.eclipse.swt.graphics.Point getSize()
getVisible
public boolean getVisible()
- Returns
trueif the receiver is visible, andfalseotherwise.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.
gtk_hide
long gtk_hide(long widget)
gtk_show
long gtk_show(long widget)
gtk_show_help
long gtk_show_help(long widget,
long helpType)
- Overrides:
gtk_show_helpin classWidget
hookEvents
void hookEvents()
- Overrides:
hookEventsin classWidget
indexOf
public int indexOf(MenuItem item)
- Searches the receiver's list starting at the first item
(index 0) until an item is found that is equal to the
argument, and returns the index of that item. If no item
is found, returns -1.
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.
isVisible
public boolean isVisible()
- Returns
trueif the receiver is visible and all of the receiver's ancestors are visible andfalseotherwise.
menuPositionProc
long menuPositionProc(long menu,
long x,
long y,
long push_in,
long user_data)
- Overrides:
menuPositionProcin classWidget
releaseChild
void releaseChild()
- Overrides:
releaseChildin classWidget
releaseWidget
void releaseWidget()
- Overrides:
releaseWidgetin classWidget
removeMenuListener
public void removeMenuListener(org.eclipse.swt.events.MenuListener listener)
- Removes the listener from the collection of listeners who will
be notified when the menu events are generated for the control.
removeAccelerators
void removeAccelerators(long accelGroup)
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.
sendHelpEvent
boolean sendHelpEvent(long helpType)
setDefaultItem
public void setDefaultItem(MenuItem item)
- Sets the default menu item to the argument or removes
the default emphasis when the argument is
null.
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.
setLocation
public void setLocation(int x,
int y)
- Sets the receiver's location to the point specified by
the arguments which are relative to the display.
Note: This is different from most widgets where the location of the widget is relative to the parent.
setLocation
public void setLocation(org.eclipse.swt.graphics.Point location)
- Sets the receiver's location to the point specified by
the arguments which are relative to the display.
Note: This is different from most widgets where the location of the widget is relative to the parent.
- Since:
- 2.1
setVisible
public void setVisible(boolean visible)
- Marks the receiver as visible if the argument is
true, and marks it invisible otherwise.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC