This package contains top-level subprograms that are used to initialize GtkAda and interact with the main event loop.
It also provides a set of packages to set up idle functions, timeout functions, and functions to be called before and after entering the main loop.
Types |
---|
type Idle_Callback is access function return Boolean; | |
Function that can be called automatically whenever GtkAda is not
processing events.
It should return True if the function should be called again as soon
as possible, False if it should be unregistered.
| |
type Idle_Handler_Id is new Guint; | |
Id for Idle handlers.
| |
type Idle_Priority is new Guint; | |
Priorities that can be set for idle handlers.
The higher the priority, the less urgent the task. Handlers whose
priority is lower will be called before others.
| |
type Init_Function is access procedure (Data : System.Address); | |
Function called just before starting the main loop.
This can be registered with Init_Add below.
| |
type Quit_Function is access function return Boolean; | |
Type of function that can be called when the main loop exits.
It should return False if it should not be called again when another
main loop exits.
| |
type Quit_Handler_Id is new Guint; | |
registration ID for functions that will be called before the
main loop exits.
| |
type Timeout_Callback is access function return Boolean; | |
Function that can be called automatically at precise time intervals.
It should return True if the function should be called again as soon
as possible, False if it should be unregistered.
| |
type Timeout_Handler_Id is new Guint; | |
Id for Timeout handlers.
|
Subprograms |
---|
Initialization and exit routines | ||
procedure Init; | ||
Initialize GtkAda's internal structures. | ||
function Init_Check return Boolean; | ||
Initialize GtkAda's internal structures. | ||
procedure Gtk_Exit (Error_Code : in Gint); | ||
Terminate GtkAda cleanly, and quits the application.
| ||
function Set_Locale return String; | ||
Read and parse the local settings, such as time format, ... | ||
procedure Set_Locale; | ||
Read and parse the local settings, such as time format, ...
| ||
Init and Quit functions | ||
procedure Init_Add (Func : Init_Function; Data : System.Address); | ||
Register a function to be called just before starting a main loop. | ||
function Quit_Add (Main_Level : Guint; Func : Quit_Function) return Quit_Handler_Id; | ||
Register a new function to be called when the current main loop exits. | ||
function Quit_Add_Destroy (Main_Level : Guint; Object : access Gtk.Object.Gtk_Object_Record'Class) return Quit_Handler_Id; | ||
Ensure that Object is destroyed when exiting the main loop at Main_Level | ||
procedure Quit_Remove (Id : Quit_Handler_Id); | ||
Remove a Quit Handler, that has been previously set by Quit_Add.
| ||
The main loop | ||
function Events_Pending return Boolean; | ||
Return True if there are some events waiting in the event queue.
| ||
procedure Main; | ||
Start the main loop, and returns only when the main loop is exited. | ||
function Main_Level return Guint; | ||
Return the level of the current main loop. | ||
procedure Main_Quit; | ||
Quit the current main loop. | ||
function Main_Iteration (Blocking : in Boolean := True) return Boolean; | ||
Do one iteration of the main loop. while Gtk.Main.Events_Pending loop Dead := Gtk.Main.Main_Iteration;
end loop;
| ||
procedure Do_Event (Event : in Gdk.Event.Gdk_Event); | ||
Process Event as if it was in the event queue. | ||
function Get_Event_Widget (Event : in Gdk.Event.Gdk_Event) return Gtk.Widget.Gtk_Widget; | ||
Return the widget to which Event applies.
| ||
Grab functions | ||
procedure Grab_Add (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); | ||
Add a new widget to the grab list. | ||
procedure Grab_Remove (Widget : access Gtk.Widget.Gtk_Widget_Record'Class); | ||
Remove a widget from the grab list.
| ||
function Grab_Get_Current return Gtk.Widget.Gtk_Widget; | ||
Return the widget that currently has the focus.
| ||
Idle | ||
GtkAda gives the possibility to register Idle functions.
Two versions are given, either with a user data or with none.
| ||
function Idle_Add (Cb : in Idle_Callback; Priority : in Idle_Priority := Priority_Default_Idle) return Idle_Handler_Id; | ||
Register an idle callback with no user data.
| ||
procedure Idle_Remove (Id : in Idle_Handler_Id); | ||
Remove an idle callback, when its Id is known.
| ||
Timeout | ||
A timeout is a function that is called after a specified amount In case your timeout function takes longer to execute than the specific delay (for instance it takes 200ms for an internal of 100ms), then no invocation is queued, and they are simply discarded. There is no queue of expired timers. On the other hand, standard events are still processed, but slowly (since they have the same priority as timeouts).
The redrawing and resizing of widgets, which are being done as idles
with lower priority will not take place.
| ||
function Timeout_Add (Interval : in Guint32; Func : Timeout_Callback) return Timeout_Handler_Id; | ||
Add a new timeout. Func will be called after Interval milliseconds. | ||
procedure Timeout_Remove (Id : in Timeout_Handler_Id); | ||
Unregister a timeout function.
|