Index

Package: Simple_Action

Description

package Glib.Simple_Action is

A Glib.Simple_Action.Gsimple_Action is the obvious simple implementation of the Glib.Action.Gaction interface. This is the easiest way to create an action for purposes of adding it to a Glib.Simple_Action_Group.Gsimple_Action_Group.

See also Gtk.Action.Gtk_Action.

Packages

Implements_Gaction (new Glib.Types.Implements)

Classes

Gsimple_Action_Record

type Gsimple_Action_Record is new GObject_Record with null record;

Ancestors:

Primitive operations:

Change_State
Get_Parameter_Type
Get_State_Hint
Get_State_Type
Glib.Object.Deallocate (Inherited)
Glib.Object.Get_Type (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Ref_Sink (Inherited)
Glib.Object.Unref (Inherited)
On_Change_State
On_Change_State

Types

Gsimple_Action

type Gsimple_Action is access all Gsimple_Action_Record'Class;

Cb_Gsimple_Action_Gvariant_Void

type Cb_Gsimple_Action_Gvariant_Void is not null access procedure
     (Self      : access Gsimple_Action_Record'Class;
      Parameter : Glib.Variant.Gvariant);

Cb_GObject_Gvariant_Void

type Cb_GObject_Gvariant_Void is not null access procedure
     (Self      : access Glib.Object.GObject_Record'Class;
      Parameter : Glib.Variant.Gvariant);

Constants & Global variables

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.Simple_Action_Group.Gsimple_Action_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.

Signal_Activate (Glib.Signal_Name)

Signal_Activate : constant Glib.Signal_Name := "activate";

Signal_Change_State (Glib.Signal_Name)

Signal_Change_State : constant Glib.Signal_Name := "change-state";

Subprograms & Entries

G_New

procedure G_New 
(Self: out Gsimple_Action;
Name: UTF8_String;
Parameter_Type: Glib.Variant.Gvariant_Type);
Creates a new action. The created action is stateless. See Glib.Simple_Action.G_New_Stateful. Since: gtk+ 2.28 "name": the name of the action "parameter_type": the type of parameter to the activate function

Initialize

procedure Initialize 
(Self: not null access Gsimple_Action_Record'Class;
Name: UTF8_String;
Parameter_Type: Glib.Variant.Gvariant_Type);
Creates a new action. The created action is stateless. See Glib.Simple_Action.G_New_Stateful. Since: gtk+ 2.28 "name": the name of the action "parameter_type": the type of parameter to the activate function

Gsimple_Action_New

function Gsimple_Action_New 
(Name: UTF8_String;
Parameter_Type: Glib.Variant.Gvariant_Type) return Gsimple_Action;
Creates a new action. The created action is stateless. See Glib.Simple_Action.G_New_Stateful. Since: gtk+ 2.28 "name": the name of the action "parameter_type": the type of parameter to the activate function

G_New_Stateful

procedure G_New_Stateful 
(Self: out Gsimple_Action;
Name: UTF8_String;
Parameter_Type: Glib.Variant.Gvariant_Type;
State: Glib.Variant.Gvariant);
Creates a new stateful action. State is the initial state of the action. All future state values must have the same Glib.Variant.Gvariant_Type as the initial state. If the State GVariant is floating, it is consumed. Since: gtk+ 2.28 "name": the name of the action "parameter_type": the type of the parameter to the activate function "state": the initial state of the action

Initialize_Stateful

procedure Initialize_Stateful 
(Self: not null access Gsimple_Action_Record'Class;
Name: UTF8_String;
Parameter_Type: Glib.Variant.Gvariant_Type;
State: Glib.Variant.Gvariant);
Creates a new stateful action. State is the initial state of the action. All future state values must have the same Glib.Variant.Gvariant_Type as the initial state. If the State GVariant is floating, it is consumed. Since: gtk+ 2.28 "name": the name of the action "parameter_type": the type of the parameter to the activate function "state": the initial state of the action

Gsimple_Action_New_Stateful

function Gsimple_Action_New_Stateful 
(Name: UTF8_String;
Parameter_Type: Glib.Variant.Gvariant_Type;
State: Glib.Variant.Gvariant) return Gsimple_Action;
Creates a new stateful action. State is the initial state of the action. All future state values must have the same Glib.Variant.Gvariant_Type as the initial state. If the State GVariant is floating, it is consumed. Since: gtk+ 2.28 "name": the name of the action "parameter_type": the type of the parameter to the activate function "state": the initial state of the action

Get_Type

function Get_Type return Glib.GType;

Set_Enabled

procedure Set_Enabled 
(Self: not null access Gsimple_Action_Record;
Enabled: Boolean);
Sets the action as enabled or not. An action must be enabled in order to be activated or in order to have its state changed from outside callers. This should only be called by the implementor of the action. Users of the action should not attempt to modify its enabled flag. Since: gtk+ 2.28 "enabled": whether the action is enabled

Set_State

procedure Set_State 
(Self: not null access Gsimple_Action_Record;
Value: Glib.Variant.Gvariant);
Sets the state of the action. This directly updates the 'state' property to the given value. This should only be called by the implementor of the action. Users of the action should not attempt to directly modify the 'state' property. Instead, they should call Glib.Action.Change_State to request the change. Since: gtk+ 2.30 "value": the new Glib.Variant.Gvariant for the state

Activate

procedure Activate 
(Self: not null access Gsimple_Action_Record;
Parameter: Glib.Variant.Gvariant);

Change_State

procedure Change_State 
(Self: not null access Gsimple_Action_Record;
Value: Glib.Variant.Gvariant);

Get_Enabled

function Get_Enabled 
(Self: not null access Gsimple_Action_Record) return Boolean;

Get_Name

function Get_Name 
(Self: not null access Gsimple_Action_Record) return UTF8_String;

Get_Parameter_Type

function Get_Parameter_Type 
(Self: not null access Gsimple_Action_Record) return Glib.Variant.Gvariant_Type;

Get_State

function Get_State 
(Self: not null access Gsimple_Action_Record) return Glib.Variant.Gvariant;

Get_State_Hint

function Get_State_Hint 
(Self: not null access Gsimple_Action_Record) return Glib.Variant.Gvariant;

Get_State_Type

function Get_State_Type 
(Self: not null access Gsimple_Action_Record) return Glib.Variant.Gvariant_Type;

On_Activate

procedure On_Activate 
(Self: not null access Gsimple_Action_Record;
Call: Cb_Gsimple_Action_Gvariant_Void;
After: Boolean := False);

On_Activate

procedure On_Activate 
(Self: not null access Gsimple_Action_Record;
Call: Cb_GObject_Gvariant_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Indicates that the action was just activated. Parameter will always be of the expected type. In the event that an incorrect type was given, no signal will be emitted.

On_Change_State

procedure On_Change_State 
(Self: not null access Gsimple_Action_Record;
Call: Cb_Gsimple_Action_Gvariant_Void;
After: Boolean := False);

On_Change_State

procedure On_Change_State 
(Self: not null access Gsimple_Action_Record;
Call: Cb_GObject_Gvariant_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
Indicates that the action just received a request to change its state. Value will always be of the correct state type. In the event that an incorrect type was given, no signal will be emitted. If no handler is connected to this signal then the default behaviour is to call Glib.Simple_Action.Set_State to set the state to the requested value. If you connect a signal handler then no default action is taken. If the state should change then you must call Glib.Simple_Action.Set_State from the handler. == Example 'change-state' handler == static void change_volume_state (GSimpleAction *action, GVariant *value, gpointer user_data) { gint requested; requested = g_variant_get_int32 (value); // Volume only goes from 0 to 10 if (0 <= requested && requested <= 10) g_simple_action_set_state (action, value); } The handler need not set the state to the requested value. It could set it to any value at all, or take some other action.