## GtkImageMenuItem

GtkImageMenuItem — A menu item with an icon

## Synopsis

    #include <gtk/gtk.h>

    struct              GtkImageMenuItem;
    void                gtk_image_menu_item_set_image       (GtkImageMenuItem *image_menu_item,
                                                             GtkWidget *image);
    GtkWidget *         gtk_image_menu_item_get_image       (GtkImageMenuItem *image_menu_item);
    GtkWidget *         gtk_image_menu_item_new             (void);
    GtkWidget *         gtk_image_menu_item_new_from_stock  (const gchar *stock_id,
                                                             GtkAccelGroup *accel_group);
    GtkWidget *         gtk_image_menu_item_new_with_label  (const gchar *label);
    GtkWidget *         gtk_image_menu_item_new_with_mnemonic
                                                            (const gchar *label);
    gboolean            gtk_image_menu_item_get_use_stock   (GtkImageMenuItem *image_menu_item);
    void                gtk_image_menu_item_set_use_stock   (GtkImageMenuItem *image_menu_item,
                                                             gboolean use_stock);
    gboolean            gtk_image_menu_item_get_always_show_image
                                                            (GtkImageMenuItem *image_menu_item);
    void                gtk_image_menu_item_set_always_show_image
                                                            (GtkImageMenuItem *image_menu_item,
                                                             gboolean always_show);
    void                gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
                                                             GtkAccelGroup *accel_group);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkItem
                                           +----GtkMenuItem
                                                 +----GtkImageMenuItem

## Implemented Interfaces

GtkImageMenuItem implements AtkImplementorIface, GtkBuildable and GtkActivatable.

## Properties

      "accel-group"              GtkAccelGroup*        : Write
      "always-show-image"        gboolean              : Read / Write / Construct
      "image"                    GtkWidget*            : Read / Write
      "use-stock"                gboolean              : Read / Write / Construct

## Description

A GtkImageMenuItem is a menu item which has an icon next to the text label.

Note that the user can disable display of menu icons, so make sure to still fill in the text label.

## Details

### struct GtkImageMenuItem

    struct GtkImageMenuItem;

### gtk_image_menu_item_set_image ()

    void                gtk_image_menu_item_set_image       (GtkImageMenuItem *image_menu_item,
                                                             GtkWidget *image);

Sets the image of `image_menu_item` to the given widget. Note that it depends on the show-menu-images setting whether the image will be displayed or not.

`image_menu_item` : | a GtkImageMenuItem.
`image` : | a widget to set as the image for the menu item. [allow-none]

### gtk_image_menu_item_get_image ()

    GtkWidget *         gtk_image_menu_item_get_image       (GtkImageMenuItem *image_menu_item);

Gets the widget that is currently set as the image of `image_menu_item`. See `gtk_image_menu_item_set_image()`.

`image_menu_item` : | a GtkImageMenuItem
Returns : | the widget set as image of `image_menu_item`. [transfer none]

### gtk_image_menu_item_new ()

    GtkWidget *         gtk_image_menu_item_new             (void);

Creates a new GtkImageMenuItem with an empty label.

Returns : | a new GtkImageMenuItem.

### gtk_image_menu_item_new_from_stock ()

    GtkWidget *         gtk_image_menu_item_new_from_stock  (const gchar *stock_id,
                                                             GtkAccelGroup *accel_group);

Creates a new GtkImageMenuItem containing the image and text from a stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK and GTK_STOCK_APPLY.

If you want this menu item to have changeable accelerators, then pass in `NULL` for accel_group. Next call `gtk_menu_item_set_accel_path()` with an appropriate path for the menu item, use `gtk_stock_lookup()` to look up the standard accelerator for the stock item, and if one is found, call `gtk_accel_map_add_entry()` to register it.

`stock_id` : | the name of the stock item.
`accel_group` : | the GtkAccelGroup to add the menu items accelerator to, or `NULL`. [allow-none]
Returns : | a new GtkImageMenuItem.

### gtk_image_menu_item_new_with_label ()

    GtkWidget *         gtk_image_menu_item_new_with_label  (const gchar *label);

Creates a new GtkImageMenuItem containing a label.

`label` : | the text of the menu item.
Returns : | a new GtkImageMenuItem.

### gtk_image_menu_item_new_with_mnemonic ()

    GtkWidget *         gtk_image_menu_item_new_with_mnemonic
                                                            (const gchar *label);

Creates a new GtkImageMenuItem containing a label. The label will be created using `gtk_label_new_with_mnemonic()`, so underscores in `label` indicate the mnemonic for the menu item.

`label` : | the text of the menu item, with an underscore in front of the mnemonic character
Returns : | a new GtkImageMenuItem

### gtk_image_menu_item_get_use_stock ()

    gboolean            gtk_image_menu_item_get_use_stock   (GtkImageMenuItem *image_menu_item);

Checks whether the label set in the menuitem is used as a stock id to select the stock item for the item.

`image_menu_item` : | a GtkImageMenuItem
Returns : | `TRUE` if the label set in the menuitem is used as a stock id to select the stock item for the item

Since 2.16

### gtk_image_menu_item_set_use_stock ()

    void                gtk_image_menu_item_set_use_stock   (GtkImageMenuItem *image_menu_item,
                                                             gboolean use_stock);

If `TRUE`, the label set in the menuitem is used as a stock id to select the stock item for the item.

`image_menu_item` : | a GtkImageMenuItem
`use_stock` : | `TRUE` if the menuitem should use a stock item

Since 2.16

### gtk_image_menu_item_get_always_show_image ()

    gboolean            gtk_image_menu_item_get_always_show_image
                                                            (GtkImageMenuItem *image_menu_item);

Returns whether the menu item will ignore the "gtk-menu-images" setting and always show the image, if available.

`image_menu_item` : | a GtkImageMenuItem
Returns : | `TRUE` if the menu item will always show the image

Since 2.16

### gtk_image_menu_item_set_always_show_image ()

    void                gtk_image_menu_item_set_always_show_image
                                                            (GtkImageMenuItem *image_menu_item,
                                                             gboolean always_show);

If `TRUE`, the menu item will ignore the "gtk-menu-images" setting and always show the image, if available.

Use this property if the menuitem would be useless or hard to use without the image.

`image_menu_item` : | a GtkImageMenuItem
`always_show` : | `TRUE` if the menuitem should always show the image

Since 2.16

### gtk_image_menu_item_set_accel_group ()

    void                gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
                                                             GtkAccelGroup *accel_group);

Specifies an `accel_group` to add the menu items accelerator to (this only applies to stock items so a stock item must already be set, make sure to call `gtk_image_menu_item_set_use_stock()` and `gtk_menu_item_set_label()` with a valid stock item first).

If you want this menu item to have changeable accelerators then you shouldnt need this (see `gtk_image_menu_item_new_from_stock()`).

`image_menu_item` : | a GtkImageMenuItem
`accel_group` : | the GtkAccelGroup

Since 2.16

## Property Details

### The `"accel-group"` property

      "accel-group"              GtkAccelGroup*        : Write

The Accel Group to use for stock accelerator keys

Since 2.16

### The `"always-show-image"` property

      "always-show-image"        gboolean              : Read / Write / Construct

If `TRUE`, the menu item will ignore the "gtk-menu-images" setting and always show the image, if available.

Use this property if the menuitem would be useless or hard to use without the image.

Default value: FALSE

Since 2.16

### The `"image"` property

      "image"                    GtkWidget*            : Read / Write

Child widget to appear next to the menu text.

### The `"use-stock"` property

      "use-stock"                gboolean              : Read / Write / Construct

If `TRUE`, the label set in the menuitem is used as a stock id to select the stock item for the item.

Default value: FALSE

Since 2.16