glibmm 2.88.0

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gio::ActionMap Class Reference

ActionMap - Interface for action containers. More...

`#include <giomm/actionmap.h>`

Inheritance diagram for Gio::ActionMap:
[legend]

## Public Types
using | ActivateSlot = sigc::slot< void()>
| A Slot to be called when an action has been activated, without passing a parameter to the slot.
using | ActivateWithParameterSlot = sigc::slot< void(const Glib::VariantBase &)>
| A Slot to be called when an action has been activated, passing a parameter of a specified type.
using | ActivateWithStringParameterSlot = sigc::slot< void(const Glib::ustring &)>
| A Slot to be called when an action has been activated.
using | ActivateWithIntParameterSlot = sigc::slot< void(int)>
| A Slot to be called when an action has been activated.
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions
| ActionMap (ActionMap &&src) noexcept
ActionMap & | operator= (ActionMap &&src) noexcept
| ~ActionMap () noexcept override
GActionMap * | gobj ()
| Provides access to the underlying C GObject.
const GActionMap * | gobj () const
| Provides access to the underlying C GObject.
void | add_action (const Glib::RefPtr< Action > &action)
| Adds an action to the action_map.
void | remove_action (const Glib::ustring &action_name)
| Removes the named action from the action map.
Glib::RefPtr< Action > | lookup_action (const Glib::ustring &action_name)
| Looks up the action with the name action_name in action_map.
Glib::RefPtr< const Action > | lookup_action (const Glib::ustring &action_name) const
| Looks up the action with the name action_name in action_map.
Glib::RefPtr< SimpleAction > | add_action (const Glib::ustring & name)
| A convenience method for creating a SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action (const Glib::ustring & name, const ActivateSlot & slot)
| A convenience method for creating a SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_with_parameter (const Glib::ustring & name, const Glib::VariantType &parameter_type, const ActivateWithParameterSlot & slot)
| A convenience method for creating a SimpleAction instance, which when activated will call a slot receiving a given type of parameter, and adding that SimpleAction to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_bool (const Glib::ustring & name, bool state=false)
| A convenience method for creating a boolean-stateful SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_bool (const Glib::ustring & name, const ActivateSlot & slot, bool state=false)
| A convenience method for creating a boolean-stateful (toggle) SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_radio_string (const Glib::ustring & name, const Glib::ustring & state)
| A convenience method for creating a string-based radio SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_radio_string (const Glib::ustring & name, const ActivateWithStringParameterSlot & slot, const Glib::ustring & state)
| A convenience method for creating a string-based radio SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_radio_integer (const Glib::ustring & name, gint32 state)
| A convenience method for creating an integer-based radio SimpleAction instance and adding it to the ActionMap.
Glib::RefPtr< SimpleAction > | add_action_radio_integer (const Glib::ustring & name, const ActivateWithIntParameterSlot & slot, gint32 state)
| A convenience method for creating an integer-based radio SimpleAction instance and adding it to the ActionMap.
Public Member Functions inherited from Glib::Interface
| Interface ()
| A Default constructor.
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Called by constructors of derived classes.
| Interface (GObject *castitem)
| Called by constructors of derived classes.
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
| You probably want to use a specific property_*() accessor method instead.
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType >
void | set_property (const Glib::ustring & property_name, const PropertyType & value)
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType >
void | get_property (const Glib::ustring & property_name, PropertyType & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType >
PropertyType | get_property (const Glib::ustring & property_name) const
| You probably want to use a specific property_*() accessor method instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> & slot)
| You can use the signal_changed() signal of the property proxy instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> && slot)
| You can use the signal_changed() signal of the property proxy instead.
void | freeze_notify ()
| Increases the freeze count on object.
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify().
virtual void | reference () const
| Increment the reference count for this object.
virtual void | unreference () const
| Decrement the reference count for this object.
GObject * | gobj ()
| Provides access to the underlying C GObject.
const GObject * | gobj () const
| Provides access to the underlying C GObject.
GObject * | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access.
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
| ActionMap ()
| You should derive from this class to use it.
virtual Glib::RefPtr< Action > | lookup_action_vfunc (const Glib::ustring & name) const
virtual void | add_action_vfunc (const Glib::RefPtr< Action > &action) const
virtual void | remove_action_vfunc (const Glib::ustring & name)
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
| ObjectBase (const char *custom_type_name)
| A derived constructor always overrides this choice.
| ObjectBase (const std::type_info &custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually.
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gio::ActionMap > | wrap (GActionMap *object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

ActionMap - Interface for action containers.

The ActionMap interface is implemented by ActionGroup implementations that operate by containing a number of named Action instances, such as SimpleActionGroup.

One useful application of this interface is to map the names of actions from various action groups to unique, prefixed names (e.g. by prepending "app." or "win."). This is the motivation for the 'Map' part of the interface name.

Since glibmm 2.32:

## Member Typedef Documentation

## ◆ ActivateSlot

using Gio::ActionMap::ActivateSlot = sigc::slot<void()>

A Slot to be called when an action has been activated, without passing a parameter to the slot.

See add_action() and add_action_bool().

For instance, void on_slot_activated();

## ◆ ActivateWithIntParameterSlot

using Gio::ActionMap::ActivateWithIntParameterSlot = sigc::slot<void(int)>

A Slot to be called when an action has been activated.

See add_action_radio_integer().

For instance, void on_slot_activated(int parameter);

## ◆ ActivateWithParameterSlot

using Gio::ActionMap::ActivateWithParameterSlot = sigc::slot<void(const Glib::VariantBase&)>

A Slot to be called when an action has been activated, passing a parameter of a specified type.

See add_action_with_parameter().

For instance, void on_slot_activated(const Glib::VariantBase& parameter);

## ◆ ActivateWithStringParameterSlot

using Gio::ActionMap::ActivateWithStringParameterSlot = sigc::slot<void(const Glib::ustring&)>

A Slot to be called when an action has been activated.

See add_action_radio_string().

For instance, void on_slot_activated(const Glib::ustring& parameter);

## Constructor & Destructor Documentation

## ◆ ActionMap() [1/2]

Gio::ActionMap::ActionMap | ( |  | ) |
| protected

You should derive from this class to use it.

## ◆ ActionMap() [2/2]

Gio::ActionMap::ActionMap | ( | ActionMap && | src | ) |
| noexcept

## ◆ ~ActionMap()

Gio::ActionMap::~ActionMap | ( |  | ) |
| override noexcept

## Member Function Documentation

## ◆ add_action() [1/3]

void Gio::ActionMap::add_action | ( | const Glib::RefPtr< Action > & | action | ) |

Adds an action to the action_map.

If the action map already contains an action with the same name as action then the old action is dropped from the action map.

The action map takes its own reference on action.

Since glibmm 2.32:

Parameters

  action | A Gio::Action.

## ◆ add_action() [2/3]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action | ( | const Glib::ustring & | name | ) |

A convenience method for creating a SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.

Returns
  The Action.

## ◆ add_action() [3/3]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action | ( | const Glib::ustring & | name,
|  | const ActivateSlot & | slot
| ) |  |

A convenience method for creating a SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  slot | The callback method to be called when the action is activated.

Returns
  The Action.

## ◆ add_action_bool() [1/2]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_bool | ( | const Glib::ustring & | name,
|  | bool | state = `false`
| ) |  |

A convenience method for creating a boolean-stateful SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  state | The initial state.

Returns
  The Action.

## ◆ add_action_bool() [2/2]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_bool | ( | const Glib::ustring & | name,
|  | const ActivateSlot & | slot,
|  | bool | state = `false`
| ) |  |

A convenience method for creating a boolean-stateful (toggle) SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  slot | The callback method to be called when the action is activated.
  state | The initial state.

Returns
  The Action.

## ◆ add_action_radio_integer() [1/2]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_radio_integer | ( | const Glib::ustring & | name,
|  | const ActivateWithIntParameterSlot & | slot,
|  | gint32 | state
| ) |  |

A convenience method for creating an integer-based radio SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  slot | The callback method to be called when the action is activated.
  state | The initial state.

Returns
  The Action.

## ◆ add_action_radio_integer() [2/2]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_radio_integer | ( | const Glib::ustring & | name,
|  | gint32 | state
| ) |  |

A convenience method for creating an integer-based radio SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  state | The initial state.

Returns
  The Action.

## ◆ add_action_radio_string() [1/2]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_radio_string | ( | const Glib::ustring & | name,
|  | const ActivateWithStringParameterSlot & | slot,
|  | const Glib::ustring & | state
| ) |  |

A convenience method for creating a string-based radio SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  slot | The callback method to be called when the action is activated.
  state | The initial state.

Returns
  The Action.

## ◆ add_action_radio_string() [2/2]

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_radio_string | ( | const Glib::ustring & | name,
|  | const Glib::ustring & | state
| ) |  |

A convenience method for creating a string-based radio SimpleAction instance and adding it to the ActionMap.

Parameters

  name | The name of the Action.
  state | The initial state.

Returns
  The Action.

## ◆ add_action_vfunc()

virtual void Gio::ActionMap::add_action_vfunc | ( | const Glib::RefPtr< Action > & | action | ) | const
| protected virtual

## ◆ add_action_with_parameter()

Glib::RefPtr< SimpleAction > Gio::ActionMap::add_action_with_parameter | ( | const Glib::ustring & | name,
|  | const Glib::VariantType & | parameter_type,
|  | const ActivateWithParameterSlot & | slot
| ) |  |

A convenience method for creating a SimpleAction instance, which when activated will call a slot receiving a given type of parameter, and adding that SimpleAction to the ActionMap.

Parameters

  name | The name of the Action.
  parameter_type | The type of parameter to be passed to the slot.
  slot | The callback method to be called when the action is activated.

Returns
  The Action.

## ◆ add_interface()

static void Gio::ActionMap::add_interface | ( | GType | gtype_implementer | ) |
| static

## ◆ get_type()

static GType Gio::ActionMap::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GActionMap * Gio::ActionMap::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GActionMap * Gio::ActionMap::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ lookup_action() [1/2]

Glib::RefPtr< Action > Gio::ActionMap::lookup_action | ( | const Glib::ustring & | action_name | ) |

Looks up the action with the name action_name in action_map.

If no such action exists, returns `nullptr`.

Since glibmm 2.32:

Parameters

  action_name | The name of an action.

Returns
  A Gio::Action.

## ◆ lookup_action() [2/2]

Glib::RefPtr< const Action > Gio::ActionMap::lookup_action | ( | const Glib::ustring & | action_name | ) | const

Looks up the action with the name action_name in action_map.

If no such action exists, returns `nullptr`.

Since glibmm 2.32:

Parameters

  action_name | The name of an action.

Returns
  A Gio::Action.

## ◆ lookup_action_vfunc()

virtual Glib::RefPtr< Action > Gio::ActionMap::lookup_action_vfunc | ( | const Glib::ustring & | name | ) | const
| protected virtual

## ◆ operator=()

ActionMap & Gio::ActionMap::operator= | ( | ActionMap && | src | ) |
| noexcept

## ◆ remove_action()

void Gio::ActionMap::remove_action | ( | const Glib::ustring & | action_name | ) |

Removes the named action from the action map.

If no action of this name is in the map then nothing happens.

Since glibmm 2.32:

Parameters

  action_name | The name of the action.

## ◆ remove_action_vfunc()

virtual void Gio::ActionMap::remove_action_vfunc | ( | const Glib::ustring & | name | ) |
| protected virtual

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gio::ActionMap > wrap | ( | GActionMap * | 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.