## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

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

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

3.     --                                                                   --

4.     --                Copyright (C) 2001-2009, 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 generic values as used in the

31.     --  Glib object model.

32.     --

33.     --  The main type in this package is GValues, which is the

34.     --  equivalent of the C's (GValue*) array, i.e an array of unions.  This

35.     --  package provides functions to extract the values from this type.

36.     --  </description>

37.     --  <c_version>1.3.15</c_version>

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

40.     with System;

41.     with Interfaces.C.Strings;

43.     with Glib.ObjectTo API docTo specTo body;

45.     package Glib.ValuesTo API docTo specTo body is

47.        --  <doc_ignore>Do not create automatic documentation for this package

49.        type GValueTo API docTo body is private;

50.        --  A generic value that can hold any of the types as provided in the

51.        --  Set and Get functions below.

53.        type GValuesTo API docTo body is private;

54.        --  This type represents a table of values. Each argument of the

55.        --  table can be of any type.

56.        --  The index of the first element is always 1.

58.        type GValue_Array is array (GintTo API docTo spec range <>) of GValueTo API docTo specTo body;

60.        function Make_ValuesTo API docTo body (Nb : GuintTo API docTo spec) return GValuesTo API docTo specTo body;

61.        --  Create a new GValues structure from scratch. This procedure

62.        --  causes the allocation of an underlying C array, and this memory

63.        --  should be deallocated after use using procedure Free (see below).

65.        function Make_ValuesTo API docTo body (Nb : GuintTo API docTo spec; Val : System.Address) return GValuesTo API docTo specTo body;

66.        --  Build a GValues structure from the given C array. Nb should be the

67.        --  number of elements in the Values array.

69.        procedure FreeTo API docTo body (ValTo API docTo body : in out GValuesTo API docTo specTo body);

70.        --  Deallocate the memory associated with the given Values array.

72.        function NthTo API docTo body (ValTo API docTo body : GValuesTo API docTo specTo body; Num : GuintTo API docTo spec) return GValueTo API docTo specTo body;

73.        --  Return the Num-th element from Values.

75.        -------------------------------------------------

76.        -- Conversion functions, interfacing to GValue --

77.        -------------------------------------------------

79.        procedure InitTo API docTo body (ValueTo API docTo body : in out GValueTo API docTo specTo body; G_Type : Glib.GTypeTo API docTo spec);

80.        --  Set the type of Value to G_Type. This limits the operations you can then

81.        --  apply to Value. For instance, Value must have been initialized with

82.        --  a GType_Int before you can use Set_Int (see below).

83.        --  Note that for enumeration types, you shouldn't use GType_Enum, but

84.        --  rather the exact GType corresponding to the enumeration.

85.        --  If you need to store a reference-counted type in a GValue, it is

86.        --  recommanded that you use a type derived from Boxed (see Set_Boxed below)

88.        procedure UnsetTo API docTo body (Value : in out GValueTo API docTo specTo body);

89.        --  Frees the memory allocate for Value (like strings contents) in the call

90.        --  to Init. You only need to call this function in cases where you have

91.        --  called Init yourself.

93.        procedure Set_CharTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Char : GcharTo API docTo spec);

94.        function  Get_CharTo API docTo body (Value : GValueTo API docTo specTo body) return GcharTo API docTo spec;

96.        procedure Set_UcharTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Uchar : GucharTo API docTo spec);

97.        function  Get_UcharTo API docTo body (Value : GValueTo API docTo specTo body) return GucharTo API docTo spec;

99.        procedure Set_BooleanTo API docTo body (ValueTo API docTo body : in out GValueTo API docTo specTo body; V_Boolean : Boolean);

100.        function  Get_BooleanTo API docTo body (ValueTo API docTo body : GValueTo API docTo specTo body) return Boolean;

102.        procedure Set_IntTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Int : GintTo API docTo spec);

103.        function  Get_IntTo API docTo body (Value : GValueTo API docTo specTo body) return GintTo API docTo spec;

105.        procedure Set_UintTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Uint : GuintTo API docTo spec);

106.        function  Get_UintTo API docTo body (Value : GValueTo API docTo specTo body) return GuintTo API docTo spec;

108.        procedure Set_LongTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Long : GlongTo API docTo spec);

109.        function  Get_LongTo API docTo body (Value : GValueTo API docTo specTo body) return GlongTo API docTo spec;

111.        procedure Set_UlongTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Ulong : GulongTo API docTo spec);

112.        function  Get_UlongTo API docTo body (Value : GValueTo API docTo specTo body) return GulongTo API docTo spec;

114.        procedure Set_FloatTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Float : GfloatTo API docTo spec);

115.        function  Get_FloatTo API docTo body (Value : GValueTo API docTo specTo body) return GfloatTo API docTo spec;

117.        procedure Set_DoubleTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Double : GdoubleTo API docTo spec);

118.        function  Get_DoubleTo API docTo body (Value : GValueTo API docTo specTo body) return GdoubleTo API docTo spec;

120.        procedure Set_StringTo API docTo body (ValueTo API docTo body : in out GValueTo API docTo specTo body; V_String : String);

121.        function  Get_StringTo API docTo body (ValueTo API docTo body : GValueTo API docTo specTo body) return String;

122.        function  Get_StringTo API docTo body (ValueTo API docTo body : GValueTo API docTo specTo body; Length : GintTo API docTo spec) return String;

124.        function  Get_CharsTo API docTo body (Value : GValueTo API docTo specTo body) return Interfaces.C.Strings.chars_ptr;

126.        procedure Set_ProxyTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Proxy : C_ProxyTo API docTo spec);

127.        function  Get_ProxyTo API docTo body (Value : GValueTo API docTo specTo body) return C_ProxyTo API docTo spec;

129.        procedure Set_AddressTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Address : System.Address);

130.        function  Get_AddressTo API docTo body (Value : GValueTo API docTo specTo body) return System.Address;

132.        procedure Set_BoxedTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Address : System.Address);

133.        function  Get_BoxedTo API docTo body (Value : GValueTo API docTo specTo body) return System.Address;

134.        --  This is similar to Set_Address and Get_Address, except that the boxed

135.        --  type might have been associated with some specific initialization and

136.        --  finalization functions through Glib.Boxed_Type_Register_Static

137.        --  For instance:

138.        --    declare

139.        --       Typ   : Glib.GType;

140.        --       Value : GValue;

141.        --       function To_Ref_Counted_Value is new Ada.Unchecked_Conversion

142.        --          (System.Address, My_Ref_Counted_Type);

143.        --    begin

144.        --       Typ := Boxed_Typed_Register_Static

145.        --          ("FOO", Copy'Access, Free'Access);

146.        --       Init (Value, Typ);

147.        --       Set_Boxed (Value, my_ref_counted_value.all'address);

148.        --

149.        --       Val := To_Ref_Counted_Value (Get_Boxed (Value));

150.        --       Unset (Value);

151.        --    end;

152.        --

153.        --  See also Glib.Generic_Properties.Generic_Internal_Boxed_Property.

155.        procedure Set_EnumTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Enum : GintTo API docTo spec);

156.        function Get_EnumTo API docTo body (Value : GValueTo API docTo specTo body) return Glib.GintTo API docTo spec;

157.        --  These are used to manipulate the standard GtkAda enumeration types.

158.        --  For types that you have redefined yourself, you have access to more

159.        --  suitable functions directly in the package Generic_Enumeration_Property.

161.        procedure Set_FlagsTo API docTo body (Value : in out GValueTo API docTo specTo body; V_Enum : GuintTo API docTo spec);

162.        function Get_FlagsTo API docTo body (Value : GValueTo API docTo specTo body) return Glib.GuintTo API docTo spec;

163.        --  ??? Should really manipulate Glib.Properties.Creation.Flags_Int_Value

165.        procedure Set_ObjectTo API docTo body (ValueTo API docTo body : in out GValueTo API docTo specTo body; To : Glib.Object.GObjectTo API docTo spec);

166.        function Get_ObjectTo API docTo body (ValueTo API docTo body : GValueTo API docTo specTo body) return Glib.Object.GObjectTo API docTo spec;

167.        --  These are used to manipulate GObject instances.

169.        --  Convenience function to Get and Set a Gtk_Text_Iter are

170.        --  also provided inside Gtk.Text_Iter.

172.     private

173.        type GValue_Data is array (1 .. 2) of Guint64To API docTo spec;

174.        type GValueTo API docTo spec is record

175.           g_type : GTypeTo API docTo spec := GType_InvalidTo API docTo spec;

176.           data   : GValue_Data;

177.        end record;

178.        pragma Convention (C, GValueTo API docTo specTo body);

180.        type GValuesTo API docTo spec is record

181.           Nb  : GuintTo API docTo spec;

182.           Arr : System.Address;

183.        end record;

185.        pragma Import (C, Set_CharTo API docTo spec, "g_value_set_char");

186.        pragma Import (C, Get_CharTo API docTo spec, "g_value_get_char");

187.        pragma Import (C, Set_UcharTo API docTo spec, "g_value_set_uchar");

188.        pragma Import (C, Get_UcharTo API docTo spec, "g_value_get_uchar");

189.        pragma Import (C, Set_IntTo API docTo spec, "g_value_set_int");

190.        pragma Import (C, Get_IntTo API docTo spec, "g_value_get_int");

191.        pragma Import (C, Set_UintTo API docTo spec, "g_value_set_uint");

192.        pragma Import (C, Get_UintTo API docTo spec, "g_value_get_uint");

193.        pragma Import (C, Set_LongTo API docTo spec, "g_value_set_long");

194.        pragma Import (C, Get_LongTo API docTo spec, "g_value_get_long");

195.        pragma Import (C, Set_UlongTo API docTo spec, "g_value_set_ulong");

196.        pragma Import (C, Get_UlongTo API docTo spec, "g_value_get_ulong");

197.        pragma Import (C, Set_FloatTo API docTo spec, "g_value_set_float");

198.        pragma Import (C, Get_FloatTo API docTo spec, "g_value_get_float");

199.        pragma Import (C, Set_DoubleTo API docTo spec, "g_value_set_double");

200.        pragma Import (C, Get_DoubleTo API docTo spec, "g_value_get_double");

201.        pragma Import (C, Set_ProxyTo API docTo spec, "g_value_set_pointer");

202.        pragma Import (C, Set_AddressTo API docTo spec, "g_value_set_pointer");

203.        pragma Import (C, Set_EnumTo API docTo spec, "g_value_set_enum");

204.        pragma Import (C, Get_EnumTo API docTo spec, "g_value_get_enum");

205.        pragma Import (C, Get_CharsTo API docTo spec, "g_value_get_string");

206.        pragma Import (C, Set_FlagsTo API docTo spec, "g_value_set_flags");

207.        pragma Import (C, Get_FlagsTo API docTo spec, "g_value_get_flags");

208.        pragma Import (C, Set_BoxedTo API docTo spec, "g_value_set_boxed");

209.        pragma Import (C, Get_BoxedTo API docTo spec, "g_value_get_boxed");

210.        pragma Import (C, UnsetTo API docTo spec, "g_value_unset");

212.        --  ??? We use our own version here, that doesn't check the type of

213.        --  GValue. This is used for signals (Gtk.Handlers), but should be

214.        --  cleaned up.

215.        pragma Import (C, Get_AddressTo API docTo spec, "ada_gvalue_get_pointer");

216.        pragma Import (C, Get_ProxyTo API docTo spec, "ada_gvalue_get_pointer");

218.        pragma Inline (Make_ValuesTo API docTo specTo body);

219.        pragma Inline (Set_BooleanTo API docTo specTo body);

220.        pragma Inline (Get_BooleanTo API docTo specTo body);

221.        pragma Inline (Set_StringTo API docTo specTo body);

222.        pragma Inline (Get_StringTo API docTo specTo body);

224.        --  </doc_ignore>

225.     end Glib.ValuesTo API docTo specTo body;