## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --              GtkAda - Ada95 binding for Gtk+/Gnome                --

3.     --                                                                   --

4.     --                Copyright (C) 2006 AdaCore                         --

5.     --                                                                   --

6.     -- This library is free software; you can redistribute it and/or     --

7.     -- modify it under the terms of the GNU General Public               --

8.     -- License as published by the Free Software Foundation; either      --

9.     -- version 2 of the License, or (at your option) any later version.  --

10.     --                                                                   --

11.     -- This library is distributed in the hope that it will be useful,   --

12.     -- but WITHOUT ANY WARRANTY; without even the implied warranty of    --

13.     -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --

14.     -- General Public License for more details.                          --

15.     --                                                                   --

16.     -- You should have received a copy of the GNU General Public         --

17.     -- License along with this library; if not, write to the             --

18.     -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --

19.     -- Boston, MA 02111-1307, USA.                                       --

20.     --                                                                   --

21.     -- As a special exception, if other files instantiate generics from  --

22.     -- this unit, or you link this unit with other files to produce an   --

23.     -- executable, this  unit  does not  by itself cause  the resulting  --

24.     -- executable to be covered by the GNU General Public License. This  --

25.     -- exception does not however invalidate any other reasons why the   --

26.     -- executable file  might be covered by the  GNU Public License.     --

27.     -----------------------------------------------------------------------

29.     --  <description>

30.     --  This package provides an interface to the type system in Glib. These types

31.     --  provide an object-oriented framework (through inheritance and interfaces),

32.     --  as well as reference-counting, signals and properties on these types.

33.     --

34.     --  Most of the time, you DO NOT need to use this package, only when you are

35.     --  working with the introspection capabilities of glib.

36.     --

37.     --  See the other glib packages for more subprograms to manipulate these types.

38.     --  In particular, Glib.Properties describes the properties system, that

39.     --  provide the base for dynamic introspection. See also Glib itself, which

40.     --  contains several general subprograms, and Glib.Object that provides the

41.     --  root object for any type hierarchy based on glib.

42.     --  </description>

43.     --  <group>Glib, the general-purpose library</group>

45.     with Glib.ObjectTo API docTo specTo body;

46.     with System;

48.     package Glib.TypesTo API docTo specTo body is

50.        function Class_PeekTo API docTo body (T : GTypeTo API docTo spec) return Glib.GType_ClassTo API docTo spec;

51.        function Class_RefTo API docTo body  (T : GTypeTo API docTo spec) return Glib.GType_ClassTo API docTo spec;

52.        --  Return the class structure encapsulated in T.

53.        --  Class_Ref will create the class on-demand if it doesn't exist yet, but

54.        --  Class_Peek might return null if the class hasn't been referenced before.

55.        --  Class_Ref also increments the reference counting for the returned value

57.        procedure Class_UnrefTo API docTo body (T : GTypeTo API docTo spec);

58.        --  Decrement the reference counting on the associated class. When it

59.        --  reaches 0, the class may be finalized by the type system.

61.        function DepthTo API docTo body (T : GTypeTo API docTo spec) return GuintTo API docTo spec;

62.        --  Returns the length of the ancestry of the passed in type. This includes

63.        --  the type itself, so that e.g. a fundamental type has depth 1.

65.        function Is_ATo API docTo body (T : GTypeTo API docTo spec; Is_A_Type : GTypeTo API docTo spec) return Boolean;

66.        --  If Is_A_Type is a derivable type, check whether type is a descendant of

67.        --  Is_A_Type. If Is_A_Type is an interface, check whether type conforms to

68.        --  it.

70.        ----------------

71.        -- Interfaces --

72.        ----------------

73.        --  Interfaces are similar, in concept, to those found in Ada 2005 or in

74.        --  Java. They define a set of subprograms that any type implementing the

75.        --  interface must also define. They are different from standard inheritance

76.        --  since no implementation of these subprograms can be provided in the

77.        --  interface itself.

78.        --

79.        --  Whereas an object can only derive from one other object, it can

80.        --  implement any number of interfaces.

81.        --

82.        --  Some of the standard gtk+ objects implement interfaces. In this case,

83.        --  their Ada package contains one or more functions to convert from the

84.        --  object itself to the interface, for instance:

85.        --

86.        --      package Implements_Cell_Layout is new Glib.Types.Implements (...);

87.        --      function "+" (...) renames Implements_Cell_Layout.To_Interface;

88.        --      function "-" (...) renames Implements_Cell_Layout.To_Object;

89.        --

90.        --  The two unary operators "+" and "-" can be used to convert to and from

91.        --  the interface, for instance calling:

92.        --        View : Gtk_Cell_View;

93.        --        Gtk.Cell_Layout.Pack_Start (+View, Cell, Expand);

95.        type GType_Interface is private;

97.        --  <doc_ignore>

98.        generic

99.           type Interface_Type is new GType_InterfaceTo API docTo spec;

100.           type Object_Type_Record is new Glib.Object.GObject_RecordTo API docTo specTo body with private;

101.           type Object_Type is access all Object_Type_RecordTo API docTo spec'Class;

102.        package ImplementsTo API docTo body is

103.           function To_ObjectTo API docTo body (Interf : Interface_TypeTo API docTo spec) return Object_TypeTo API docTo spec;

104.           function To_InterfaceTo API docTo body

105.             (Object : access Object_Type_RecordTo API docTo spec'Class) return Interface_TypeTo API docTo spec;

106.           --  These subprograms can be used to convert from an object to one of

107.           --  the interfaces it implements, and from an interface to the object

108.           --  itself.

109.        end ImplementsTo API docTo specTo body;

110.        --  </doc_ignore>

112.        function To_ObjectTo API docTo body

113.          (Interf : GType_InterfaceTo API docTo spec) return Glib.Object.GObjectTo API docTo spec;

114.        --  Return the object that the interface represents. This is slightly

115.        --  different from using Implements.To_Object, in the case when the object

116.        --  wasn't created through Ada. In such a case, GtkAda needs to create an

117.        --  Ada wrapper around the object, and will choose a different tagged type:

118.        --     - Implements.To_Object creates a tagged type of type Object_Type.

119.        --     - This function creates a GObject, which you cannot cast easily

120.        --       to some other tagged type afterward.

121.        --  Both behave the same when the object was created from Ada.

123.        function InterfacesTo API docTo body (T : GTypeTo API docTo spec) return GType_ArrayTo API docTo spec;

124.        --  Return the list of interfaces implemented by objects of a given type.

126.        function Is_InterfaceTo API docTo body (T : GTypeTo API docTo spec) return Boolean;

127.        --  Whether T represents an interface type description

129.        function Default_Interface_PeekTo API docTo body

130.          (T : GTypeTo API docTo spec) return Glib.Object.Interface_VtableTo API docTo spec;

131.        function Default_Interface_RefTo API docTo body

132.          (T : GTypeTo API docTo spec) return Glib.Object.Interface_VtableTo API docTo spec;

133.        --  If the interface type T is currently in use, returns its default

134.        --  interface vtable.

135.        --  Default_Interface_Ref will create the default vtable for the type if the

136.        --  type is not currently in use. This is useful when you want to make sure

137.        --  that signals and properties for an interface have been installed.

139.     private

140.        type GType_InterfaceTo API docTo spec  is new System.Address;

142.        pragma Import (C, DepthTo API docTo spec,                  "g_type_depth");

143.        pragma Import (C, Class_PeekTo API docTo spec,             "g_type_class_peek");

144.        pragma Import (C, Class_RefTo API docTo spec,              "g_type_class_ref");

145.        pragma Import (C, Class_UnrefTo API docTo spec,            "g_type_class_unref");

146.        pragma Import (C, Default_Interface_PeekTo API docTo spec, "g_type_default_interface_peek");

147.        pragma Import (C, Default_Interface_RefTo API docTo spec,  "g_type_default_interface_ref");

148.     end Glib.TypesTo API docTo specTo body;