The MenuShell class is an abstract base class used to derive the Menu
and MenuBar subclasses.
A MenuShell is a container of MenuItem objects arranged in a list which can be
navigated, selected, and activated by the user to perform application functions. A
MenuItem can have a submenu associated with it, allowing for nested hierarchical
menus.
activateItem
public void activateItem(MenuItem menuItem,
boolean forceDeactivate)
Activates the MenuItem within the MenuShell.
menuItem
- The MenuItem to activate.forceDeactivate
- If true
, force the deactivation of the MenuShell
after the MenuItem is activated.
append
public void append(MenuItem child)
Append a new MenuItem to the end of the MenuShell's item list.
child
- The MenuItem to add
cancel
public void cancel()
Cancels the selection within the menu shell.
deactivate
public void deactivate()
Deactivates the MenuShell. Typically this results in the MenuShell being erased from
the screen.
deselect
public void deselect()
Deselects the currently selected item from the MenuShell.
getType
public static Type getType()
Retrieve the runtime type used by the GLib library.
- getType in interface Container
gtk_menu_shell_activate_item
protected static final void gtk_menu_shell_activate_item(Handle menu_shell,
Handle menuItem,
boolean forceDeactivate)
gtk_menu_shell_append
protected static final void gtk_menu_shell_append(Handle menu_shell,
Handle child)
gtk_menu_shell_deactivate
protected static final void gtk_menu_shell_deactivate(Handle menu_shell)
gtk_menu_shell_deselect
protected static final void gtk_menu_shell_deselect(Handle menu_shell)
gtk_menu_shell_get_type
protected static final int gtk_menu_shell_get_type()
gtk_menu_shell_insert
protected static final void gtk_menu_shell_insert(Handle menu_shell,
Handle child,
int position)
gtk_menu_shell_prepend
protected static final void gtk_menu_shell_prepend(Handle menu_shell,
Handle child)
gtk_menu_shell_select_item
protected static final void gtk_menu_shell_select_item(Handle menu_shell,
Handle menuItem)
insert
public void insert(MenuItem child,
int position)
Adds a new MenuItem to the MenuShell's item list at the requested position.
child
- The MenuItem to add.position
- The position in the item list where child
is added. Positions
are zero based.
prepend
public void prepend(MenuItem child)
Adds a new MenuItem to the beginning of the MenuShell's item list.
child
- The MenuItem to add.
selectFirst
public void selectFirst(boolean searchSensitive)
Select the first visible or selectable child of the menu shell.
It won't select tearoff items unless the only item is a tearoff
item.
searchSensitive
- If TRUE, search for the first selectable
menu item, otherwise select nothing if the first item isn't
sensitive. This should be FALSE if the menu is being popped up
initially.
selectItem
public void selectItem(MenuItem menuItem)
Selects the MenuItem from the MenuShell.
menuItem
- The MenuItem to select.