Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::MenuItem Class Reference

A GtkMenuItem C++ wrapper class. More...

#include <xfc/gtk/menuitem.hh>

Inheritance diagram for Xfc::Gtk::MenuItem:

Xfc::Gtk::Item Xfc::Gtk::Bin Xfc::Gtk::Container Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable Xfc::Gtk::CheckMenuItem Xfc::Gtk::ImageMenuItem Xfc::Gtk::SeparatorMenuItem Xfc::Gtk::TearoffMenuItem Xfc::Gtk::RadioMenuItem List of all members.

Signal Prototypes

Public Member Functions

Accessors
Methods
Signal Proxies

Protected Member Functions

Methods

Detailed Description

A GtkMenuItem C++ wrapper class.

The MenuItem widget and its derived widgets are the only valid child widgets for menus. Their function is to correctly handle highlighting, alignment, events and submenus. As MenuItem derives from Bin it can hold any valid child widget, although only a few are really useful.

See also: the MenuItem and Menu HOWTOs and example.


Constructor & Destructor Documentation

Xfc::Gtk::MenuItem::MenuItem ( GtkMenuItem *  menu_item,
bool  owns_reference = false 
) [explicit, protected]

Construct a new MenuItem from an existing GtkMenuItem.

Parameters:
menu_item A pointer to a GtkMenuItem.
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 GtkMenuItem or an existing GtkMenuItem (see G::Object::Object).

Xfc::Gtk::MenuItem::MenuItem ( const String label,
bool  use_underline = false 
) [explicit]

Construct a new MenuItem whose child is a Label.

Parameters:
label The text for the label.
use_underline Set true if there is an underscore in front of the mnemonic character.

Xfc::Gtk::MenuItem::MenuItem ( const String label,
Menu submenu,
bool  use_underline = false 
)

Construct a new MenuItem that pops up a submenu.

Parameters:
label The text for the label.
submenu The submenu.
use_underline Set true if there is an underscore in front of the mnemonic character.

Xfc::Gtk::MenuItem::MenuItem ( GtkMenuItem *  menu_item,
bool  owns_reference = false 
) [explicit, protected]

Construct a new MenuItem from an existing GtkMenuItem.

Parameters:
menu_item A pointer to a GtkMenuItem.
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 GtkMenuItem or an existing GtkMenuItem (see G::Object::Object).

Xfc::Gtk::MenuItem::MenuItem ( const String label,
bool  use_underline = false 
) [explicit]

Construct a new MenuItem whose child is a Label.

Parameters:
label The text for the label.
use_underline Set true if there is an underscore in front of the mnemonic character.

Xfc::Gtk::MenuItem::MenuItem ( const String label,
Menu submenu,
bool  use_underline = false 
)

Construct a new MenuItem that pops up a submenu.

Parameters:
label The text for the label.
submenu The submenu.
use_underline Set true if there is an underscore in front of the mnemonic character.


Member Function Documentation

void Xfc::Gtk::MenuItem::add_label ( const String label,
bool  use_underline 
) [protected]

Adds a label widget to an empty menu item with the text label.

Parameters:
label The text for the label.
use_underline Set true if there is an underscore in front of the mnemonic character.
This method is used by the derived menu item widgets such as CheckMenuItem and ImageMenuItem. You probably wont find much use for it.

bool Xfc::Gtk::MenuItem::get_right_justified (  )  const

Gets whether the menu item appears justified at the right side of the menu bar.

Returns:
true if the menu item will appear at the far right if added to a menu bar.

Menu* Xfc::Gtk::MenuItem::get_submenu (  )  const

Gets the submenu underneath this menu item, if any (see set_submenu()).

Returns:
The submenu for this menu item, or null if there is none.

void Xfc::Gtk::MenuItem::set_label ( const String label,
bool  use_underline = false 
)

Sets the label text to label.

Parameters:
label The text for the label.
use_underline Set true if there is an underscore in front of the mnemonic character.
This method can be used to dynamically change the menu item text. If the menu item is empty, a label widget is added with the text label.

void Xfc::Gtk::MenuItem::set_submenu ( Menu submenu  ) 

Sets the widget submenu, or changes it.

Parameters:
submenu The submenu.

void Xfc::Gtk::MenuItem::set_right_justified ( bool  right_justified  ) 

Sets whether the menu item appears justified at the right side of a menu bar.

Parameters:
right_justified If true the menu item will appear at the far right if added to a menu bar. This was traditionally done for "Help" menu items, but is now considered a bad idea. If the widget layout is reversed for a right-to-left language like Hebrew or Arabic, right-justified-menu-items appear at the left.

void Xfc::Gtk::MenuItem::set_accel_path ( const String accel_path  ) 

Set the accelerator path on the menu item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage (see Gtk::AccelMap::save() on this).

Parameters:
accel_path The accelerator path, corresponding to this menu item's functionality, or null to unset the current path.
To setup a default accelerator for this menu item, call Gtk::AccelMap::add_entry() with the same accel_path. See also Gtk::AccelMap::add_entry() on the specifics of accelerator paths, and Gtk::Menu::set_accel_path() for a more convenient variant of this function.

This Method is basically a convenience wrapper that handles calling Gtk::Widget::set_accel_path() with the appropriate accelerator group for the menu item. Note that you do need to set an accelerator group on the parent menu at construction or later with Gtk::Menu::set_accel_group() for this to work.

const ActivateItemSignalProxy Xfc::Gtk::MenuItem::signal_activate_item (  ) 

Connect to the activate_item_signal; emitted when the item is activated, but also if the menu item has a submenu.

For normal applications, the relevant signal is "activate".


Member Data Documentation

const ActivateSignalType Xfc::Gtk::MenuItem::activate_signal [static, protected]

Activate signal (see signal_activate()).

Calls a slot with the signature:

< void function();
<

const ActivateItemSignalType Xfc::Gtk::MenuItem::activate_item_signal [static, protected]

Activate item signal (see signal_activate_item()).

Calls a slot with the signature:

< void function();
<

const ToggleSizeRequestSignalType Xfc::Gtk::MenuItem::toggle_size_request_signal [static, protected]

Toggle size request signal (see signal_toggle_size_request()).

Calls a slot with the signature:

< void function(int *requisition);
< // requisition: The return location for the size of the toggle.
<

const ToggleSizeAllocateSignalType Xfc::Gtk::MenuItem::toggle_size_allocate_signal [static, protected]

Toggle size allocate signal (see signal_toggle_size_allocate()).

Calls a slot with the signature:

< void function(int allocate);
< // allocate: The size allocated to the toggle.
<


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3