GTK+ Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GtkOptionMenu

## Name

GtkOptionMenu -- a widget used to choose from a list of valid choices.

## Synopsis

    #include <gtk/gtk.h>

    struct      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);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkBin
                         +----GtkButton
                               +----GtkOptionMenu

## Description

A 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.

## Details

### struct GtkOptionMenu

    struct GtkOptionMenu;

The GtkOptionMenu struct contains private data only, and should be accessed using the functions below.

### gtk_option_menu_new ()

    GtkWidget*  gtk_option_menu_new             (void);

Creates a new GtkOptionMenu.

Returns : | a new GtkOptionMenu.

### gtk_option_menu_get_menu ()

    GtkWidget*  gtk_option_menu_get_menu        (GtkOptionMenu *option_menu);

Returns the GtkMenu associated with the GtkOptionMenu.

`option_menu` : | a GtkOptionMenu.
Returns : | the GtkMenu associated with the GtkOptionMenu.

### gtk_option_menu_set_menu ()

    void        gtk_option_menu_set_menu        (GtkOptionMenu *option_menu,
                                                 GtkWidget *menu);

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.

`option_menu` : | a GtkOptionMenu.
`menu` : | the GtkMenu to associate with the GtkOptionMenu.

### gtk_option_menu_remove_menu ()

    void        gtk_option_menu_remove_menu     (GtkOptionMenu *option_menu);

Removes the menu from the option menu.

`option_menu` : | a GtkOptionMenu.

### gtk_option_menu_set_history ()

    void        gtk_option_menu_set_history     (GtkOptionMenu *option_menu,
                                                 guint index);

Selects the menu item specified by `index` making it the newly selected value for the option menu.

`option_menu` : | a GtkOptionMenu.
`index` : | the index of the menu item to select. Index values are from 0 to n-1.

<<< Previous Page | Home | Up | Next Page >>>
GtkObject | GtkPacker