Gtkada.Bindings

Entities

Simple Types

Access Types

Subprograms

Generic Instantiations

Description

This is a unit purely internal to GtkAda, to ease binding and avoid code duplication. Do not use in your own applications, since the interface might change from release to release. See also Gtkada.Types

C_Marshaller

type C_Marshaller is access procedure
  (Closure         : GClosure;
   Return_Value    : Glib.Values.GValue;
   N_Params        : Glib.Guint;
   Params          : Glib.Values.C_GValues;
   Invocation_Hint : System.Address;
   Marsh_Data      : System.Address);

A function called directly from gtk+ when dispatching signals to handlers. This procedure is in charge of converting the parameters from the array of GValues in Params to suitable formats for calling the proper Ada handler given by the user. This handler is encoded in the user_data, which has an actual type specific to each of the generic packages below. Marsh_Data is the data passed via Set_Meta_Marshal, null otherwise. This is meant for internal GtkAda use only.

Parameters
Closure
Return_Value

Will contain returned value

N_Params

Number of entries in Params

Params
Invocation_Hint
Marsh_Data

CClosure_New

function CClosure_New
  (Callback  : System.Address;
   User_Data : System.Address;
   Destroy   : System.Address) return GClosure
Parameters
Callback
User_Data
Destroy
Return Value

chars_ptr_array_access

type chars_ptr_array_access
  is access Gtkada.Types.Chars_Ptr_Array (Interfaces.C.size_t);

Suitable for a C function that returns a gchar**

Exception_Handler

type Exception_Handler is not null access procedure
   (Occurrence : Ada.Exceptions.Exception_Occurrence);
Parameters
Occurrence

From_String_List

function From_String_List
  (C : GNAT.Strings.String_List) return Gtkada.Types.Chars_Ptr_Array

Converts C into a chars_ptr_array. Returned value must be freed by caller, as well as C.

Parameters
C
Return Value

g_strfreev

procedure g_strfreev (Str_Array : chars_ptr_array_access)

Thin binding to C function of the same name. Frees a null-terminated array of strings, and the array itself. If called on a null value, simply return.

Parameters
Str_Array

GClosure

type GClosure is new Glib.C_Proxy;

Generic_To_Address_Or_Null

generic
   type T is private;
   Null_T : T;
   with function "=" (T1, T2 : T) return Boolean is <>;
function Generic_To_Address_Or_Null
  (Val : System.Address) return System.Address

Return either a Null_Address or a pointer to Val, depending on whether Val is the null value for the type. In all cases, Val is supposed to be an access to T. In Ada2012, these could be replaced with expression functions instead.

Generic formal parameters
T
Null_T
"="
Parameters
Val
Return Value

Get_Callback

function Get_Callback (C : GClosure) return System.Address

Return the user handler set in the closure. This is the procedure that should process the signal.

Parameters
C
Return Value

Get_Data

function Get_Data (Closure : GClosure) return System.Address
Parameters
Closure
Return Value

Gint_Arrays

package Gint_Arrays is new Gtkada.C.Unbounded_Arrays
  (Glib.Gint, 0, Natural, Glib.Gint_Array);

GType_Arrays

package GType_Arrays is new Gtkada.C.Unbounded_Arrays
  (Glib.GType, Glib.GType_None, Glib.Guint, Glib.GType_Array);

Process_Exception

procedure Process_Exception (E : Ada.Exceptions.Exception_Occurrence)

Process the exception through the handler set by Set_On_Exception. This procedure never raises an exception.

Parameters
E

Pspec_Arrays

package Pspec_Arrays is new Gtkada.C.Unbounded_Arrays
  (Glib.Param_Spec, null, Natural, Glib.Param_Spec_Array);

Set_Marshal

procedure Set_Marshal (Closure : GClosure; Marshaller : C_Marshaller)
Parameters
Closure
Marshaller

Set_Meta_Marshal

procedure Set_Meta_Marshal
  (Closure    : GClosure;
   Marsh_Data : System.Address;
   Marshaller : C_Marshaller)
Parameters
Closure
Marsh_Data
Marshaller

Set_On_Exception

procedure Set_On_Exception (Handler : Exception_Handler)

See user documentation in Gtk.Handlers.Set_On_Exception

Parameters
Handler

Set_Value

procedure Set_Value (Value : Glib.Values.GValue; Val : System.Address)

Function used internally to specify the value returned by a callback. Val will be dereferenced as appropriate, depending on the type expected by Value.

Parameters
Value
Val

String_Or_Null

function String_Or_Null (S : String) return Gtkada.Types.Chars_Ptr

Return Null_Ptr if S is the empty string, or a newly allocated string otherwise. This is intended mostly for the binding itself.

Parameters
S
Return Value

String_Or_Null

function String_Or_Null (S : String) return ICS.chars_ptr

Return Null_Ptr if S is the empty string, or a newly allocated string otherwise. This is intended mostly for the binding itself.

Parameters
S
Return Value

To_Chars_Ptr

function To_Chars_Ptr
  (C : chars_ptr_array_access) return Gtkada.Types.Chars_Ptr_Array

Return a bounded array that contains the same strings as C (so you shouldn't free C). 'Last applies to the result, whereas it doesn't to C.

Parameters
C
Return Value

To_Gint_Array_Zero_Terminated

function To_Gint_Array_Zero_Terminated
  (Arr : Gint_Arrays.Unbounded_Array_Access)
   return Glib.Gint_Array

Converts Arr, stopping at the first 0 encountered

Parameters
Arr
Return Value

To_String_List

function To_String_List
  (C : Gtkada.Types.Chars_Ptr_Array) return GNAT.Strings.String_List

Converts C into a String_List. Returned value must be freed by caller, as well as C. C is NULL terminated.

Parameters
C
Return Value

To_String_List

function To_String_List
  (C : Gtkada.Types.Chars_Ptr_Array; N : Glib.Gint)
   return GNAT.Strings.String_List

Converts C into a String_List. N is the number of elements in C. Returned value must be freed by caller, as well as C.

Parameters
C
N
Return Value

To_String_List_And_Free

function To_String_List_And_Free
  (C : chars_ptr_array_access) return GNAT.Strings.String_List

Converts C into a String_List, and frees C. Returned value must be freed by caller.

Parameters
C
Return Value

Unchecked_Do_Signal_Connect

procedure Unchecked_Do_Signal_Connect
  (Object              : Glib.Types.GType_Interface;
   C_Name              : Glib.Signal_Name;
   Marshaller          : C_Marshaller;
   Handler             : System.Address;
   Destroy             : System.Address := System.Null_Address;
   After               : Boolean := False;
   Slot_Object         : access Glib.Object.GObject_Record'Class := null)

Same as above, but this removes a number of check, like whether the signal exists, and whether the user has properly passed a procedure or function depending on the signal type.

Parameters
Object
C_Name
Marshaller
Handler
Destroy
After
Slot_Object

Unchecked_Do_Signal_Connect

procedure Unchecked_Do_Signal_Connect
  (Object              : not null access Glib.Object.GObject_Record'Class;
   C_Name              : Glib.Signal_Name;
   Marshaller          : C_Marshaller;
   Handler             : System.Address;
   Destroy             : System.Address := System.Null_Address;
   After               : Boolean := False;
   Slot_Object         : access Glib.Object.GObject_Record'Class := null)

Same as above, but this removes a number of check, like whether the signal exists, and whether the user has properly passed a procedure or function depending on the signal type.

Parameters
Object
C_Name
Marshaller
Handler
Destroy
After
Slot_Object

Value_Allowing_Null

function Value_Allowing_Null
  (Str : Gtkada.Types.Chars_Ptr) return Glib.Signal_Name

Return the value stored in Str, and an empty string if Str is null.

Parameters
Str
Return Value

Value_Allowing_Null

function Value_Allowing_Null
  (Str : Gtkada.Types.Chars_Ptr) return String

Return the value stored in Str, and an empty string if Str is null.

Parameters
Str
Return Value

Value_Allowing_Null

function Value_Allowing_Null
  (Str : Interfaces.C.Strings.chars_ptr) return Glib.Signal_Name

Return the value stored in Str, and an empty string if Str is null.

Parameters
Str
Return Value

Value_Allowing_Null

function Value_Allowing_Null
  (Str : Interfaces.C.Strings.chars_ptr) return String

Return the value stored in Str, and an empty string if Str is null.

Parameters
Str
Return Value

Value_And_Free

function Value_And_Free
  (Str : Gtkada.Types.Chars_Ptr) return String

Returns the value stored in Str, and free the memory occupied by Str.

Parameters
Str
Return Value

Value_And_Free

function Value_And_Free
  (Str : Interfaces.C.Strings.chars_ptr) return String

Returns the value stored in Str, and free the memory occupied by Str.

Parameters
Str
Return Value

Watch_Closure

procedure Watch_Closure (Object : System.Address; Closure : GClosure)

The closure will be destroyed when Object is destroyed.

Parameters
Object
Closure