logo top
Main Page   Widgets   Namespaces   Book  

Gtk::MenuItem Class Reference
[WidgetsMenu classes]

Inheritance diagram for Gtk::MenuItem:

Inheritance graph
[legend]
List of all members.

Detailed Description

Child item for menus.

Handle highlighting, alignment, events and submenus. As it derives from Gtk::Bin it can hold any valid child widget, altough only a few are really useful.


Public Member Functions

void accelerate (Window& window)
void activate ()
 For widgets that can be "activated" (buttons, menu items, etc.
void deselect ()
bool get_right_justified () const
 Gets whether the menu item appears justified at the right side of the menu bar.
const Menuget_submenu () const
 Gets the submenu underneath this menu item, if any.
Menuget_submenu ()
 Gets the submenu underneath this menu item, if any.
const GtkMenuItem* gobj () const
 Provides access to the underlying C GtkObject.
GtkMenuItem* gobj ()
 Provides access to the underlying C GtkObject.
bool has_submenu () const
 MenuItem (const Glib::ustring& label, bool mnemonic=false)
 Create a menu item with label.
 MenuItem (Widget& widget)
 Create a menu item with widget.
 MenuItem ()
 Create an empty menu item.
void remove_submenu ()
void select ()
void set_accel_path (const Glib::ustring& accel_path)
 Set the accelerator path on 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_accel_map_save() on this).
void set_right_justified (bool right_justified=true)
 Sets whether the menu item appears justified at the right side of a menu bar.
void set_submenu (Menu& submenu)
Glib::SignalProxy0<void> signal_activate ()
Glib::SignalProxy0<void> signal_activate_item ()
Glib::SignalProxy1< void,
int > 
signal_toggle_size_allocate ()
Glib::SignalProxy1< void,
int* > 
signal_toggle_size_request ()
void toggle_size_allocate (int allocation)
void toggle_size_request (int& requisition)
void unset_accel_path ()
virtual ~MenuItem ()

Protected Member Functions

void add_accel_label (const Glib::ustring& label, bool mnemonic=true)
virtual void on_activate ()
virtual void on_activate_item ()
virtual void on_toggle_size_allocate (int allocation)
virtual void on_toggle_size_request (int* requisition)
void set_accel_key (const AccelKey& accel_key)

Friends

class Menu_Helpers::Element

Related Functions

(Note that these are not member functions.)

Gtk::MenuItemwrap (GtkMenuItem* object, bool take_copy=false)


Constructor & Destructor Documentation

virtual Gtk::MenuItem::~MenuItem (  )  [virtual]
 

Gtk::MenuItem::MenuItem (  ) 
 

Create an empty menu item.

Gtk::MenuItem::MenuItem ( Widget widget  )  [explicit]
 

Create a menu item with widget.

Gtk::MenuItem::MenuItem ( const Glib::ustring label,
bool  mnemonic = false
[explicit]
 

Create a menu item with label.


Member Function Documentation

void Gtk::MenuItem::accelerate ( Window window  ) 
 

void Gtk::MenuItem::activate (  ) 
 

For widgets that can be "activated" (buttons, menu items, etc.

) this function activates them. Activation is what happens when you press Enter on a widget during key navigation. If widget isn't activatable, the function returns false.

Returns:
true if the widget was activatable.

Reimplemented from Gtk::Widget.

void Gtk::MenuItem::add_accel_label ( const Glib::ustring label,
bool  mnemonic = true
[protected]
 

void Gtk::MenuItem::deselect (  ) 
 

Reimplemented from Gtk::Item.

bool 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.

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

Gets the submenu underneath this menu item, if any.

See set_submenu().

Returns:
Submenu for this menu item, or 0 if none.

Menu* Gtk::MenuItem::get_submenu (  ) 
 

Gets the submenu underneath this menu item, if any.

See set_submenu().

Returns:
Submenu for this menu item, or 0 if none.

const GtkMenuItem* Gtk::MenuItem::gobj (  )  const [inline]
 

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Item.

Reimplemented in Gtk::CheckMenuItem, Gtk::ImageMenuItem, Gtk::RadioMenuItem, Gtk::SeparatorMenuItem, and Gtk::TearoffMenuItem.

GtkMenuItem* Gtk::MenuItem::gobj (  )  [inline]
 

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Item.

Reimplemented in Gtk::CheckMenuItem, Gtk::ImageMenuItem, Gtk::RadioMenuItem, Gtk::SeparatorMenuItem, and Gtk::TearoffMenuItem.

bool Gtk::MenuItem::has_submenu (  )  const
 

virtual void Gtk::MenuItem::on_activate (  )  [protected, virtual]
 

virtual void Gtk::MenuItem::on_activate_item (  )  [protected, virtual]
 

virtual void Gtk::MenuItem::on_toggle_size_allocate ( int  allocation  )  [protected, virtual]
 

virtual void Gtk::MenuItem::on_toggle_size_request ( int*  requisition  )  [protected, virtual]
 

void Gtk::MenuItem::remove_submenu (  ) 
 

void Gtk::MenuItem::select (  ) 
 

Reimplemented from Gtk::Item.

void Gtk::MenuItem::set_accel_key ( const AccelKey accel_key  )  [protected]
 

void Gtk::MenuItem::set_accel_path ( const Glib::ustring accel_path  ) 
 

Set the accelerator path on 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_accel_map_save() on this).

To setup a default accelerator for this menu item, call gtk_accel_map_add_entry() with the same accel_path . See also gtk_accel_map_add_entry() on the specifics of accelerator paths, and set_accel_path() for a more convenient variant of this function.

This function 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 on the parent menu with set_accel_group() for this to work.

Parameters:
accel_path Accelerator path, corresponding to this menu item's functionality.

void Gtk::MenuItem::set_right_justified ( bool  right_justified = true  ) 
 

Sets whether the menu item appears justified at the right side of 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.)

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

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

Glib::SignalProxy0<void> Gtk::MenuItem::signal_activate (  ) 
 

Glib::SignalProxy0<void> Gtk::MenuItem::signal_activate_item (  ) 
 

Glib::SignalProxy1<void,int> Gtk::MenuItem::signal_toggle_size_allocate (  ) 
 

Glib::SignalProxy1<void,int*> Gtk::MenuItem::signal_toggle_size_request (  ) 
 

void Gtk::MenuItem::toggle_size_allocate ( int  allocation  ) 
 

void Gtk::MenuItem::toggle_size_request ( int&  requisition  ) 
 

void Gtk::MenuItem::unset_accel_path (  ) 
 


Friends And Related Function Documentation

friend class Menu_Helpers::Element [friend]
 

Gtk::MenuItem* wrap ( GtkMenuItem*  object,
bool  take_copy = false
[related]
 

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:
Generated for gtkmm 2.4 by Doxygen 1.4.6 © 1997-2001