[Contents] [Back] [Prev] [Up] [Next] [Forward]

Copyright (C) 1998-2000, Emmanuel Briot, Joel Brobecker, Arnaud Charlet

Copyright (C) 2000-2001, ACT-Europe

# Package Glib

This package provides definitions for the basic types used in Glib, Gdk and Gtk.

- Glib Types
- Glib Subprograms

## Types

    type Boolean_Array is array (Natural range <>) of Boolean;
    type C_Proxy is access C_Dummy;
| General proxy for C structures. This type is used instead of System.Address so that the variables are automatically initialized to 'null'. The value pointed to is irrelevant, and in fact should not be accessed. It has thus been made limited private with no subprogram to access it. C_Proxy is a public type so that one can compare directly the value of the variables with 'null'.
    type GQuark is new Guint32;
| Represents a string internally in GtkAda. Once you know the equivalent for a string, you can always use it instead of the string, which provides a faster access for all the functions that use htables in GtkAda. There is a global htable that contains all the quarks defined in your application and GtkAda itself.
    type Gboolean is new Gint;
    type Gboolean_Array is array (Natural range <>) of Gboolean;
    type Gchar is new C.char;
    type Gdouble is new C.double;
    type Gdouble_Array is array (Natural range <>) of Gdouble;
    type Gfloat is new C.C_float;
    type Gfloat_Array is array (Natural range <>) of Gfloat;
    type Gint is new C.int;
    subtype Gint16 is Gint range -(2 ** 15) .. (2 ** 15 - 1);
    subtype Gint32 is Gint range -(2 ** 31) .. (2 ** 31 - 1);
    subtype Gint8 is Gint range -(2 ** 7) .. (2 ** 7 - 1);
    type Gint_Array is array (Natural range <>) of Gint;
    type Glong is new C.long;
    type Glong_Array is array (Natural range <>) of Glong;
    type Gshort is new C.short;
    type Gshort_Array is array (Natural range <>) of Gshort;
    type Guchar is new C.unsigned_char;
    type Guchar_Array is array (Natural range <>) of Guchar;
    type Guchar_Array_Access is access Guchar_Array;
    type Guint is new C.unsigned;
    subtype Guint16 is Guint range Guint'First .. (2 ** 16 - 1);
    subtype Guint32 is Guint range Guint'First .. (2 ** 32 - 1);
    type Guint32_Array is array (Natural range <>) of Guint32;
    subtype Guint8 is Guint range Guint'First .. (2 ** 8 - 1);
    type Guint_Array is array (Natural range <>) of Guint;
    type Gulong is new C.unsigned_long;
    type Gulong_Array is array (Natural range <>) of Gulong;
    type Gushort is new C.unsigned_short;
    type Gushort_Array is array (Natural range <>) of Gushort;
    type Long_Array is array (Natural range <>) of C.long;
    type Short_Array is array (Natural range <>) of C.short;
    type String_Ptr is access all String;

## Subprograms

### Conversion services
    function To_Boolean_Array
      (A                  : in     Gboolean_Array)
       return Boolean_Array;
| Convert a C-style boolean array into an Ada-style array.
    function To_Boolean
      (Value              : in     Gboolean)
       return Boolean;
| Convert a C boolean into an Ada boolean.
    function To_Boolean
      (Value              : in     Gint)
       return Boolean;
| Convert a C int into an Ada boolean.
    function To_Boolean
      (Value              : in     Guint)
       return Boolean;
| Convert a C uint into an Ada boolean.
    function To_Gboolean
      (Bool               : in     Boolean)
       return Gboolean;
| Convert an Ada boolean into a C boolean.
    function To_Gint
      (Bool               : in     Boolean)
       return Gint;
| Convert an Ada boolean into a C int.
### Quarks
    function Quark_From_String
      (Id                 : in     String)
       return GQuark;
| Return, or create the quark associated with the string. Note that if the quark does not already exist, an entry is created for it in the global htable for quarks.
    function Quark_Try_String
      (Id                 : in     String)
       return GQuark;
| Return the quark associated with the string, if it exists. If it does not exist, return Unknown_Quark.

[Contents] [Back] [Prev] [Up] [Next] [Forward]