Main Page Widgets Namespaces Book

# Gtk::Action Class Reference

Inheritance diagram for Gtk::Action:

[legend]
List of all members.

## Public Types

typedef sigc::slot<void> | SlotActivate
| For instance, void on_activate();.

## Public Member Functions

void | activate ()
| Emits the "activate" signal on the specified action, if it isn't insensitive.
void | connect_accelerator ()
| Installs the accelerator for action if action has an accel path and group.
void | connect_proxy (Widget& proxy)
| Connects a widget to an action object as a proxy.
Image* | create_icon (IconSize icon_size)
| This function is intended for use by action implementations to create icons displayed in the proxy widgets.
MenuItem* | create_menu_item ()
| Creates a menu item widget that proxies for the given action.
ToolItem* | create_tool_item ()
| Creates a toolbar item widget that proxies for the given action.
void | disconnect_accelerator ()
| Undoes the effect of one call to connect_accelerator().
void | disconnect_proxy (Widget& proxy)
| Disconnects a proxy widget from an action.
Glib::ustring | get_accel_path () const
| Returns the accel path for this action.
Glib::ustring | get_name () const
| Returns the name of the action.
Glib::SListHandle<const Widget*> | get_proxies () const
| Returns the proxy widgets for an action.
Glib::SListHandle<Widget*> | get_proxies ()
| Returns the proxy widgets for an action.
bool | get_sensitive () const
| Returns whether the action itself is sensitive.
bool | get_visible () const
| Returns whether the action itself is visible.
const GtkAction* | gobj () const
| Provides access to the underlying C GObject.
GtkAction* | gobj ()
| Provides access to the underlying C GObject.
GtkAction* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | is_sensitive () const
| Returns whether the action is effectively sensitive.
bool | is_visible () const
| Returns whether the action is effectively visible.
Glib::PropertyProxy_ReadOnly< bool > | property_hide_if_empty () const
| When TRUE.
Glib::PropertyProxy<bool> | property_hide_if_empty ()
| When TRUE.
Glib::PropertyProxy_ReadOnly< bool > | property_is_important () const
| Whether the action is considered important.
Glib::PropertyProxy<bool> | property_is_important ()
| Whether the action is considered important.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_label () const
| The label used for menu items and buttons that activate this action.
Glib::PropertyProxy<Glib::ustring> | property_label ()
| The label used for menu items and buttons that activate this action.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| A unique name for the action.
Glib::PropertyProxy_ReadOnly< bool > | property_sensitive () const
| Whether the action is enabled.
Glib::PropertyProxy<bool> | property_sensitive ()
| Whether the action is enabled.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_short_label () const
| A shorter label that may be used on toolbar buttons.
Glib::PropertyProxy<Glib::ustring> | property_short_label ()
| A shorter label that may be used on toolbar buttons.
Glib::PropertyProxy_ReadOnly< StockID > | property_stock_id () const
| The stock icon displayed in widgets representing this action.
Glib::PropertyProxy<StockID> | property_stock_id ()
| The stock icon displayed in widgets representing this action.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_tooltip () const
| A tooltip for this action.
Glib::PropertyProxy<Glib::ustring> | property_tooltip ()
| A tooltip for this action.
Glib::PropertyProxy_ReadOnly< bool > | property_visible () const
| Whether the action is visible.
Glib::PropertyProxy<bool> | property_visible ()
| Whether the action is visible.
Glib::PropertyProxy_ReadOnly< bool > | property_visible_horizontal () const
| Whether the toolbar item is visible when the toolbar is in a horizontal orientation.
Glib::PropertyProxy<bool> | property_visible_horizontal ()
| Whether the toolbar item is visible when the toolbar is in a horizontal orientation.
Glib::PropertyProxy_ReadOnly< bool > | property_visible_vertical () const
| Whether the toolbar item is visible when the toolbar is in a vertical orientation.
Glib::PropertyProxy<bool> | property_visible_vertical ()
| Whether the toolbar item is visible when the toolbar is in a vertical orientation.
void | set_accel_group (const Glib::RefPtr<AccelGroup>& accel_group)
| Sets the Gtk::AccelGroup in which the accelerator for this action will be installed.
void | set_accel_path (const Glib::ustring& accel_path)
| Sets the accel path for this action.
void | set_sensitive (bool sensitive=true)
| Sets the sensitive property of the action to sensitive .
void | set_tooltip (const Glib::ustring& tooltip)
void | set_visible (bool visible=true)
| Sets the visible property of the action to visible .
Glib::SignalProxy0<void> | signal_activate ()
| The "activate" signal is emitted when the action is activated.
virtual | ~Action ()

## Static Public Member Functions

static Glib::RefPtr<Action> | create (const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring())
static Glib::RefPtr<Action> | create (const Glib::ustring& name, const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring())
static Glib::RefPtr<Action> | create ()

## Protected Member Functions

| Action (const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring())
| Action ()
void | block_activate_from (Widget& proxy)
| Disables calls to the activate() function by signals on the given proxy widget.
virtual void | connect_proxy_vfunc (Widget* proxy)
virtual Widget* | create_menu_item_vfunc ()
virtual Widget* | create_tool_item_vfunc ()
virtual void | disconnect_proxy_vfunc (Widget* proxy)
virtual void | on_activate ()
void | unblock_activate_from (Widget& proxy)
| Re-enables calls to the activate() function by signals on the given proxy widget.

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gtk::Action> | wrap (GtkAction* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Member Typedef Documentation

typedef sigc::slot<void> Gtk::Action::SlotActivate

For instance, void on_activate();.

## Constructor & Destructor Documentation

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

Gtk::Action::Action | ( |  | ) | `[protected]`

Gtk::Action::Action | ( | const Glib::ustring & | name,
|  | const StockID& | stock_id,
|  | const Glib::ustring & | label = `Glib::ustring()`,
|  | const Glib::ustring & | tooltip = `Glib::ustring()` |
| ) |  |  | `[explicit, protected]`

## Member Function Documentation

void Gtk::Action::activate | ( |  | ) |

Emits the "activate" signal on the specified action, if it isn't insensitive.

This gets called by the proxy widgets when they get activated.

It can also be used to manually activate an action.

Since gtkmm 2.4:

void Gtk::Action::block_activate_from | ( | Widget& | proxy | ) | `[protected]`

Disables calls to the activate() function by signals on the given proxy widget.

This is used to break notification loops for things like check or radio actions.

This function is intended for use by action implementations.

Since gtkmm 2.4:

Parameters:

  | proxy | A proxy widget.

void Gtk::Action::connect_accelerator | ( |  | ) |

Installs the accelerator for action if action has an accel path and group.

See set_accel_path() and set_accel_group()

Since multiple proxies may independently trigger the installation of the accelerator, the action counts the number of times this function has been called and doesn't remove the accelerator until disconnect_accelerator() has been called as many times.

Since gtkmm 2.4:

void Gtk::Action::connect_proxy | ( | Widget& | proxy | ) |

Connects a widget to an action object as a proxy.

Synchronises various properties of the action with the widget (such as label text, icon, tooltip, etc), and attaches a callback so that the action gets activated when the proxy widget does.

If the widget is already connected to an action, it is disconnected first.

Since gtkmm 2.4:

Parameters:

  | proxy | The proxy widget.

virtual void Gtk::Action::connect_proxy_vfunc | ( | Widget* | proxy | ) | `[protected, virtual]`

static Glib::RefPtr<Action> Gtk::Action::create | ( | const Glib::ustring & | name,
|  | const Gtk::StockID& | stock_id,
|  | const Glib::ustring & | label = `Glib::ustring()`,
|  | const Glib::ustring & | tooltip = `Glib::ustring()` |
| ) |  |  | `[static]`

static Glib::RefPtr<Action> Gtk::Action::create | ( | const Glib::ustring & | name,
|  | const Glib::ustring & | label = `Glib::ustring()`,
|  | const Glib::ustring & | tooltip = `Glib::ustring()` |
| ) |  |  | `[static]`

static Glib::RefPtr<Action> Gtk::Action::create | ( |  | ) | `[static]`

Reimplemented in Gtk::RadioAction, and Gtk::ToggleAction.

Image* Gtk::Action::create_icon | ( | IconSize | icon_size | ) |

This function is intended for use by action implementations to create icons displayed in the proxy widgets.

Parameters:

  | icon_size | The size of the icon that should be created.

Returns:
  A widget that displays the icon for this action.

Since gtkmm 2.4:

MenuItem* Gtk::Action::create_menu_item | ( |  | ) |

Creates a menu item widget that proxies for the given action.

Returns:
  A menu item connected to the action.

Since gtkmm 2.4:

virtual Widget* Gtk::Action::create_menu_item_vfunc | ( |  | ) | `[protected, virtual]`

ToolItem* Gtk::Action::create_tool_item | ( |  | ) |

Creates a toolbar item widget that proxies for the given action.

Returns:
  A toolbar item connected to the action.

Since gtkmm 2.4:

virtual Widget* Gtk::Action::create_tool_item_vfunc | ( |  | ) | `[protected, virtual]`

void Gtk::Action::disconnect_accelerator | ( |  | ) |

Undoes the effect of one call to connect_accelerator().

Since gtkmm 2.4:

void Gtk::Action::disconnect_proxy | ( | Widget& | proxy | ) |

Disconnects a proxy widget from an action.

Does not destroy the widget, however.

Since gtkmm 2.4:

Parameters:

  | proxy | The proxy widget.

virtual void Gtk::Action::disconnect_proxy_vfunc | ( | Widget* | proxy | ) | `[protected, virtual]`

Glib::ustring Gtk::Action::get_accel_path | ( |  | ) | const

Returns the accel path for this action.

Since gtkmm 2.6:

Returns:
  The accel path for this action, or `0` if none is set. The returned string is owned by GTK+ and must not be freed or modified.

Glib::ustring Gtk::Action::get_name | ( |  | ) | const

Returns the name of the action.

Returns:
  The name of the action. The string belongs to GTK+ and should not be freed.

Since gtkmm 2.4:

Glib::SListHandle<const Widget*> Gtk::Action::get_proxies | ( |  | ) | const

Returns the proxy widgets for an action.

Returns:
  A G::SList of proxy widgets. The list is owned by the action and must not be modified.

Since gtkmm 2.4:

Glib::SListHandle<Widget*> Gtk::Action::get_proxies | ( |  | ) |

Returns the proxy widgets for an action.

Returns:
  A G::SList of proxy widgets. The list is owned by the action and must not be modified.

Since gtkmm 2.4:

bool Gtk::Action::get_sensitive | ( |  | ) | const

Returns whether the action itself is sensitive.

Note that this doesn't necessarily mean effective sensitivity. See is_sensitive() for that.

Returns:
  `true` if the action itself is sensitive.

Since gtkmm 2.4:

bool Gtk::Action::get_visible | ( |  | ) | const

Returns whether the action itself is visible.

Note that this doesn't necessarily mean effective visibility. See is_sensitive() for that.

Returns:
  `true` if the action itself is visible.

Since gtkmm 2.4:

const GtkAction* Gtk::Action::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

Reimplemented in Gtk::RadioAction, and Gtk::ToggleAction.

GtkAction* Gtk::Action::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

Reimplemented in Gtk::RadioAction, and Gtk::ToggleAction.

GtkAction* Gtk::Action::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented in Gtk::RadioAction, and Gtk::ToggleAction.

bool Gtk::Action::is_sensitive | ( |  | ) | const

Returns whether the action is effectively sensitive.

Returns:
  `true` if the action and its associated action group are both sensitive.

Since gtkmm 2.4:

bool Gtk::Action::is_visible | ( |  | ) | const

Returns whether the action is effectively visible.

Returns:
  `true` if the action and its associated action group are both visible.

Since gtkmm 2.4:

virtual void Gtk::Action::on_activate | ( |  | ) | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<bool> Gtk::Action::property_hide_if_empty | ( |  | ) | const

When TRUE.

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::Action::property_hide_if_empty | ( |  | ) |

When TRUE.

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::Action::property_is_important | ( |  | ) | const

Whether the action is considered important.

When TRUE

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::Action::property_is_important | ( |  | ) |

Whether the action is considered important.

When TRUE

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<Glib::ustring> Gtk::Action::property_label | ( |  | ) | const

The label used for menu items and buttons that activate this action.

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<Glib::ustring> Gtk::Action::property_label | ( |  | ) |

The label used for menu items and buttons that activate this action.

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<Glib::ustring> Gtk::Action::property_name | ( |  | ) | const

A unique name for the action.

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::Action::property_sensitive | ( |  | ) | const

Whether the action is enabled.

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::Action::property_sensitive | ( |  | ) |

Whether the action is enabled.

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<Glib::ustring> Gtk::Action::property_short_label | ( |  | ) | const

A shorter label that may be used on toolbar buttons.

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<Glib::ustring> Gtk::Action::property_short_label | ( |  | ) |

A shorter label that may be used on toolbar buttons.

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<StockID> Gtk::Action::property_stock_id | ( |  | ) | const

The stock icon displayed in widgets representing this action.

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<StockID> Gtk::Action::property_stock_id | ( |  | ) |

The stock icon displayed in widgets representing this action.

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<Glib::ustring> Gtk::Action::property_tooltip | ( |  | ) | const

A tooltip for this action.

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<Glib::ustring> Gtk::Action::property_tooltip | ( |  | ) |

A tooltip for this action.

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::Action::property_visible | ( |  | ) | const

Whether the action is visible.

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::Action::property_visible | ( |  | ) |

Whether the action is visible.

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::Action::property_visible_horizontal | ( |  | ) | const

Whether the toolbar item is visible when the toolbar is in a horizontal orientation.

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::Action::property_visible_horizontal | ( |  | ) |

Whether the toolbar item is visible when the toolbar is in a horizontal orientation.

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::Action::property_visible_vertical | ( |  | ) | const

Whether the toolbar item is visible when the toolbar is in a vertical orientation.

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::Action::property_visible_vertical | ( |  | ) |

Whether the toolbar item is visible when the toolbar is in a vertical orientation.

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::Action::set_accel_group | ( | const Glib::RefPtr<AccelGroup>& | accel_group | ) |

Sets the Gtk::AccelGroup in which the accelerator for this action will be installed.

Since gtkmm 2.4:

Parameters:

  | accel_group | A Gtk::AccelGroup or `0`.

void Gtk::Action::set_accel_path | ( | const Glib::ustring & | accel_path | ) |

Sets the accel path for this action.

All proxy widgets associated with the action will have this accel path, so that their accelerators are consistent.

Since gtkmm 2.4:

Parameters:

  | accel_path | The accelerator path.

void Gtk::Action::set_sensitive | ( | bool | sensitive = `true` | ) |

Sets the sensitive property of the action to sensitive .

Note that this doesn't necessarily mean effective sensitivity. See is_sensitive() for that.

Since gtkmm 2.6:

Parameters:

  | sensitive | `true` to make the action sensitive.

void Gtk::Action::set_tooltip | ( | const Glib::ustring & | tooltip | ) |

void Gtk::Action::set_visible | ( | bool | visible = `true` | ) |

Sets the visible property of the action to visible .

Note that this doesn't necessarily mean effective visibility. See is_visible() for that.

Since gtkmm 2.6:

Parameters:

  | visible | `true` to make the action visible.

Glib::SignalProxy0< void > Gtk::Action::signal_activate | ( |  | ) |

The "activate" signal is emitted when the action is activated.

Prototype:
  `void on_my_activate()`

void Gtk::Action::unblock_activate_from | ( | Widget& | proxy | ) | `[protected]`

Re-enables calls to the activate() function by signals on the given proxy widget.

This undoes the blocking done by block_activate_from().

This function is intended for use by action implementations.

Since gtkmm 2.4:

Parameters:

  | proxy | A proxy widget.

## Friends And Related Function Documentation

Glib::RefPtr<Gtk::Action> wrap | ( | GtkAction * | 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:

- gtk/gtkmm/action.h