Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::ImageMenuItem Class Reference

A GtkImageMenuItem C++ wrapper class. More...

`#include <xfc/gtk/imagemenuitem.hh>`

Inheritance diagram for Xfc::Gtk::ImageMenuItem:

List of all members.

## Public Member Functions

Constructors

- ImageMenuItem ()
    Construct a new ImageMenuItem.
- ImageMenuItem (const String &label, bool use_underline=false)
    Constructs a new ImageMenuItem containing a label.
- ImageMenuItem (Widget &image, const String &label, bool use_underline=false)
    Constructs a new ImageMenuItem containing an image and a label.
- ImageMenuItem (Widget &image, const String &label, Menu &submenu, bool use_underline=false)
    Constructs a new ImageMenuItem that displays a submenu.
- ImageMenuItem (const StockId &stock_id, AccelGroup *accel_group=0)
    Create a new ImageMenuItem containing the image and text from a stock item.
- virtual ~ImageMenuItem ()
    Destructor.

Accessors

- GtkImageMenuItem * gtk_image_menu_item () const
    Get a pointer to the GtkImageMenuItem structure.
- operator GtkImageMenuItem * () const
    Conversion operator; safely converts an ImageMenuItem to a GtkImageMenuItem pointer.
- Widget * get_image () const
    Gets the widget that is currently set as the image of ImageMenuItem (see set_image()).

Methods

- void set_image (Widget &image)
    Sets the image of ImageMenuItem to the given widget.
- void set_image (const StockId &stock_id)
    Sets the image of ImageMenuItem to the given stock icon.

## Protected Member Functions

Constructors

- ImageMenuItem (GtkImageMenuItem *menu_item, bool owns_reference=false)
    Construct a new ImageMenuItem from an existing GtkImageMenuItem.

## Detailed Description

A GtkImageMenuItem C++ wrapper class.

ImageMenuItem is a MenuItem widget that displays an image at the left side of the menu item text.

## Constructor & Destructor Documentation

Xfc::Gtk::ImageMenuItem::ImageMenuItem | ( | GtkImageMenuItem * | menu_item,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new ImageMenuItem from an existing GtkImageMenuItem.

Parameters:

  | menu_item | A pointer to a GtkImageMenuItem.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The menu_item can be a newly created GtkImageMenuItem or an existing GtkImageMenuItem (see G::Object::Object).

Xfc::Gtk::ImageMenuItem::ImageMenuItem | ( | const String & | label,
|  | bool | use_underline = `false`
| ) | `[explicit]`

Constructs a new ImageMenuItem containing a label.

Parameters:

  | label | The text of the menu item.
  | use_underline | Set true if label contains a mnemonic character.

If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the menu item.

Xfc::Gtk::ImageMenuItem::ImageMenuItem | ( | Widget & | image,
|  | const String & | label,
|  | bool | use_underline = `false`
| ) |

Constructs a new ImageMenuItem containing an image and a label.

Parameters:

  | image | A widget to set as the image for the menu item.
  | label | The text of the menu item.
  | use_underline | Set true if label contains a mnemonic character.

If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the menu item.

Xfc::Gtk::ImageMenuItem::ImageMenuItem | ( | Widget & | image,
|  | const String & | label,
|  | Menu & | submenu,
|  | bool | use_underline = `false`
| ) |

Constructs a new ImageMenuItem that displays a submenu.

Parameters:

  | image | A widget to set as the image for the menu item.
  | label | The text of the menu item.
  | submenu | The submenu under this menu item.
  | use_underline | Set true if label contains a mnemonic character.

If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the menu item.

Xfc::Gtk::ImageMenuItem::ImageMenuItem | ( | const StockId & | stock_id,
|  | AccelGroup * | accel_group = `0`
| ) | `[explicit]`

Create a new ImageMenuItem containing the image and text from a stock item.

Parameters:

  | stock_id | The ID of the stock item.
  | accel_group | The AccelGroup to add the menu items accelerator to, or null.

Some stock ids have preprocessor macros like Gtk::StockId::OK and Gtk::StockId::APPLY. If you want this menu item to have changeable accelerators, then pass in null for accel_group and call Gtk::MenuItem::set_accel_path() with an appropriate path for the menu item, then use Gtk::Stock::lookup() too look up the standard accelerator for the stock item and if one is found, call Gtk::AccelMap::add_entry() to register it.

## Member Function Documentation

void Xfc::Gtk::ImageMenuItem::set_image | ( | const StockId & | stock_id | ) |

Sets the image of ImageMenuItem to the given stock icon.

Parameters:

  | stock_id | The ID of the stock icon to set as the image for the menu item.

void Xfc::Gtk::ImageMenuItem::set_image | ( | Widget & | image | ) |

Sets the image of ImageMenuItem to the given widget.

Parameters:

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

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

- imagemenuitem.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3