glibmm 2.31.16
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Gio::ActionGroup Class Reference

ActionGroup - a group of actions. More...

#include <giomm/actiongroup.h>

Inheritance diagram for Gio::ActionGroup:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~ActionGroup ()
GActionGroup* gobj ()
 Provides access to the underlying C GObject.
const GActionGroup* gobj () const
 Provides access to the underlying C GObject.
bool has_action (const Glib::ustring& action_name) const
 Checks if the named action exists within action_group.
std::vector< Glib::ustringlist_actions () const
 Lists the actions contained within action_group.
bool get_action_enabled (const Glib::ustring& action_name) const
 Checks if the named action within action_group is currently enabled.
Glib::VariantType get_action_parameter_type (const Glib::ustring& action_name) const
 Queries the type of the parameter that must be given when activating the named action within action_group.
Glib::VariantType get_action_state_type (const Glib::ustring& action_name) const
 Queries the type of the state of the named action within action_group.
Glib::VariantContainerBase get_action_state_hint (const Glib::ustring& action_name) const
 Requests a hint about the valid range of values for the state of the named action within action_group.
Glib::VariantBase get_action_state (const Glib::ustring& action_name) const
 Queries the current state of the named action within action_group.
void change_action_state (const Glib::ustring& action_name, const Glib::VariantBase&value)
 Request for the state of the named action within action_group to be changed to value.
void activate_action (const Glib::ustring& action_name, const Glib::VariantBase& parameter)
 Activate the named action within action_group.
void action_added (const Glib::ustring& action_name)
 Emits the ActionGroup::action-added signal on action_group.
void action_removed (const Glib::ustring& action_name)
 Emits the ActionGroup::action-removed signal on action_group.
void action_enabled_changed (const Glib::ustring& action_name, bool enabled)
 Emits the ActionGroup::action-enabled-changed signal on action_group.
void action_state_changed (const Glib::ustring& action_name, const Glib::VariantBase& state)
 Emits the ActionGroup::action-state-changed signal on action_group.
Glib::SignalProxy1< void,
const Glib::ustring& > 
signal_action_added ()
Glib::SignalProxy2< void,
const Glib::ustring&, bool > 
signal_action_enabled_changed ()
Glib::SignalProxy1< void,
const Glib::ustring& > 
signal_action_removed ()
Glib::SignalProxy2< void,
const Glib::ustring&, const
Glib::VariantBase& > 
signal_action_state_changed ()
virtual bool has_action_vfunc (const Glib::ustring& name) const
virtual std::vector
< Glib::ustring
list_actions_vfunc () const
virtual bool get_action_enabled_vfunc (const Glib::ustring& name) const
virtual Glib::VariantType get_action_parameter_type_vfunc (const Glib::ustring& name) const
virtual Glib::VariantType get_action_state_type_vfunc (const Glib::ustring& name) const
virtual Glib::VariantBase get_action_state_hint_vfunc (const Glib::ustring& name) const
virtual Glib::VariantBase get_action_state_vfunc (const Glib::ustring& name) const
virtual void change_action_state_vfunc (const Glib::ustring& name, const Glib::VariantBase&value)
virtual void activate_action_vfunc (const Glib::ustring& name, const Glib::VariantBase& parameter)

Static Public Member Functions

static void add_interface (GType gtype_implementer)

Protected Member Functions

virtual void on_action_added (const Glib::ustring& action_name)
virtual void on_action_enabled_changed (const Glib::ustring& action_name, bool enabled)
virtual void on_action_removed (const Glib::ustring& action_name)
virtual void on_action_state_changed (const Glib::ustring& action_name, const Glib::VariantBase&value)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gio::ActionGroupwrap (GActionGroup* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

ActionGroup - a group of actions.

ActionGroup represents a group of actions.

Each action in the group has a unique name (which is a string). All method calls, except list_actions() take the name of an action as an argument.

The GActionGroup API is meant to be the 'public' API to the action group. The calls here are exactly the interaction that 'external forces' (eg: UI, incoming D-Bus messages, etc.) are supposed to have with actions. 'Internal' APIs (ie: ones meant only to be accessed by the action group implementation) are found on subclasses. This is why you will find -- for example -- get_action_enabled() but not an equivalent set() call.

Signals are emitted on the action group in response to state changes on individual actions.


Constructor & Destructor Documentation

virtual Gio::ActionGroup::~ActionGroup ( ) [virtual]

Member Function Documentation

void Gio::ActionGroup::action_added ( const Glib::ustring action_name)

Emits the ActionGroup::action-added signal on action_group.

This function should only be called by ActionGroup implementations.

Since glibmm 2.28:
Parameters:
action_nameThe name of an action in the group.
void Gio::ActionGroup::action_enabled_changed ( const Glib::ustring action_name,
bool  enabled 
)

Emits the ActionGroup::action-enabled-changed signal on action_group.

This function should only be called by ActionGroup implementations.

Since glibmm 2.28:
Parameters:
action_nameThe name of an action in the group.
enabledWhether or not the action is now enabled.
void Gio::ActionGroup::action_removed ( const Glib::ustring action_name)

Emits the ActionGroup::action-removed signal on action_group.

This function should only be called by ActionGroup implementations.

Since glibmm 2.28:
Parameters:
action_nameThe name of an action in the group.
void Gio::ActionGroup::action_state_changed ( const Glib::ustring action_name,
const Glib::VariantBase state 
)

Emits the ActionGroup::action-state-changed signal on action_group.

This function should only be called by ActionGroup implementations.

Since glibmm 2.28:
Parameters:
action_nameThe name of an action in the group.
stateThe new state of the named action.
void Gio::ActionGroup::activate_action ( const Glib::ustring action_name,
const Glib::VariantBase parameter 
)

Activate the named action within action_group.

If the action is expecting a parameter, then the correct type of parameter must be given as . If the action is expecting no parameters then must be 0. See Glib::action_group_get_parameter_type().

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to activate.
parameterParameters to the activation.
virtual void Gio::ActionGroup::activate_action_vfunc ( const Glib::ustring name,
const Glib::VariantBase parameter 
) [virtual]
static void Gio::ActionGroup::add_interface ( GType  gtype_implementer) [static]
void Gio::ActionGroup::change_action_state ( const Glib::ustring action_name,
const Glib::VariantBase value 
)

Request for the state of the named action within action_group to be changed to value.

The action must be stateful and value must be of the correct type. See Glib::action_group_get_state_type().

This call merely requests a change. The action may refuse to change its state or may change its state to something other than value. See Glib::action_group_get_state_hint().

If the value GVariant is floating, it is consumed.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to request the change on.
valueThe new state.
virtual void Gio::ActionGroup::change_action_state_vfunc ( const Glib::ustring name,
const Glib::VariantBase value 
) [virtual]
bool Gio::ActionGroup::get_action_enabled ( const Glib::ustring action_name) const

Checks if the named action within action_group is currently enabled.

An action must be enabled in order to be activated or in order to have its state changed from outside callers.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to query.
Returns:
Whether or not the action is currently enabled.
virtual bool Gio::ActionGroup::get_action_enabled_vfunc ( const Glib::ustring name) const [virtual]
Glib::VariantType Gio::ActionGroup::get_action_parameter_type ( const Glib::ustring action_name) const

Queries the type of the parameter that must be given when activating the named action within action_group.

When activating the action using Glib::action_group_activate(), the Variant given to that function must be of the type returned by this function.

In the case that this function returns 0, you must not give any Variant, but 0 instead.

The parameter type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different parameter type.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to query.
Returns:
The parameter type.
virtual Glib::VariantType Gio::ActionGroup::get_action_parameter_type_vfunc ( const Glib::ustring name) const [virtual]
Glib::VariantBase Gio::ActionGroup::get_action_state ( const Glib::ustring action_name) const

Queries the current state of the named action within action_group.

If the action is not stateful then 0 will be returned. If the action is stateful then the type of the return value is the type given by Glib::action_group_get_state_type().

The return value (if non-0) should be freed with Glib::variant_unref() when it is no longer required.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to query.
Returns:
The current state of the action.
Glib::VariantContainerBase Gio::ActionGroup::get_action_state_hint ( const Glib::ustring action_name) const

Requests a hint about the valid range of values for the state of the named action within action_group.

If 0 is returned it either means that the action is not stateful or that there is no hint about the valid range of values for the state of the action.

If a Variant array is returned then each item in the array is a possible value for the state. If a Variant pair (ie: two-tuple) is returned then the tuple specifies the inclusive lower and upper bound of valid values for the state.

In any case, the information is merely a hint. It may be possible to have a state value outside of the hinted range and setting a value within the range may fail.

The return value (if non-0) should be freed with Glib::variant_unref() when it is no longer required.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to query.
Returns:
The state range hint.
virtual Glib::VariantBase Gio::ActionGroup::get_action_state_hint_vfunc ( const Glib::ustring name) const [virtual]
Glib::VariantType Gio::ActionGroup::get_action_state_type ( const Glib::ustring action_name) const

Queries the type of the state of the named action within action_group.

If the action is stateful then this function returns the VariantType of the state. All calls to Glib::action_group_set_state() must give a Variant of this type and Glib::action_group_get_state() will return a Variant of the same type.

If the action is not stateful then this function will return 0. In that case, Glib::action_group_get_state() will return 0 and you must not call Glib::action_group_set_state().

The state type of a particular action will never change but it is possible for an action to be removed and for a new action to be added with the same name but a different state type.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to query.
Returns:
The state type, if the action is stateful.
virtual Glib::VariantType Gio::ActionGroup::get_action_state_type_vfunc ( const Glib::ustring name) const [virtual]
virtual Glib::VariantBase Gio::ActionGroup::get_action_state_vfunc ( const Glib::ustring name) const [virtual]
GActionGroup* Gio::ActionGroup::gobj ( ) [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

Reimplemented in Gio::SimpleActionGroup.

const GActionGroup* Gio::ActionGroup::gobj ( ) const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

Reimplemented in Gio::SimpleActionGroup.

bool Gio::ActionGroup::has_action ( const Glib::ustring action_name) const

Checks if the named action exists within action_group.

Since glibmm 2.28:
Parameters:
action_nameThe name of the action to check for.
Returns:
Whether the named action exists.
virtual bool Gio::ActionGroup::has_action_vfunc ( const Glib::ustring name) const [virtual]
std::vector<Glib::ustring> Gio::ActionGroup::list_actions ( ) const

Lists the actions contained within action_group.

The caller is responsible for freeing the list with Glib::strfreev() when it is no longer required.

Since glibmm 2.28:
Returns:
A 0-terminated array of the names of the actions in the groupb.
virtual std::vector<Glib::ustring> Gio::ActionGroup::list_actions_vfunc ( ) const [virtual]
virtual void Gio::ActionGroup::on_action_added ( const Glib::ustring action_name) [protected, virtual]
virtual void Gio::ActionGroup::on_action_enabled_changed ( const Glib::ustring action_name,
bool  enabled 
) [protected, virtual]
virtual void Gio::ActionGroup::on_action_removed ( const Glib::ustring action_name) [protected, virtual]
virtual void Gio::ActionGroup::on_action_state_changed ( const Glib::ustring action_name,
const Glib::VariantBase value 
) [protected, virtual]
Glib::SignalProxy1< void,const Glib::ustring& > Gio::ActionGroup::signal_action_added ( )
Prototype:
void on_my_action_added(const Glib::ustring& action_name)
Glib::SignalProxy2< void,const Glib::ustring&,bool > Gio::ActionGroup::signal_action_enabled_changed ( )
Prototype:
void on_my_action_enabled_changed(const Glib::ustring& action_name, bool enabled)
Glib::SignalProxy1< void,const Glib::ustring& > Gio::ActionGroup::signal_action_removed ( )
Prototype:
void on_my_action_removed(const Glib::ustring& action_name)
Glib::SignalProxy2< void,const Glib::ustring&,const Glib::VariantBase& > Gio::ActionGroup::signal_action_state_changed ( )
Prototype:
void on_my_action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& value)

Friends And Related Function Documentation

Glib::RefPtr< Gio::ActionGroup > wrap ( GActionGroup *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
objectThe C instance.
take_copyFalse 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.