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

# GtkCheckMenuItem

## Name

GtkCheckMenuItem -- a menu item with a check box.

## Synopsis

    #include <gtk/gtk.h>

    struct      GtkCheckMenuItem;
    GtkWidget*  gtk_check_menu_item_new         (void);
    GtkWidget*  gtk_check_menu_item_new_with_label
                                                (const gchar *label);
    #define     gtk_check_menu_item_set_state
    void        gtk_check_menu_item_set_active  (GtkCheckMenuItem *check_menu_item,
                                                 gboolean is_active);
    void        gtk_check_menu_item_set_show_toggle
                                                (GtkCheckMenuItem *menu_item,
                                                 gboolean always);
    void        gtk_check_menu_item_toggled     (GtkCheckMenuItem *check_menu_item);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkBin
                         +----GtkItem
                               +----GtkMenuItem
                                     +----GtkCheckMenuItem

## Signal Prototypes

    "toggled"   void        user_function      (GtkCheckMenuItem *checkmenuitem,
                                                gpointer user_data);

## Description

A GtkCheckMenuItem is a menu item that maintains the state of a boolean value in addition to a GtkMenuItem's usual role in activating application code.

A check box indicating the state of the boolean value is displayed at the left side of the GtkMenuItem. Activating the GtkMenuItem toggles the value.

## Details

### struct GtkCheckMenuItem

    struct GtkCheckMenuItem;

The GtkCheckMenuItem struct contains the following fields. (These fields should be considered read-only. They should never be set by an application.)

guint active; | TRUE if the check box is active.

### gtk_check_menu_item_new ()

    GtkWidget*  gtk_check_menu_item_new         (void);

Creates a new GtkCheckMenuItem.

Returns : | a new GtkCheckMenuItem.

### gtk_check_menu_item_new_with_label ()

    GtkWidget*  gtk_check_menu_item_new_with_label
                                                (const gchar *label);

Creates a new GtkCheckMenuItem with a label.

`label` : | the string to use for the label.
Returns : | a new GtkCheckMenuItem.

### gtk_check_menu_item_set_state

    #define	gtk_check_menu_item_set_state		gtk_check_menu_item_set_active

This macro is provided to preserve compatibility with older code. New code should use gtk_check_menu_item_set_active() function instead.

### gtk_check_menu_item_set_active ()

    void        gtk_check_menu_item_set_active  (GtkCheckMenuItem *check_menu_item,
                                                 gboolean is_active);

Sets the active state of the menu item's check box.

`check_menu_item` : | a GtkCheckMenuItem.
`is_active` : | boolean value indicating whether the check box is active.

### gtk_check_menu_item_set_show_toggle ()

    void        gtk_check_menu_item_set_show_toggle
                                                (GtkCheckMenuItem *menu_item,
                                                 gboolean always);

Controls whether the check box is shown at all times. Normally the check box is shown only when it is active or while the menu item is selected.

`menu_item` : | a GtkCheckMenuItem.
`always` : | boolean value indicating whether to always show the check box.

### gtk_check_menu_item_toggled ()

    void        gtk_check_menu_item_toggled     (GtkCheckMenuItem *check_menu_item);

Emits the GtkCheckMenuItem::toggled signal.

`check_menu_item` : | a GtkCheckMenuItem.

## Signals

### The "toggled" signal

    void        user_function                  (GtkCheckMenuItem *checkmenuitem,
                                                gpointer user_data);

This signal is emitted when the state of the check box is changed.

A signal handler can examine the `active` field of the GtkCheckMenuItem struct to discover the new state.

`checkmenuitem` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

<<< Previous Page | Home | Up | Next Page >>>
GtkCheckButton | GtkCList