Index

Package: Action

Description

package Glib.Action is

Glib.Action.Gaction represents a single named action.

The main interface to an action is that it can be activated with Glib.Action.Activate. This results in the 'activate' signal being emitted.

An activation has a Glib.Variant.Gvariant parameter (which may be null).

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 Glib.Action.Change_State. This call takes a Glib.Variant.Gvariant. 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.

Glib.Action.Gaction is merely the interface to the concept of an action, as described above. Various implementations of actions exist, including Glib.Simple_Action.Gsimple_Action and Gtk.Action.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 Glib.Action.Activate and Glib.Action.Change_State for type safety and for the state being enabled.

Probably the only useful thing to do with a Glib.Action.Gaction is to put it inside of a Glib.Simple_Action_Group.Gsimple_Action_Group.

Types

Constants & Global variables

Null_Gaction (Gaction)

Null_Gaction : constant Gaction;

Enabled_Property (Glib.Properties.Property_Boolean)

Enabled_Property : constant Glib.Properties.Property_Boolean;
If Action is currently enabled. If the action is disabled then calls to Glib.Action.Activate and Glib.Action.Change_State have no effect.

Name_Property (Glib.Properties.Property_String)

Name_Property : constant Glib.Properties.Property_String;
The name of the action. This is mostly meaningful for identifying the action once it has been added to a Glib.Action_Group.Gaction_Group.

Parameter_Type_Property (Glib.Properties.Property_Boxed)

Parameter_Type_Property : constant Glib.Properties.Property_Boxed;
Type: GLib.Variant_Type The type of the parameter that must be given when activating the action.

State_Property (Glib.Properties.Property_Object)

State_Property : constant Glib.Properties.Property_Object;
Type: Glib.Variant.Gvariant The state of the action, or null if the action is stateless.

State_Type_Property (Glib.Properties.Property_Boxed)

State_Type_Property : constant Glib.Properties.Property_Boxed;
Type: GLib.Variant_Type The Glib.Variant.Gvariant_Type of the state that the action has, or null if the action is stateless.

Subprograms & Entries

Get_Type

function Get_Type return Glib.GType;

Activate

procedure Activate 
(Self: Gaction;
Parameter: Glib.Variant.Gvariant);
Activates the action. Parameter must be the correct type of parameter for the action (ie: the parameter type given at construction time). If the parameter type was null then Parameter must also be null. Since: gtk+ 2.28 "parameter": the parameter to the activation

Change_State

procedure Change_State 
(Self: Gaction;
Value: Glib.Variant.Gvariant);
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 Glib.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 Glib.Action.Get_State_Hint. If the Value GVariant is floating, it is consumed. Since: gtk+ 2.30 "value": the new state

Get_Enabled

function Get_Enabled 
(Self: Gaction) return Boolean;
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: gtk+ 2.28

Get_Name

function Get_Name 
(Self: Gaction) return UTF8_String;
Queries the name of Action. Since: gtk+ 2.28

Get_Parameter_Type

function Get_Parameter_Type 
(Self: Gaction) return Glib.Variant.Gvariant_Type;

Get_State

function Get_State 
(Self: Gaction) return Glib.Variant.Gvariant;
Queries the current state of Action. If the action is not stateful then null will be returned. If the action is stateful then the type of the return value is the type given by Glib.Action.Get_State_Type. The return value (if non-null) should be freed with Glib.Variant.Unref when it is no longer required. Since: gtk+ 2.28

Get_State_Hint

function Get_State_Hint 
(Self: Gaction) return Glib.Variant.Gvariant;
Requests a hint about the valid range of values for the state of Action. If null 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 Glib.Variant.Gvariant array is returned then each item in the array is a possible value for the state. If a Glib.Variant.Gvariant 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-null) should be freed with Glib.Variant.Unref when it is no longer required. Since: gtk+ 2.28

Get_State_Type

function Get_State_Type 
(Self: Gaction) return Glib.Variant.Gvariant_Type;

+

function "+" 
(W: Gaction) return Gaction;