public abstract class MenuShell extends Container
Menu
and
MenuBar
. It provides the common methods for adding and organizing
MenuItem
s.
The following example creates one simple menu with a submenu and adds it to a menu bar:
Menu subMenu = new Menu(); subMenu.append(new MenuItem("Sub Item _1")); subMenu.append(new MenuItem("Sub Item _2")); MenuItem subMenuItem = new MenuItem("Sub menu .."); subMenuItem.setSubmenu(subMenu); Menu aMenu = new Menu(); aMenu.append(new MenuItem("Item _1")); aMenu.append(new MenuItem("Item _2")); aMenu.append(subMenuItem); MenuItem aMenuItem = new MenuItem("_Other menu .."); aMenuItem.setSubmenu(aMenu); MenuBar menuBar = new MenuBar(); menuBar.append(aMenuItem); // finally add menuBar to the Window's VBox
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
Modifier and Type | Method and Description |
---|---|
void |
append(Widget child)
Append one Widget to the MenuShell.
|
void |
deactivate()
Deactivate the MenuShell.
|
void |
insert(Widget child,
int position)
Insert one Widget to the MenuShell at the specified position.
|
void |
prepend(Widget child)
Prepend one Widget to the MenuShell.
|
add, getChildren, remove, setBorderWidth
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public void append(Widget child)
public void deactivate()
According to the GTK API documentation, this "typically" results in the Menu being erased from the screen. TODO what other effect could it have?
public void insert(Widget child, int position)
public void prepend(Widget child)