package Action_List is new Generic_List (Gtk.Action.Gtk_Action);
package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Action_Group_Record, Gtk_Action_Group);
type Gtk_Action_Group_Record is new GObject_Record with null record;
type Gtk_Action_Group is access all Gtk_Action_Group_Record'Class;
type Gtk_Translate_Func is access function (Path : UTF8_String) return UTF8_String;
type Action_Callback is access procedure (Action : System.Address; User_Data : System.Address);
type Action_Entry is record Name : Interfaces.C.Strings.chars_ptr; Stock_Id : Interfaces.C.Strings.chars_ptr; Label : Interfaces.C.Strings.chars_ptr; Accelerator : Interfaces.C.Strings.chars_ptr; Tooltip : Interfaces.C.Strings.chars_ptr; Callback : Action_Callback; end record;
type Radio_Action_Entry is record Name : Interfaces.C.Strings.chars_ptr; Stock_Id : Interfaces.C.Strings.chars_ptr; Label : Interfaces.C.Strings.chars_ptr; Accelerator : Interfaces.C.Strings.chars_ptr; Tooltip : Interfaces.C.Strings.chars_ptr; Value : Glib.Gint; end record;
type Toggle_Action_Entry is record Name : Interfaces.C.Strings.chars_ptr; Stock_Id : Interfaces.C.Strings.chars_ptr; Label : Interfaces.C.Strings.chars_ptr; Accelerator : Interfaces.C.Strings.chars_ptr; Tooltip : Interfaces.C.Strings.chars_ptr; Callback : Action_Callback; Is_Active : Glib.Gboolean; end record;
type Action_Entry_Array is array (Natural range <>) of Action_Entry;
type Radio_Action_Entry_Array is array (Natural range <>) of Radio_Action_Entry;
type Toggle_Action_Entry_Array is array (Natural range <>) of Toggle_Action_Entry;
type Radio_Action_Callback is access procedure (Group : access Gtk.Action.Gtk_Action_Record'Class; Current : access Gtk.Action.Gtk_Action_Record'Class; User_Data : System.Address);
type Cb_Gtk_Action_Group_Gtk_Action_Gtk_Widget_Void is not null access procedure (Self : access Gtk_Action_Group_Record'Class; Action : not null access Gtk.Action.Gtk_Action_Record'Class; Proxy : not null access Gtk.Widget.Gtk_Widget_Record'Class);
type Cb_GObject_Gtk_Action_Gtk_Widget_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Action : not null access Gtk.Action.Gtk_Action_Record'Class; Proxy : not null access Gtk.Widget.Gtk_Widget_Record'Class);
type Cb_Gtk_Action_Group_Gtk_Action_Void is not null access procedure (Self : access Gtk_Action_Group_Record'Class; Action : not null access Gtk.Action.Gtk_Action_Record'Class);
type Cb_GObject_Gtk_Action_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Action : not null access Gtk.Action.Gtk_Action_Record'Class);
Accel_Group_Property : constant Glib.Properties.Property_Object;
Name_Property : constant Glib.Properties.Property_String;
Sensitive_Property : constant Glib.Properties.Property_Boolean;
Visible_Property : constant Glib.Properties.Property_Boolean;
Signal_Connect_Proxy : constant Glib.Signal_Name := "connect-proxy";
Signal_Disconnect_Proxy : constant Glib.Signal_Name := "disconnect-proxy";
Signal_Post_Activate : constant Glib.Signal_Name := "post-activate";
Signal_Pre_Activate : constant Glib.Signal_Name := "pre-activate";
function Convert
( | R | : Gtk.Action.Gtk_Action) return System.Address; |
function Convert
( | R | : System.Address) return Gtk.Action.Gtk_Action; |
procedure Gtk_New
( | Action_Group | : out Gtk_Action_Group; |
Name | : UTF8_String); |
procedure Initialize
( | Action_Group | : not null access Gtk_Action_Group_Record'Class; |
Name | : UTF8_String); |
function Gtk_Action_Group_New
( | Name | : UTF8_String) return Gtk_Action_Group; |
function Get_Type return Glib.GType;
procedure Add_Action
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class); |
procedure Add_Action_With_Accel
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class; | |
Accelerator | : UTF8_String := ""); |
function Get_Accel_Group
( | Action_Group | : not null access Gtk_Action_Group_Record) return Gtk.Accel_Group.Gtk_Accel_Group; |
procedure Set_Accel_Group
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Accel_Group | : access Gtk.Accel_Group.Gtk_Accel_Group_Record'Class); |
function Get_Action
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Action_Name | : UTF8_String) return Gtk.Action.Gtk_Action; |
function Get_Name
( | Action_Group | : not null access Gtk_Action_Group_Record) return UTF8_String; |
function Get_Sensitive
( | Action_Group | : not null access Gtk_Action_Group_Record) return Boolean; |
procedure Set_Sensitive
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Sensitive | : Boolean); |
function Get_Visible
( | Action_Group | : not null access Gtk_Action_Group_Record) return Boolean; |
procedure Set_Visible
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Visible | : Boolean); |
function List_Actions
( | Action_Group | : not null access Gtk_Action_Group_Record) return Action_List.Glist; |
procedure Remove_Action
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class); |
procedure Set_Translate_Func
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Func | : Gtk_Translate_Func; | |
Notify | : Glib.G_Destroy_Notify_Address); |
procedure Set_Translation_Domain
( | Action_Group | : not null access Gtk_Action_Group_Record; |
Domain | : UTF8_String := ""); |
function Translate_String
( | Action_Group | : not null access Gtk_Action_Group_Record; |
String | : UTF8_String) return UTF8_String; |
function Create
( | Name | : String; |
Label | : String := ""; | |
Stock_Id | : String := ""; | |
Accelerator | : String := ""; | |
Tooltip | : String := ""; | |
Callback | : Action_Callback := null) return Action_Entry; |
function Create
( | Name | : String; |
Label | : String := ""; | |
Stock_Id | : String := ""; | |
Accelerator | : String := ""; | |
Tooltip | : String := ""; | |
Callback | : Action_Callback := null; | |
Is_Active | : Boolean := True) return Toggle_Action_Entry; |
function Create
( | Name | : String; |
Label | : String; | |
Stock_Id | : String := ""; | |
Accelerator | : String := ""; | |
Tooltip | : String := ""; | |
Value | : Glib.Gint) return Radio_Action_Entry; |
procedure Free
( | Action | : in out Action_Entry); |
procedure Free
( | Actions | : in out Action_Entry_Array); |
procedure Free
( | Action | : in out Radio_Action_Entry); |
procedure Free
( | Actions | : in out Radio_Action_Entry_Array); |
procedure Free
( | Action | : in out Toggle_Action_Entry); |
procedure Add_Actions
( | Action_Group | : access Gtk_Action_Group_Record; |
Entries | : Action_Entry_Array; | |
User_Data | : System.Address := System.Null_Address; | |
Destroy | : Glib.G_Destroy_Notify_Address := null); |
procedure Add_Radio_Actions
( | Action_Group | : access Gtk_Action_Group_Record; |
Entries | : Radio_Action_Entry_Array; | |
Value | : Glib.Gint; | |
On_Change | : Radio_Action_Callback; | |
User_Data | : System.Address := System.Null_Address; | |
Destroy | : Glib.G_Destroy_Notify_Address := null); |
procedure Add_Toggle_Actions
( | Action_Group | : access Gtk_Action_Group_Record; |
Entries | : Toggle_Action_Entry_Array; | |
User_Data | : System.Address := System.Null_Address; | |
Destroy | : Glib.G_Destroy_Notify_Address := null); |
procedure On_Connect_Proxy
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_Gtk_Action_Group_Gtk_Action_Gtk_Widget_Void; | |
After | : Boolean := False); |
procedure On_Connect_Proxy
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_GObject_Gtk_Action_Gtk_Widget_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Disconnect_Proxy
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_Gtk_Action_Group_Gtk_Action_Gtk_Widget_Void; | |
After | : Boolean := False); |
procedure On_Disconnect_Proxy
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_GObject_Gtk_Action_Gtk_Widget_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Post_Activate
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_Gtk_Action_Group_Gtk_Action_Void; | |
After | : Boolean := False); |
procedure On_Post_Activate
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_GObject_Gtk_Action_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Pre_Activate
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_Gtk_Action_Group_Gtk_Action_Void; | |
After | : Boolean := False); |
procedure On_Pre_Activate
( | Self | : not null access Gtk_Action_Group_Record; |
Call | : Cb_GObject_Gtk_Action_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Action_Group_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Action_Group renames Implements_Gtk_Buildable.To_Object; |
Actions are organised into groups. An action group is essentially a map from names to Gtk.Action.Gtk_Action objects.
All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window's menus would be constructed from a combination of two action groups. <para id="Action-Accel"> Accelerators are handled by the GTK+ accelerator map. All actions are assigned an accelerator path (which normally has the form '<Actions>/group-name/action-name') and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The GTK+ accelerator map code makes sure that the correct shortcut is displayed next to the menu item. == GtkActionGroup as GtkBuildable == The Gtk.Action_Group.Gtk_Action_Group implementation of the Gtk.Buildable.Gtk_Buildable interface accepts Gtk.Action.Gtk_Action objects as <child> elements in UI definitions.
Note that it is probably more common to define actions and action groups in the code, since they are directly related to what the code can do.
The GtkActionGroup implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named key and modifiers and allows to specify accelerators. This is similar to the <accelerator> element of Gtk.Widget.Gtk_Widget, the main difference is that it doesn't allow you to specify a signal. == A Gtk.Dialog.Gtk_Dialog UI definition fragment. == <object class="GtkActionGroup" id="actiongroup"> <child> <object class="GtkAction" id="About"> <property name="name">About</property> <property name="stock_id">gtk-about</property> <signal handler="about_activate" name="activate"/> </object> <accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/> </child> </object>