org.gnu.gtk

Class Menu


public class Menu
extends MenuShell

A Menu is a MenuShell that implements a drop down menu consisting of a list of MenuItem objects which can be navigated and activated by the user to perform application functions.

Constructor Summary

Menu()
Create a new Menu.
Menu(Handle handle)
Create a new Menu from a handle to a native resource.

Method Summary

void
detach()
Detaches the menu from the widget to which it had been attached.
ArrayList
getAttachedMenus()
Returns a list of the menus which are attached to this widget.
static Menu
getMenu(Handle handle)
Create a new Menu from a handle to a native resource.
String
getTitle()
Returns the title of the menu.
static Type
getType()
Retrieve the runtime type used by the GLib library.
void
popup()
Displays a menu and makes it available for selection.
void
reorderMenuItem(MenuItem child, int position)
Move a MenuItem to a new position within the Menu.
void
setAccelGroup(AccelGroup accelGroup)
Set the AccelGroup which holds global accelerators for the menu.
void
setTitle(String title)
Sets the title string for this Menu.

Methods inherited from class org.gnu.gtk.MenuShell

activateItem, append, cancel, deactivate, deselect, getTakeFocus, getType, insert, prepend, selectFirst, selectItem, setTakeFocus

Methods inherited from class org.gnu.gtk.Container

add, addListener, getBorderWidth, getChildren, getEventListenerClass, getEventType, getResizeMode, getType, remove, removeListener, resizeChildren, setBorderWidth, setResizeMode

Methods inherited from class org.gnu.gtk.Widget

activate, addAccelerator, addEvents, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, draw, drawArea, drawArea, finish, getAccessible, getAllocation, getCanFocus, getColormap, getContext, getData, getDisplay, getDragData, getEventListenerClass, getEventType, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getType, getWidget, getWindow, grabDefault, grabFocus, hasFocus, hasScreen, hide, hideAll, highlight, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeAccelerator, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setCanFocus, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setEvents, setExtensionEvents, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight, unHighlight

Methods inherited from class org.gnu.gtk.GtkObject

destroy, getType, sink

Methods inherited from class org.gnu.glib.GObject

addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify

Constructor Details

Menu

public Menu()
Create a new Menu.

Menu

public Menu(Handle handle)
Create a new Menu from a handle to a native resource.

Method Details

detach

public void detach()
Detaches the menu from the widget to which it had been attached.

getAttachedMenus

public ArrayList getAttachedMenus()
Returns a list of the menus which are attached to this widget.

getMenu

public static Menu getMenu(Handle handle)
Create a new Menu from a handle to a native resource.

getTitle

public String getTitle()
Returns the title of the menu.
Returns:
The title for the menu.

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.
Overrides:
getType in interface MenuShell

popup

public void popup()
Displays a menu and makes it available for selection. Applications can use this method to provide context-sensitive menus.

reorderMenuItem

public void reorderMenuItem(MenuItem child,
                            int position)
Move a MenuItem to a new position within the Menu.
Parameters:
child - The MenuItem to be moved.
position - The new position to place the MenuItem.

setAccelGroup

public void setAccelGroup(AccelGroup accelGroup)
Set the AccelGroup which holds global accelerators for the menu. The accelerator group needs to also be added to all windows that this menu is being used in.
Parameters:
accelGroup - The AccelGroup to be associated with this Menu.

setTitle

public void setTitle(String title)
Sets the title string for this Menu. The title is displayed when the menu is shown as a tearoff menu.
Parameters:
title - The title for the Menu.