glibmm: Gio::ActionGroup Class Reference
ActionGroup - a group of actions. More...
#include <giomm/actiongroup.h>
Public Member Functions | |
ActionGroup (ActionGroup&& src) noexcept | |
ActionGroup& | operator= (ActionGroup&& src) noexcept |
~ActionGroup () noexcept override | |
GActionGroup* | gobj () |
Provides access to the underlying C GObject. More... | |
const GActionGroup* | gobj () const |
Provides access to the underlying C GObject. More... | |
bool | has_action (const Glib::ustring& action_name) const |
Checks if the named action exists within action_group. More... | |
std::vector< Glib::ustring > | list_actions () const |
Lists the actions contained within action_group. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantType& parameter_type, Glib::VariantBase& state_hint, Glib::VariantType& state_type, Glib::VariantBase& state) |
Queries all aspects of the named action within an action_group. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantType& parameter_type, Glib::VariantBase& state_hint, Glib::VariantType& state_type) |
A query_action() convenience overload. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantType& parameter_type, Glib::VariantBase& state_hint, Glib::VariantBase& state) |
A query_action() convenience overload. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantType& parameter_type, Glib::VariantBase& state_hint) |
A query_action() convenience overload. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantBase& state_hint, Glib::VariantType& state_type, Glib::VariantBase& state) |
A query_action() convenience overload. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantBase& state_hint, Glib::VariantType& state_type) |
A query_action() convenience overload. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantBase& state_hint, Glib::VariantBase& state) |
A query_action() convenience overload. More... | |
bool | query_action (const Glib::ustring& action_name, bool& enabled, Glib::VariantBase& state_hint) |
A query_action() convenience overload. More... | |
bool | get_action_enabled (const Glib::ustring& action_name) const |
Checks if the named action within action_group is currently enabled. More... | |
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. More... | |
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. More... | |
template<typename T_Value > | |
void | get_action_state_hint (const Glib::ustring& action_name, T_Value& value) const |
Requests a hint about the valid range of values for the state of the named action within the action group. More... | |
Glib::VariantContainerBase | get_action_state_hint_variant (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. More... | |
template<typename T_Value > | |
void | get_action_state (const Glib::ustring& action_name, T_Value& value) const |
Queries the current state of the named action within the action group. More... | |
Glib::VariantBase | get_action_state_variant (const Glib::ustring& action_name) const |
Queries the current state of the named action within action_group. More... | |
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. More... | |
void | activate_action (const Glib::ustring& action_name, const Glib::VariantBase& parameter) |
Activate the named action within action_group. More... | |
void | activate_action (const Glib::ustring& action_name) |
A activate_action() convenience overload. More... | |
void | action_added (const Glib::ustring& action_name) |
Emits the ActionGroup::signal_action_added() signal on action_group. More... | |
void | action_removed (const Glib::ustring& action_name) |
Emits the ActionGroup::signal_action_removed() signal on action_group. More... | |
void | action_enabled_changed (const Glib::ustring& action_name, bool enabled) |
Emits the ActionGroup::signal_action_enabled_changed() signal on action_group. More... | |
void | action_state_changed (const Glib::ustring& action_name, const Glib::VariantBase& state) |
Emits the ActionGroup::signal_action_state_changed() signal on action_group. More... | |
Glib::SignalProxyDetailed< void(const Glib::ustring&)> | signal_action_added (const Glib::ustring& action_name={}) |
Glib::SignalProxyDetailed< void(const Glib::ustring&, bool)> | signal_action_enabled_changed (const Glib::ustring& action_name={}) |
Glib::SignalProxyDetailed< void(const Glib::ustring&)> | signal_action_removed (const Glib::ustring& action_name={}) |
Glib::SignalProxyDetailed< void(const Glib::ustring&, const Glib::VariantBase&)> | signal_action_state_changed (const Glib::ustring& action_name={}) |
Public Member Functions inherited from Glib::Interface | |
Interface () | |
A Default constructor. More... | |
Interface (Interface&& src) noexcept | |
Interface& | operator= (Interface&& src) noexcept |
Interface (const Glib::Interface_Class& interface_class) | |
Called by constructors of derived classes. More... | |
Interface (GObject* castitem) | |
Called by constructors of derived classes. More... | |
~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. More... | |
void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const |
You probably want to use a specific property_*() accessor method instead. More... | |
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. More... | |
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. More... | |
template<class PropertyType > | |
PropertyType | get_property (const Glib::ustring& property_name) const |
You probably want to use a specific property_*() accessor method instead. More... | |
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. More... | |
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. More... | |
void | freeze_notify () |
Increases the freeze count on object. More... | |
void | thaw_notify () |
Reverts the effect of a previous call to freeze_notify(). More... | |
virtual void | reference () const |
Increment the reference count for this object. More... | |
virtual void | unreference () const |
Decrement the reference count for this object. More... | |
GObject* | gobj () |
Provides access to the underlying C GObject. More... | |
const GObject* | gobj () const |
Provides access to the underlying C GObject. More... | |
GObject* | gobj_copy () const |
Give a ref-ed copy to someone. Use for direct struct access. More... | |
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. More... | |
Protected Member Functions | |
ActionGroup () | |
You should derive from this class to use it. More... | |
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) |
virtual void | on_action_added (const Glib::ustring& action_name) |
This is a default handler for the signal signal_action_added(). More... | |
virtual void | on_action_enabled_changed (const Glib::ustring& action_name, bool enabled) |
This is a default handler for the signal signal_action_enabled_changed(). More... | |
virtual void | on_action_removed (const Glib::ustring& action_name) |
This is a default handler for the signal signal_action_removed(). More... | |
virtual void | on_action_state_changed (const Glib::ustring& action_name, const Glib::VariantBase& value) |
This is a default handler for the signal signal_action_state_changed(). More... | |
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. More... | |
ObjectBase (const char* custom_type_name) | |
A derived constructor always overrides this choice. More... | |
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. More... | |
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 Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gio::ActionGroup > | wrap (GActionGroup* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Additional Inherited Members | |
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 |
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
|
protected |
You should derive from this class to use it.
|
noexcept |
|
overridenoexcept |
Member Function Documentation
void Gio::ActionGroup::action_added | ( | const Glib::ustring& | action_name | ) |
Emits the ActionGroup::signal_action_added() signal on action_group.
This function should only be called by ActionGroup implementations.
- Parameters
-
action_name The name of an action in the group.
void Gio::ActionGroup::action_enabled_changed | ( | const Glib::ustring& | action_name, |
bool | enabled | ||
) |
Emits the ActionGroup::signal_action_enabled_changed() signal on action_group.
This function should only be called by ActionGroup implementations.
- Parameters
-
action_name The name of an action in the group. enabled Whether or not the action is now enabled.
void Gio::ActionGroup::action_removed | ( | const Glib::ustring& | action_name | ) |
Emits the ActionGroup::signal_action_removed() signal on action_group.
This function should only be called by ActionGroup implementations.
- Parameters
-
action_name The 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::signal_action_state_changed() signal on action_group.
This function should only be called by ActionGroup implementations.
- Parameters
-
action_name The name of an action in the group. state The 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 parameter. If the action is expecting no parameters then parameter must be nullptr
. See g_action_group_get_action_parameter_type().
- Parameters
-
action_name The name of the action to activate. parameter Parameters to the activation.
void Gio::ActionGroup::activate_action | ( | const Glib::ustring& | action_name | ) |
A activate_action() convenience overload.
|
protectedvirtual |
|
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 g_action_group_get_action_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 g_action_group_get_action_state_hint().
If the value GVariant is floating, it is consumed.
- Parameters
-
action_name The name of the action to request the change on. value The new state.
|
protectedvirtual |
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.
- Parameters
-
action_name The name of the action to query.
- Returns
- Whether or not the action is currently enabled.
|
protectedvirtual |
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 g_action_group_activate_action(), the Variant given to that function must be of the type returned by this function.
In the case that this function returns nullptr
, you must not give any Variant, but nullptr
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.
- Parameters
-
action_name The name of the action to query.
- Returns
- The parameter type.
|
protectedvirtual |
void Gio::ActionGroup::get_action_state | ( | const Glib::ustring& | action_name, |
T_Value & | value | ||
) | const |
Queries the current state of the named action within the action group.
If the action is not stateful then a null Variant will be returned. If the action is stateful then the type of the return value is the type given by get_action_state_type().
- Parameters
-
action_name The name of the action to query. value This will be set to the current state of the action.
void Gio::ActionGroup::get_action_state_hint | ( | const Glib::ustring& | action_name, |
T_Value & | value | ||
) | const |
Requests a hint about the valid range of values for the state of the named action within the action group.
If a null Variant 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 ariant array is returned then each item in the array is a possible value for the state. If 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.
- Parameters
-
action_name The name of the action to query. value This will be set to the state range hint.
Glib::VariantContainerBase Gio::ActionGroup::get_action_state_hint_variant | ( | 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 nullptr
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-nullptr
) should be freed with Glib::variant_unref() when it is no longer required.
- Parameters
-
action_name The name of the action to query.
- Returns
- The state range hint.
|
protectedvirtual |
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 g_action_group_change_action_state() must give a Variant of this type and g_action_group_get_action_state() will return a Variant of the same type.
If the action is not stateful then this function will return nullptr
. In that case, g_action_group_get_action_state() will return nullptr
and you must not call g_action_group_change_action_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.
- Parameters
-
action_name The name of the action to query.
- Returns
- The state type, if the action is stateful.
|
protectedvirtual |
Glib::VariantBase Gio::ActionGroup::get_action_state_variant | ( | const Glib::ustring& | action_name | ) | const |
Queries the current state of the named action within action_group.
If the action is not stateful then nullptr
will be returned. If the action is stateful then the type of the return value is the type given by g_action_group_get_action_state_type().
The return value (if non-nullptr
) should be freed with Glib::variant_unref() when it is no longer required.
- Parameters
-
action_name The name of the action to query.
- Returns
- The current state of the action.
|
protectedvirtual |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
bool Gio::ActionGroup::has_action | ( | const Glib::ustring& | action_name | ) | const |
Checks if the named action exists within action_group.
- Parameters
-
action_name The name of the action to check for.
- Returns
- Whether the named action exists.
|
protectedvirtual |
std::vector<Glib::ustring> Gio::ActionGroup::list_actions | ( | ) | const |
Lists the actions contained within action_group.
- Returns
- A
nullptr
-terminated array of the names of the actions in the group.
|
protectedvirtual |
|
protectedvirtual |
This is a default handler for the signal signal_action_added().
|
protectedvirtual |
This is a default handler for the signal signal_action_enabled_changed().
|
protectedvirtual |
This is a default handler for the signal signal_action_removed().
|
protectedvirtual |
This is a default handler for the signal signal_action_state_changed().
|
noexcept |
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantType& | parameter_type, | ||
Glib::VariantBase& | state_hint, | ||
Glib::VariantType& | state_type, | ||
Glib::VariantBase& | state | ||
) |
Queries all aspects of the named action within an action_group.
This function acquires the information available from g_action_group_has_action(), g_action_group_get_action_enabled(), g_action_group_get_action_parameter_type(), g_action_group_get_action_state_type(), g_action_group_get_action_state_hint() and g_action_group_get_action_state() with a single function call.
This provides two main benefits.
The first is the improvement in efficiency that comes with not having to perform repeated lookups of the action in order to discover different things about it. The second is that implementing ActionGroup can now be done by only overriding this one virtual function.
The interface provides a default implementation of this function that calls the individual functions, as required, to fetch the information. The interface also provides default implementations of those functions that call this function. All implementations, therefore, must override either this function or all of the others.
If the action exists, true
is returned and any of the requested fields (as indicated by having a non-nullptr
reference passed in) are filled. If the action doesn't exist, false
is returned and the fields may or may not have been modified.
- Parameters
-
action_name The name of an action in the group. enabled If the action is presently enabled. parameter_type The parameter type, or nullptr
if none needed.state_type The state type, or nullptr
if stateless.state_hint The state hint, or nullptr
if none.state The current state, or nullptr
if stateless.
- Returns
true
if the action exists, elsefalse
.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantType& | parameter_type, | ||
Glib::VariantBase& | state_hint, | ||
Glib::VariantType& | state_type | ||
) |
A query_action() convenience overload.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantType& | parameter_type, | ||
Glib::VariantBase& | state_hint, | ||
Glib::VariantBase& | state | ||
) |
A query_action() convenience overload.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantType& | parameter_type, | ||
Glib::VariantBase& | state_hint | ||
) |
A query_action() convenience overload.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantBase& | state_hint, | ||
Glib::VariantType& | state_type, | ||
Glib::VariantBase& | state | ||
) |
A query_action() convenience overload.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantBase& | state_hint, | ||
Glib::VariantType& | state_type | ||
) |
A query_action() convenience overload.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantBase& | state_hint, | ||
Glib::VariantBase& | state | ||
) |
A query_action() convenience overload.
bool Gio::ActionGroup::query_action | ( | const Glib::ustring& | action_name, |
bool & | enabled, | ||
Glib::VariantBase& | state_hint | ||
) |
A query_action() convenience overload.
Glib::SignalProxyDetailed<void(const Glib::ustring&)> Gio::ActionGroup::signal_action_added | ( | const Glib::ustring& | action_name = {} | ) |
- Slot Prototype:
void on_my_action_added(const Glib::ustring& action_name)
Flags: Run Last
Signals that a new action was just added to the group. This signal is emitted after the action has been added and is now visible.
- Parameters
-
action_name The name of the action in action_group.
Glib::SignalProxyDetailed<void(const Glib::ustring&, bool)> Gio::ActionGroup::signal_action_enabled_changed | ( | const Glib::ustring& | action_name = {} | ) |
- Slot Prototype:
void on_my_action_enabled_changed(const Glib::ustring& action_name, bool enabled)
Flags: Run Last
Signals that the enabled status of the named action has changed.
- Parameters
-
action_name The name of the action in action_group. enabled Whether the action is enabled or not.
Glib::SignalProxyDetailed<void(const Glib::ustring&)> Gio::ActionGroup::signal_action_removed | ( | const Glib::ustring& | action_name = {} | ) |
- Slot Prototype:
void on_my_action_removed(const Glib::ustring& action_name)
Flags: Run Last
Signals that an action is just about to be removed from the group. This signal is emitted before the action is removed, so the action is still visible and can be queried from the signal handler.
- Parameters
-
action_name The name of the action in action_group.
Glib::SignalProxyDetailed<void(const Glib::ustring&, const Glib::VariantBase&)> Gio::ActionGroup::signal_action_state_changed | ( | const Glib::ustring& | action_name = {} | ) |
- Slot Prototype:
void on_my_action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& value)
Flags: Run Last, Must Collect
Signals that the state of the named action has changed.
- Parameters
-
action_name The name of the action in action_group. value The new value of the state.
Friends And Related Function Documentation
|
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.