glibmm 2.31.20
Public Member Functions | Static Public Member Functions | Related Functions
Gio::Action Class Reference

Action - An action. More...

#include <giomm/action.h>

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

List of all members.

Public Member Functions

virtual ~Action ()
GAction* gobj ()
 Provides access to the underlying C GObject.
const GAction* gobj () const
 Provides access to the underlying C GObject.
Glib::ustring get_name () const
 Queries the name of action.
Glib::VariantType get_parameter_type () const
 Queries the type of the parameter that must be given when activating action.
Glib::VariantType get_state_type () const
 Queries the type of the state of action.
void get_state_hint () const
 Requests a hint about the valid range of values for the state of action.
bool get_enabled () const
 Checks if action is currently enabled.
void get_state () const
 Queries the current state of action.
void change_state (const Glib::VariantBase&value)
 Request for the state of action to be changed to value.
void activate (const Glib::VariantBase& parameter)
 Activates the action.
Glib::PropertyProxy_ReadOnly
< bool > 
property_enabled () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly
< Glib::ustring
property_name () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly
< Glib::VariantType
property_parameter_type () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly
< Glib::VariantBase
property_state () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly
< Glib::VariantType
property_state_type () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
virtual Glib::ustring get_name_vfunc () const
virtual Glib::VariantType get_parameter_type_vfunc () const
virtual Glib::VariantType get_state_type_vfunc () const
virtual Glib::VariantBase get_state_hint_vfunc () const
virtual bool get_enabled_vfunc () const
virtual Glib::VariantBase get_state_vfunc () const
virtual void change_state_vfunc (const Glib::VariantBase&value)
virtual void activate_vfunc (const Glib::VariantBase& parameter)

Static Public Member Functions

static void add_interface (GType gtype_implementer)

Related Functions

(Note that these are not member functions.)

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

Detailed Description

Action - An action.

Action represents a single named action.

The main interface to an action is that it can be activated with activate(). This results in the signal_activate() signal being emitted. An activation has a Glib::VariantBase parameter (which may be 0). The correct type for the parameter is determined by a static parameter type (which is given at construction time).

An action may optionally have a state, in which case the state may be set with change_state(). This call takes a Glib::VariantBase. The correct type for the state is determined by a static state type (which is given at construction time).

The state may have a hint associated with it, specifying its valid range.

Action is merely the interface to the concept of an action, as described above. Various implementations of actions exist, including SimpleAction and Gtk::Action.

In all cases, the implementing class is responsible for storing the name of the action, the parameter type, the enabled state, the optional state type and the state and emitting the appropriate signals when these change. The implementor responsible for filtering calls to activate() and change_state() for type safety and for the state being enabled.

Probably the only useful thing to do with a Action is to put it inside of a SimpleActionGroup.

Since glibmm 2.32:

Constructor & Destructor Documentation

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

Member Function Documentation

void Gio::Action::activate ( const Glib::VariantBase parameter)

Activates the action.

must be the correct type of parameter for the action (ie: the parameter type given at construction time). If the parameter type was 0 then must also be 0.

Since glibmm 2.28:
Parameters:
parameterThe parameter to the activation.
virtual void Gio::Action::activate_vfunc ( const Glib::VariantBase parameter) [virtual]
static void Gio::Action::add_interface ( GType  gtype_implementer) [static]
void Gio::Action::change_state ( const Glib::VariantBase value)

Request for the state of action to be changed to value.

The action must be stateful and value must be of the correct type. See g_action_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 g_action_get_state_hint().

If the value GVariant is floating, it is consumed.

Since glibmm 2.30:
Parameters:
valueThe new state.
virtual void Gio::Action::change_state_vfunc ( const Glib::VariantBase value) [virtual]
bool Gio::Action::get_enabled ( ) const

Checks if action 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:
Returns:
Whether the action is enabled.
virtual bool Gio::Action::get_enabled_vfunc ( ) const [virtual]
Glib::ustring Gio::Action::get_name ( ) const

Queries the name of action.

Since glibmm 2.28:
Returns:
The name of the action.
virtual Glib::ustring Gio::Action::get_name_vfunc ( ) const [virtual]
Glib::VariantType Gio::Action::get_parameter_type ( ) const

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

When activating the action using g_action_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.

Since glibmm 2.28:
Returns:
The parameter type.
virtual Glib::VariantType Gio::Action::get_parameter_type_vfunc ( ) const [virtual]
void Gio::Action::get_state ( ) const

Queries the current state of action.

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 g_action_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:
Returns:
The current state of the action.
void Gio::Action::get_state_hint ( ) const

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

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:
Returns:
The state range hint.
virtual Glib::VariantBase Gio::Action::get_state_hint_vfunc ( ) const [virtual]
Glib::VariantType Gio::Action::get_state_type ( ) const

Queries the type of the state of action.

If the action is stateful (e.g. created with g_simple_action_new_stateful()) then this function returns the VariantType of the state. This is the type of the initial value given as the state. All calls to g_action_change_state() must give a Variant of this type and g_action_get_state() will return a Variant of the same type.

If the action is not stateful (e.g. created with g_simple_action_new()) then this function will return 0. In that case, g_action_get_state() will return 0 and you must not call g_action_change_state().

Since glibmm 2.28:
Returns:
The state type, if the action is stateful.
virtual Glib::VariantType Gio::Action::get_state_type_vfunc ( ) const [virtual]
virtual Glib::VariantBase Gio::Action::get_state_vfunc ( ) const [virtual]
GAction* Gio::Action::gobj ( ) [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

Reimplemented in Gio::SimpleAction.

const GAction* Gio::Action::gobj ( ) const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

Reimplemented in Gio::SimpleAction.

Glib::PropertyProxy_ReadOnly< bool > Gio::Action::property_enabled ( ) const

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.

Reimplemented in Gio::SimpleAction.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::Action::property_name ( ) const

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.

Reimplemented in Gio::SimpleAction.

Glib::PropertyProxy_ReadOnly< Glib::VariantType > Gio::Action::property_parameter_type ( ) const

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.

Reimplemented in Gio::SimpleAction.

Glib::PropertyProxy_ReadOnly< Glib::VariantBase > Gio::Action::property_state ( ) const

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.

Reimplemented in Gio::SimpleAction.

Glib::PropertyProxy_ReadOnly< Glib::VariantType > Gio::Action::property_state_type ( ) const

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.

Reimplemented in Gio::SimpleAction.


Friends And Related Function Documentation

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