|
java-gnome version 4.0.19 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.Object
org.gnome.gtk.Widget
org.gnome.gtk.Container
org.gnome.gtk.Bin
org.gnome.gtk.Item
org.gnome.gtk.MenuItem
public class MenuItem
MenuItems are the basic elements that form a Menu. While MenuItems are Containers and are thus capable of containing other Widgets; in practise only the specialized MenuItem classes will work properly as they are what support highlighting, alignment, submenus, etc.
MenuItems can be either left justified or right justified, but in general you should just leave this alone and it will do the right thing for your locale (left aligned for western languages, right aligned for right-to-left languages like Arabic).
Right justification was initially designed to be used for "Help" Menus, but this is now considered a bad idea and is no longer used in GNOME.
Nested Class Summary | |
---|---|
static interface |
MenuItem.Activate
The handler interface for an activation. |
Nested classes/interfaces inherited from class org.gnome.gtk.Widget |
---|
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent |
Nested classes/interfaces inherited from class org.gnome.gtk.Object |
---|
Object.Destroy |
Constructor Summary | |
---|---|
MenuItem()
Construct a MenuItem |
|
MenuItem(String mnemonicLabel)
Construct a MenuItem with a given text label. |
|
MenuItem(String mnemonicLabel,
MenuItem.Activate handler)
Construct a MenuItem with a given text label, and additionally connect a handler to its MenuItem.Activate signal. |
Method Summary | |
---|---|
void |
connect(MenuItem.Activate handler)
Connect an MenuItem.Activate handler to the widget. |
Action |
getRelatedAction()
Get the Action that is triggered when this Activatable is activated, if any. |
Widget |
getSubmenu()
Returns the submenu underneath this menu item, if any |
void |
setAccelerator(AcceleratorGroup group,
Keyval keyval,
ModifierType modifier)
Set a key binding for this MenuItem. |
void |
setRelatedAction(Action action)
Set the Action that is triggered when this Activatable is activated. |
void |
setSubmenu(Menu child)
Sets or replaces the MenuItem's submenu, or removes it if a null Menu is passed. |
Methods inherited from class org.gnome.gtk.Bin |
---|
getChild |
Methods inherited from class org.gnome.gtk.Container |
---|
add, getChildren, remove, setBorderWidth |
Methods inherited from class org.gnome.gtk.Widget |
---|
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll |
Methods inherited from class org.gnome.gtk.Object |
---|
connect, destroy |
Methods inherited from class org.freedesktop.bindings.Pointer |
---|
toString |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MenuItem()
public MenuItem(String mnemonicLabel)
_
character) which, if present, will
indicate the mnemonic which will activate that MenuItem directly if
that key is pressed (whilst the Menu is showing, obviously).
public MenuItem(String mnemonicLabel, MenuItem.Activate handler)
MenuItem.Activate
signal.
This is equivalent to:
item = new MenuItem("_My menu item"); item.connect(handler);and affords you the convenience of being able to add a MenuItem fairly compactly:
Menu editMenu; editMenu.append(new MenuItem("_Paste", new MenuItem.Activate() { public void onActivate(MenuItem source) { ... } }));
Method Detail |
---|
public void connect(MenuItem.Activate handler)
MenuItem.Activate
handler to the widget.
public Action getRelatedAction()
Activatable
getRelatedAction
in interface Activatable
public Widget getSubmenu()
null
if none.public void setAccelerator(AcceleratorGroup group, Keyval keyval, ModifierType modifier)
public void setRelatedAction(Action action)
Activatable
This replaced Action's connectProxy().
setRelatedAction
in interface Activatable
public void setSubmenu(Menu child)
null
Menu is passed.
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |