|
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.MenuShell
org.gnome.gtk.Menu
public class Menu
A drop-down set of Widgets creating a menu. Menus consist of other
MenuItem
s. Menus are either placed inside a MenuBar
or
another MenuItem, thereby forming a sub-menu. An entire hierarchy of Menu
structures can thus be created by appropriately placing Menus inside
MenuBars or MenuItems.
A "context menu" (a stand-alone menu which pops-up) can also be created; this is commonly used to create a context sensitive popup menu in response to a right-click (or left-click as the case may be); see the popup() method.
For a broader explanation of the Menu API see MenuShell
.
GTK does have the ability to "tear" Menus off from the parent Container. After consistently poor results in usability testing, however, tear-off menus are now highly discouraged in the GNOME community. They are therefore not presented in the java-gnome bindings.
Nested Class Summary |
---|
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 | |
---|---|
Menu()
Construct a new Menu. |
Method Summary | |
---|---|
void |
popup()
Popup a context menu. |
void |
popup(int x,
int y)
Having constructed a Menu to be used as the context menu, present it at the specified location. |
void |
popup(StatusIcon status)
A special case for popping up the context menu associated with a StatusIcon. |
void |
setAcceleratorGroup(AcceleratorGroup group)
This method must be called in order to have the key bindings in MenuItems work. |
Methods inherited from class org.gnome.gtk.MenuShell |
---|
append, deactivate, insert, prepend |
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 Menu()
Method Detail |
---|
public void popup()
Unlike normal Menus that are part of an application's MenuBar, context
menus are not mapped automatically, so you need to have
showAll()
called on them once you're done
building them to allocate their resources (otherwise you end up with a
1x1 pixel sized menu with nothing in it).
public void popup(int x, int y)
getLocation()
if you wish to
place the menu at the "cursor position" rather than where the mouse
pointer is.
public void popup(StatusIcon status)
StatusIcon.PopupMenu
signal
callback as follows:
StatusIcon si; Menu context; ... si.connect(new StatusIcon.PopupMenu() { public void onPopupMenu(StatusIcon source, int button, int activateTime) { context.popup(source); } });Don't forget to call
showAll()
on the Menu
when you're done constructing it before trying to use it the first
time.
public void setAcceleratorGroup(AcceleratorGroup group)
addAcceleratorGroup()
.
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |