synopsis#include <gtk/gtk.h> gtkoptionmenu; gtkwidget* gtk_option_menu_new (void); gtkwidget* gtk_option_menu_get_menu (gtkoptionmenu *option_menu); void gtk_option_menu_set_menu (gtkoptionmenu *option_menu, gtkwidget *menu); void gtk_option_menu_remove_menu (gtkoptionmenu *option_menu); void gtk_option_menu_set_history (gtkoptionmenu *option_menu, guint index_); gint gtk_option_menu_get_history (gtkoptionmenu *option_menu); object hierarchygobject +----ginitiallyunowned +----gtkobject +----gtkwidget +----gtkcontainer +----gtkbin +----gtkbutton +----gtkoptionmenu descriptiona gtkoptionmenu is a widget that allows the user to choose from a list of valid choices. the gtkoptionmenu displays the selected choice. when activated the gtkoptionmenu displays a popup gtkmenu which allows the user to make a new choice. using a gtkoptionmenu is simple; build a gtkmenu, by calling gtk_menu_new(), then appending menu items to it with gtk_menu_shell_append(). set that menu on the option menu with gtk_option_menu_set_menu(). set the selected menu item with gtk_option_menu_set_history(); connect to the "changed" signal on the option menu; in the "changed" signal, check the new selected menu item with gtk_option_menu_get_history(). as of gtk+ 2.4, gtkoptionmenu has been deprecated in favor of gtkcombobox. detailsgtkoptionmenutypedef struct _gtkoptionmenu gtkoptionmenu; warninggtkoptionmenu is deprecated and should not be used in newly-written code. use gtkcombobox instead. the gtkoptionmenu-struct struct contains private data only, and should be accessed using the functions below. gtk_option_menu_new ()gtkwidget* gtk_option_menu_new (void); warninggtk_option_menu_new is deprecated and should not be used in newly-written code. use gtkcombobox instead. creates a new gtkoptionmenu.
gtk_option_menu_get_menu ()gtkwidget* gtk_option_menu_get_menu (gtkoptionmenu *option_menu); warninggtk_option_menu_get_menu is deprecated and should not be used in newly-written code. use gtkcombobox instead. returns the gtkmenu associated with the gtkoptionmenu.
gtk_option_menu_set_menu ()void gtk_option_menu_set_menu (gtkoptionmenu *option_menu, gtkwidget *menu); warninggtk_option_menu_set_menu is deprecated and should not be used in newly-written code. use gtkcombobox instead. provides the gtkmenu 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.
gtk_option_menu_remove_menu ()void gtk_option_menu_remove_menu (gtkoptionmenu *option_menu); warninggtk_option_menu_remove_menu is deprecated and should not be used in newly-written code. use gtkcombobox instead. removes the menu from the option menu.
gtk_option_menu_set_history ()void gtk_option_menu_set_history (gtkoptionmenu *option_menu, guint index_); warninggtk_option_menu_set_history is deprecated and should not be used in newly-written code. use gtkcombobox instead. selects the menu item specified by index_ making it the newly selected value for the option menu.
gtk_option_menu_get_history ()gint gtk_option_menu_get_history (gtkoptionmenu *option_menu); warninggtk_option_menu_get_history is deprecated and should not be used in newly-written code. use gtkcombobox instead. retrieves the index of the currently selected menu item. the menu items are numbered from top to bottom, starting with 0.
style property detailsthe "indicator-size" style property"indicator-size" gtkrequisition : read size of dropdown indicator. the "indicator-spacing" style property"indicator-spacing" gtkborder : read spacing around indicator. signal detailsthe "changed" signalvoid user_function (gtkoptionmenu *optionmenu, gpointer user_data) : run last
|