Index

Package: Type_Conversion_Hooks

Description

package Glib.Type_Conversion_Hooks is

This package provides an implementation for hooks used in Gtk.Type_Conversion. These hooks should be used when you import a new C GObject, so that GtkAda can recreate the Ada structure from the underlying C structure.

Note that when you create a GObject directly in Ada, you do not need to provide any hook.

Implementation note: This is a separate package from Gtk.Type_Conversion so that adding a hook does not necessarily mean the user has to 'with' Gtk.Type_Conversion, and thus all the packages from GtkAda.

Note that this package is not thread safe. You should call the function Add_Hook from the elaboration part of your packages.

Packages

Hook_Registrator (generic)

This package is used to allow automatic conversion from a C gtk object to Ada. To allow GtkAda to automatically bind an incoming externally created widget to the correct Ada type, you just need to instantiate this package, that will then automatically register the appropriate conversion methods.

Types

Get_GType_Func

type Get_GType_Func is access function return Glib.GType;

Conversion_Creator_Hook_Type

type Conversion_Creator_Hook_Type is
     access function (Expected_Object : GObject_Record'Class) return GObject;

Subprograms & Entries

Conversion_Function

function Conversion_Function 
(Obj: System.Address;
Stub: GObject_Record'Class) return GObject;
This function has to convert a C object to an Ada object. It will first try all the registered functions (in Glib.Type_Conversion_Hooks). If no match is found, then it will try recursively all parents of the C object. If no match is found at all, it will create an object of type Expected_Type, no matter what the real C type is.