org.gnu.gtk

Class OptionMenu


public class OptionMenu
extends Button

deprecated menu widget replaced by ComboBox in gtk 2.3. An OptionMenu is a widget that allows the user to choose from a list of valid choices. When activated the OptionMenu displays a popup Menu which allows the user to make a new choice.

Constructor Summary

OptionMenu()
Create a new OptionMenu.
OptionMenu(Handle handle)
Construct an OptionMenu using a handle to a native resource.

Method Summary

void
addListener(OptionMenuListener listener)
Register an object to handle optionMenu events.
Class
getEventListenerClass(String signal)
EventType
getEventType(String signal)
int
getHistory()
Retrieves the index of the currently selected menu item.
Menu
getMenu()
Returns the Menu associated with this OptionMenu.
static Type
getType()
Retrieve the runtime type used by the GLib library.
void
removeListener(OptionMenuListener listener)
Removes a listener
void
removeMenu()
Removes the Menu from the OptionMenu
void
setHistory(int index)
Selects the menu item specified by index making it the newly selected value for the option menu.
void
setMenu(Menu menu)
Provides the Menu that is popped up to allow the user to choose a new value.

Methods inherited from class org.gnu.gtk.Button

addListener, click, enter, getButton, getEventListenerClass, getEventType, getFocusOnClick, getImage, getLabel, getRelief, getType, getUseStock, getUseUnderline, getXAlignment, getYAlignment, leave, press, release, removeListener, setAlignment, setFocusOnClick, setImage, setLabel, setRelief, setUseStock, setUseUnderline

Methods inherited from class org.gnu.gtk.Bin

getChild, getType

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, 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, 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

OptionMenu

public OptionMenu()
Create a new OptionMenu.

OptionMenu

public OptionMenu(Handle handle)
Construct an OptionMenu using a handle to a native resource.

Method Details

addListener

public void addListener(OptionMenuListener listener)
Register an object to handle optionMenu events.

getEventListenerClass

public Class getEventListenerClass(String signal)
Overrides:
getEventListenerClass in interface Button

getEventType

public EventType getEventType(String signal)
Overrides:
getEventType in interface Button

getHistory

public int getHistory()
Retrieves the index of the currently selected menu item. The menu items are numbered from top to bottom, starting with 0.
Returns:
index of the selected menu item, or -1 if there are no menu items

getMenu

public Menu getMenu()
Returns the Menu associated with this OptionMenu.
Returns:
The Menu associated with this OptionMenu.

getType

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

removeListener

public void removeListener(OptionMenuListener listener)
Removes a listener

removeMenu

public void removeMenu()
Removes the Menu from the OptionMenu

setHistory

public void setHistory(int index)
Selects the menu item specified by index making it the newly selected value for the option menu.
Parameters:
index - the index of the menu item to select. Index values are from 0 to n-1.

setMenu

public void setMenu(Menu menu)
Provides the Menu that is popped up to allow the user to choose a new value. You should provide a simple menu avoiding the use of tearoff menu items, submenus, and accelerators.
Parameters:
menu - The Menu to add to the OptionMenu.