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

# Package Gtk

This package provides some basic Gtk+ functionalities such as getting the version number. This is the top level package of the Gtk widget hierarchy. For general GtkAda initializations, see section Package Gtk.Main.

- Gtk Types
- Gtk Subprograms

## Types

    type Gtk_Notebook_Page is new Gdk.C_Proxy;
| A page of the notebook. It can contain a single child, and is also associated with a tab label used to select that page in the notebook.
    type Gtk_Rc_Style is new Gdk.C_Proxy;
| Type used to handle resource styles. See package Gtk.Rc for more details.
    type Gtk_Type is new Guint;
| This type describes an internal type in Gtk+. You shouldn't have to use it in your own applications, however it might be useful sometimes. Every widget type is associated with a specific value, created dynamically at run time the first time you instantiate a widget of that type (thus if you have never used a Gtk_File_Selection, it won't have any Gtk_Type associated with it). You can get the exact type value for each type by using the functions Get_Type provided in all the packages in GtkAda. You can get the specific value for an existing widget by using the function Gtk.Object.Get_Type.
    type Root_Type is tagged private;
| The base type of the hierarchy in GtkAda. It basically gives access to an underlying C object. This is not a controlled type, for efficiency reasons, and because gtk+ takes care of memory management on its own.

## Subprograms

    function Major_Version         return Guint;
| Return the major version number for Gtk+. Note that this is not necessarily the same as for GtkAda. If the version is 1.2.6, returns 1.
    function Minor_Version         return Guint;
| Return the minor version number for Gtk+. Note that this is not necessarily the same as for GtkAda. If the version is 1.2.6, returns 2.
    function Micro_Version         return Guint;
| Return the micro version number for Gtk+. Note that this is not necessarily the same as for GtkAda. If the version is 1.2.6, returns 6.
    function Gtk_Type_Gdk_Event    return Gtk_Type;
| Return the type corresponding to a Gdk_Event. Note that this function must be called after Gtk+ has been initialized.
    function Type_Name
      (Type_Num           : in     Gtk_Type)
       return String;
| Return the type name corresponding to a Gtk_Type. This might be useful in debug messages.
    function Type_From_Name
      (Name               : in     String)
       return Gtk_Type;
| Convert a string to the matching type. Name should be the C widget's name, such as GtkScrollbar or GtkButton, rather than the Ada name.
    function Is_Created
      (Object             : in     Root_Type'Class)
       return Boolean;
| Return True if the associated C object has been created, False if no C object is associated with Object. This is not the same as testing whether an access type (for instance any of the widgets) is "null", since this relates to the underlying C object.
### Interfacing with C
The following functions are made public so that one can easily create new widgets outside the Gtk package hierarchy. Only experienced users should make use of these functions.
    function Get_Object
      (Object             : access Root_Type'Class)
       return System.Address;
| Access the underlying C pointer.
    procedure Set_Object
      (Object             : access Root_Type'Class;
       Value              : in     System.Address);
| Modify the underlying C pointer.
    procedure Initialize_User_Data
      (Obj                : access Root_Type'Class);
| Sets a user data field for the C object associated with Obj. This field will be used so that it is possible, knowing a C object, to get the full ada object.
    function Get_User_Data
      (Obj                : in     System.Address;
       Stub               : in     Root_Type'Class)
       return Root_Type_Access;
| Get the user data that was set by GtkAda. If the Data is not set, return a new access type, that points to a structure with the same tag as Stub.
    function Unchecked_Cast
      (Obj                : access Root_Type'Class;
       Stub               :        Root_Type'Class)
       return Root_Type_Access;
| Cast Obj in an object of tag Stub'Class. Return the resulting object and free the memory pointed by Obj.
    function Count_Arguments
      (The_Type           :        Gtk_Type;
       Name               : in     String)
       return Guint;
| Return the number of arguments used in the handlers for the signal. Note that in the Connect functions, we always test whether the user has asked for *at most* the number of arguments defined by gtk+ for the callback. This is because having less argument is authorized (the extra parameters passed by gtk+ will simply be ignored), whereas having more arguments is impossible (they would never be set). Note that we provide this procedure here to avoid circularities.
    function Argument_Type
      (The_Type           :        Gtk_Type;
       Name               : in     String;
       Num                : in     Gint)
       return Gtk_Type;
| Return the type of the num-th argument for the handlers of signal name. If Num is negative, return the type returned by the handlers for this signal. Note that we provide this procedure here to avoid circularities.

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