Public Member Functions | Related Functions

# Gtk::ImageMenuItem Class Reference
[Menu classes, Widgets]

A menu item with an icon. More...

Inheritance diagram for Gtk::ImageMenuItem:
[legend]
Collaboration diagram for Gtk::ImageMenuItem:
[legend]

List of all members.

## Public Member Functions
virtual | ~ImageMenuItem ()
GtkImageMenuItem* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkImageMenuItem* | gobj () const
| Provides access to the underlying C GtkObject.
| ImageMenuItem ()
| ImageMenuItem (Widget& image, const Glib::ustring& label, bool mnemonic=false)
| ImageMenuItem (const Glib::ustring& label, bool mnemonic=false)
| ImageMenuItem (const StockID& id)
void | set_always_show_image (bool always_show=true)
| If `true`, the menu item will ignore the Gtk::Settings:gtk-menu-images setting and always show the image, if available.
bool | get_always_show_image () const
| Returns whether the menu item will ignore the Gtk::Settings:gtk-menu-images setting and always show the image, if available.
void | set_image (Widget& image)
| Sets the image of image_menu_item to the given widget.
Widget* | get_image ()
| Gets the widget that is currently set as the image of image_menu_item.
const Widget* | get_image () const
| Gets the widget that is currently set as the image of image_menu_item.
void | set_use_stock (bool use_stock=true)
| If `true`, the label set in the menuitem is used as a stock id to select the stock item for the item.
bool | get_use_stock () const
| Checks whether the label set in the menuitem is used as a stock id to select the stock item for the item.
void | set_accel_group (const Glib::RefPtr< AccelGroup >& 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 set_use_stock() and Gtk::MenuItem::set_label() with a valid stock item first).
Glib::PropertyProxy< Widget* > | property_image ()
| Child widget to appear next to the menu text.
Glib::PropertyProxy_ReadOnly < Widget* > | property_image () const
| Child widget to appear next to the menu text.
Glib::PropertyProxy< bool > | property_use_stock ()
| Whether to use the label text to create a stock menu item.
Glib::PropertyProxy_ReadOnly < bool > | property_use_stock () const
| Whether to use the label text to create a stock menu item.
Glib::PropertyProxy_WriteOnly < Glib::RefPtr< AccelGroup > > | property_accel_group ()
| The Accel Group to use for stock accelerator keys.
Glib::PropertyProxy< bool > | property_always_show_image ()
| Whether the image will always be shown.
Glib::PropertyProxy_ReadOnly < bool > | property_always_show_image () const
| Whether the image will always be shown.
## Related Functions
(Note that these are not member functions.)
Gtk::ImageMenuItem* | wrap (GtkImageMenuItem* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A menu item with an icon.

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.

## Constructor & Destructor Documentation

virtual Gtk::ImageMenuItem::~ImageMenuItem | ( | ) | `[virtual]`

Gtk::ImageMenuItem::ImageMenuItem | ( | ) |

Gtk::ImageMenuItem::ImageMenuItem | ( | Widget& | image,
|  | const Glib::ustring & | label,
|  | bool | mnemonic = `false`
| ) |  | `[explicit]`

Gtk::ImageMenuItem::ImageMenuItem | ( | const Glib::ustring & | label,
|  | bool | mnemonic = `false`
| ) |  | `[explicit]`

Gtk::ImageMenuItem::ImageMenuItem | ( | const StockID& | id ) | `[explicit]`

## Member Function Documentation

bool Gtk::ImageMenuItem::get_always_show_image | ( | ) | const

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

Since gtkmm 2.16:

Returns:
  `true` if the menu item will always show the image.

Widget* Gtk::ImageMenuItem::get_image | ( | ) |

Gets the widget that is currently set as the image of image_menu_item.

See set_image().

Returns:
  The widget set as image of image_menu_item.

const Widget* Gtk::ImageMenuItem::get_image | ( | ) | const

Gets the widget that is currently set as the image of image_menu_item.

See set_image().

Returns:
  The widget set as image of image_menu_item.

bool Gtk::ImageMenuItem::get_use_stock | ( | ) | const

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

Since gtkmm 2.16:

Returns:
  `true` if the label set in the menuitem is used as a stock id to select the stock item for the item.

GtkImageMenuItem* Gtk::ImageMenuItem::gobj | ( | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::MenuItem.

const GtkImageMenuItem* Gtk::ImageMenuItem::gobj | ( | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::MenuItem.

Glib::PropertyProxy_WriteOnly< Glib::RefPtr<AccelGroup> > Gtk::ImageMenuItem::property_accel_group | ( | ) |

The Accel Group to use for stock accelerator keys.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::ImageMenuItem::property_always_show_image | ( | ) |

Whether the image will always be shown.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::ImageMenuItem::property_always_show_image | ( | ) | const

Whether the image will always be shown.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Widget*> Gtk::ImageMenuItem::property_image | ( | ) |

Child widget to appear next to the menu text.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Widget*> Gtk::ImageMenuItem::property_image | ( | ) | const

Child widget to appear next to the menu text.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::ImageMenuItem::property_use_stock | ( | ) |

Whether to use the label text to create a stock menu item.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::ImageMenuItem::property_use_stock | ( | ) | const

Whether to use the label text to create a stock menu item.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::ImageMenuItem::set_accel_group | ( | const Glib::RefPtr< AccelGroup >& | 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 set_use_stock() and Gtk::MenuItem::set_label() with a valid stock item first).

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

Since gtkmm 2.16:

Parameters:

  accel_group | The Gtk::AccelGroup.

void Gtk::ImageMenuItem::set_always_show_image | ( | bool | always_show = `true` ) |

If `true`, the menu item will ignore the Gtk::Settings: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.

Since gtkmm 2.16:

Parameters:

  always_show | `true` if the menuitem should always show the image.

void Gtk::ImageMenuItem::set_image | ( | Widget& | 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.

Parameters:

  image | A widget to set as the image for the menu item.

void Gtk::ImageMenuItem::set_use_stock | ( | bool | use_stock = `true` ) |

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

Since gtkmm 2.16:

Parameters:

  use_stock | `true` if the menuitem should use a stock item.

## Friends And Related Function Documentation

Gtk::ImageMenuItem* wrap | ( | GtkImageMenuItem * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/imagemenuitem.h