package Gtk_Application_Inhibit_Flags_Properties is new Generic_Internal_Discrete_Property (Gtk_Application_Inhibit_Flags);
package Implements_Gaction_Group is new Glib.Types.Implements (Glib.Action_Group.Gaction_Group, Gtk_Application_Record, Gtk_Application);
package Implements_Gaction_Map is new Glib.Types.Implements (Glib.Action_Map.Gaction_Map, Gtk_Application_Record, Gtk_Application);
type Gtk_Application_Record is new Gapplication_Record with null record;
type Gtk_Application is access all Gtk_Application_Record'Class;
type Property_Gtk_Application_Inhibit_Flags is new Gtk_Application_Inhibit_Flags_Properties.Property;
type Cb_Gtk_Application_Gtk_Window_Void is not null access procedure (Self : access Gtk_Application_Record'Class; Window : not null access Gtk.Window.Gtk_Window_Record'Class);
type Cb_GObject_Gtk_Window_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Window : not null access Gtk.Window.Gtk_Window_Record'Class);
Application_Inhibit_Logout : constant Gtk_Application_Inhibit_Flags := 1;
Application_Inhibit_Switch : constant Gtk_Application_Inhibit_Flags := 2;
Application_Inhibit_Suspend : constant Gtk_Application_Inhibit_Flags := 4;
Application_Inhibit_Idle : constant Gtk_Application_Inhibit_Flags := 8;
Active_Window_Property : constant Glib.Properties.Property_Object;
App_Menu_Property : constant Glib.Properties.Property_Boxed;
Menubar_Property : constant Glib.Properties.Property_Boxed;
Register_Session_Property : constant Glib.Properties.Property_Boolean;
Signal_Window_Added : constant Glib.Signal_Name := "window-added";
Signal_Window_Removed : constant Glib.Signal_Name := "window-removed";
procedure Gtk_New
( | Self | : out Gtk_Application; |
Application_Id | : UTF8_String := ""; | |
Flags | : Glib.Application.GApplication_Flags); |
procedure Initialize
( | Self | : not null access Gtk_Application_Record'Class; |
Application_Id | : UTF8_String := ""; | |
Flags | : Glib.Application.GApplication_Flags); |
function Gtk_Application_New
( | Application_Id | : UTF8_String := ""; |
Flags | : Glib.Application.GApplication_Flags) return Gtk_Application; |
function Get_Type return Glib.GType;
procedure Add_Accelerator
( | Self | : not null access Gtk_Application_Record; |
Accelerator | : UTF8_String; | |
Action_Name | : UTF8_String; | |
Parameter | : Glib.Variant.Gvariant); |
procedure Add_Window
( | Self | : not null access Gtk_Application_Record; |
Window | : not null access Gtk.Window.Gtk_Window_Record'Class); |
function Get_Active_Window
( | Self | : not null access Gtk_Application_Record) return Gtk.Window.Gtk_Window; |
function Get_App_Menu
( | Self | : not null access Gtk_Application_Record) return Glib.Menu_Model.Gmenu_Model; |
procedure Set_App_Menu
( | Self | : not null access Gtk_Application_Record; |
App_Menu | : access Glib.Menu_Model.Gmenu_Model_Record'Class); |
function Get_Menubar
( | Self | : not null access Gtk_Application_Record) return Glib.Menu_Model.Gmenu_Model; |
procedure Set_Menubar
( | Self | : not null access Gtk_Application_Record; |
Menubar | : access Glib.Menu_Model.Gmenu_Model_Record'Class); |
function Get_Window_By_Id
( | Self | : not null access Gtk_Application_Record; |
Id | : Guint) return Gtk.Window.Gtk_Window; |
function Get_Windows
( | Self | : not null access Gtk_Application_Record) return Gtk.Widget.Widget_List.Glist; |
function Inhibit
( | Self | : not null access Gtk_Application_Record; |
Window | : access Gtk.Window.Gtk_Window_Record'Class; | |
Flags | : Gtk_Application_Inhibit_Flags; | |
Reason | : UTF8_String := "") return Guint; |
function Is_Inhibited
( | Self | : not null access Gtk_Application_Record; |
Flags | : Gtk_Application_Inhibit_Flags) return Boolean; |
procedure Remove_Accelerator
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String; | |
Parameter | : Glib.Variant.Gvariant); |
procedure Remove_Window
( | Self | : not null access Gtk_Application_Record; |
Window | : not null access Gtk.Window.Gtk_Window_Record'Class); |
procedure Uninhibit
( | Self | : not null access Gtk_Application_Record; |
Cookie | : Guint); |
procedure Action_Added
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String); |
procedure Action_Enabled_Changed
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String; | |
Enabled | : Boolean); |
procedure Action_Removed
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String); |
procedure Action_State_Changed
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String; | |
State | : Glib.Variant.Gvariant); |
procedure Activate_Action
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String; | |
Parameter | : Glib.Variant.Gvariant); |
procedure Change_Action_State
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String; | |
Value | : Glib.Variant.Gvariant); |
function Get_Action_Enabled
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Boolean; |
function Get_Action_Parameter_Type
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Glib.Variant.Gvariant_Type; |
function Get_Action_State
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Glib.Variant.Gvariant; |
function Get_Action_State_Hint
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Glib.Variant.Gvariant; |
function Get_Action_State_Type
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Glib.Variant.Gvariant_Type; |
function Has_Action
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Boolean; |
function List_Actions
( | Self | : not null access Gtk_Application_Record) return GNAT.Strings.String_List; |
function Query_Action
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String; | |
Enabled | : access Boolean; | |
Parameter_Type | : access Glib.Variant.Gvariant_Type; | |
State_Type | : access Glib.Variant.Gvariant_Type; | |
State_Hint | : access Glib.Variant.Gvariant; | |
State | : access Glib.Variant.Gvariant) return Boolean; |
procedure Add_Action
( | Self | : not null access Gtk_Application_Record; |
Action | : Glib.Action.Gaction); |
procedure Add_Action_Entries
( | Self | : not null access Gtk_Application_Record; |
Entries | : GAction_Entry_Array; | |
User_Data | : System.Address := System.Null_Address); |
function Lookup_Action
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String) return Glib.Action.Gaction; |
procedure Remove_Action
( | Self | : not null access Gtk_Application_Record; |
Action_Name | : UTF8_String); |
procedure On_Window_Added
( | Self | : not null access Gtk_Application_Record; |
Call | : Cb_Gtk_Application_Gtk_Window_Void; | |
After | : Boolean := False); |
procedure On_Window_Added
( | Self | : not null access Gtk_Application_Record; |
Call | : Cb_GObject_Gtk_Window_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Window_Removed
( | Self | : not null access Gtk_Application_Record; |
Call | : Cb_Gtk_Application_Gtk_Window_Void; | |
After | : Boolean := False); |
procedure On_Window_Removed
( | Self | : not null access Gtk_Application_Record; |
Call | : Cb_GObject_Gtk_Window_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Application_Record'Class) return Glib.Action_Group.Gaction_Group renames Implements_Gaction_Group.To_Interface; |
function "-"
( | Interf | : Glib.Action_Group.Gaction_Group) return Gtk_Application renames Implements_Gaction_Group.To_Object; |
function "+"
( | Widget | : access Gtk_Application_Record'Class) return Glib.Action_Map.Gaction_Map renames Implements_Gaction_Map.To_Interface; |
function "-"
( | Interf | : Glib.Action_Map.Gaction_Map) return Gtk_Application renames Implements_Gaction_Map.To_Object; |
Gtk.Application.Gtk_Application is a class that handles many important aspects of a GTK+ application in a convenient fashion, without enforcing a one-size-fits-all application model.
Currently, GtkApplication handles GTK+ initialization, application uniqueness, session management, provides some basic scriptability and desktop shell integration by exporting actions and menus and manages a list of toplevel windows whose life-cycle is automatically tied to the life-cycle of your application.
While GtkApplication works fine with plain Gtk_Windows, it is recommended to use it together with Gtk.Application_Window.Gtk_Application_Window.
When GDK threads are enabled, GtkApplication will acquire the GDK lock when invoking actions that arrive from other processes. The GDK lock is not touched for local action invocations. In order to have actions invoked in a predictable context it is therefore recommended that the GDK lock be held while invoking actions locally with Glib.Action_Group.Activate_Action. The same applies to actions associated with Gtk.Application_Window.Gtk_Application_Window and to the 'activate' and 'open' Glib.Application.Gapplication methods.
To set an application menu for a GtkApplication, use Gtk.Application.Set_App_Menu. The Glib.Menu_Model.Gmenu_Model that this function expects is usually constructed using Gtk.Builder.Gtk_Builder, as seen in the following example. To specify a menubar that will be shown by Gtk_Application_Windows, use Gtk.Application.Set_Menubar. Use the base Glib.Action_Map.Gaction_Map interface to add actions, to respond to the user selecting these menu items.
GTK+ displays these menus as expected, depending on the platform the application is running on. <figure label="Menu integration in OS X"> <graphic fileref="bloatpad-osx.png" format="PNG"/> </figure> <figure label="Menu integration in GNOME"> <graphic fileref="bloatpad-gnome.png" format="PNG"/> </figure> <figure label="Menu integration in Xfce"> <graphic fileref="bloatpad-xfce.png" format="PNG"/> </figure>
== A simple application == <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../examples/bloatpad.c"> <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback> </xi:include> GtkApplication optionally registers with a session manager of the users session (if you set the Gtk.Application.Gtk_Application:register-session property) and offers various functionality related to the session life-cycle.
An application can block various ways to end the session with the Gtk.Application.Inhibit function. Typical use cases for this kind of inhibiting are long-running, uninterruptible operations, such as burning a CD or performing a disk backup. The session manager may not honor the inhibitor, but it can be expected to inform the user about the negative consequences of ending the session while inhibitors are present. </description>