Description
Actions are organised into groups. An action group is essentially a map
from names to 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.
Accelerators are handled by the GTK+ accelerator map. All actions are
assigned an accelerator path (which normally has the form
"/group-name/action-name") and a shortcut is associated with this
accelerator path. All menu items and tool items take on this accelerator
path. The GTK+ accelerator map code makes sure that the correct shortcut is
displayed next to the menu item.
Types
-
type Action_Callback is access procedure
(Action : System.Address; User_Data : System.Address);
-
type Action_Entry_Array is array (Natural range <>) of Action_Entry;
-
type Gtk_Action_Group is access all Gtk_Action_Group_Record'Class;
-
-
-
type Toggle_Action_Entry is private;
Subprograms
-
procedure Gtk_New (Group : out Gtk_Action_Group; Name : String);
procedure Initialize
(Group : access Gtk_Action_Group_Record'Class; Name : String);
-
function Get_Type return GType;
-
function Get_Action
(Action_Group :
access Gtk_Action_Group_Record;
Action_Name : String)
return Gtk.Action.Gtk_Action;
-
function Get_Name
(Action_Group : access Gtk_Action_Group_Record) return String;
-
procedure Set_Sensitive
(Action_Group : access Gtk_Action_Group_Record; Sensitive : Boolean);
function Get_Sensitive
(Action_Group : access Gtk_Action_Group_Record) return Boolean;
-
procedure Set_Visible
(Action_Group : access Gtk_Action_Group_Record; Visible : Boolean);
function Get_Visible
(Action_Group : access Gtk_Action_Group_Record) return Boolean;
-
function List_Actions
(Action_Group : access Gtk_Action_Group_Record)
return Glib.Object.Object_Simple_List.Glist;
-
procedure Set_Translation_Domain
(Action_Group : access Gtk_Action_Group_Record;
Domain : String);
Adding and removing actions
-
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 Free (Actions : in out Toggle_Action_Entry_Array);
-
-
-
procedure Add_Action_With_Accel
(Action_Group :
access Gtk_Action_Group_Record;
Action :
access Gtk.Action.Gtk_Action_Record'Class;
Accelerator : String := "");
-
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);