## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

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

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

3.     --                                                                   --

4.     --                Copyright (C) 2006-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.     --  Gtk_Tree_Sortable is an interface to be implemented by tree models which

31.     --  support sorting. The Gtk_Tree_View uses the methods provided by this

32.     --  interface to sort the model.

33.     --  </description>

34.     --  <c_version>2.8.17</c_version>

35.     --  <group>Trees and Lists</group>

37.     with Glib.TypesTo API docTo specTo body;

38.     with Gtk.EnumsTo API docTo specTo body;

39.     with Gtk.Tree_ModelTo API docTo specTo body;

41.     package Gtk.Tree_SortableTo API docTo specTo body is

42.        type Gtk_Tree_Sortable is new Glib.Types.GType_InterfaceTo API docTo spec;

44.        Default_Sort_Column_Id  : constant GintTo API docTo spec := -1;

45.        Unsorted_Sort_Column_Id : constant GintTo API docTo spec := -2;

46.        --  Two special values for the sort column

48.        function Get_TypeTo API docTo body return Glib.GTypeTo API docTo spec;

49.        --  Returns the internal type used for a Gtk_Tree_Sortable

51.        procedure Set_Sort_Column_IdTo API docTo body

52.          (Sortable       : Gtk_Tree_SortableTo API docTo spec;

53.           Sort_Column_Id : GintTo API docTo spec;

54.           Order          : Gtk.Enums.Gtk_Sort_TypeTo API docTo spec);

55.        procedure Get_Sort_Column_IdTo API docTo body

56.          (Sortable       : Gtk_Tree_SortableTo API docTo spec;

57.           Sort_Column_Id : out GintTo API docTo spec;

58.           OrderTo API docTo body          : out Gtk.Enums.Gtk_Sort_TypeTo API docTo spec);

59.        --  Sets the current sort column to be Sort_Column_Id. The Sortable will

60.        --  resort itself to reflect this change, after emitting sort_column_changed

61.        --  signal. If Sort_Column_Id is Default_Sort_Column_Id, then the default

62.        --  sort function will be used, if it is set.

64.        type Gtk_Tree_Iter_Compare_Func is access function

65.          (Model : access Gtk.Tree_Model.Gtk_Tree_Model_RecordTo API docTo specTo body'Class;

66.           A     : Gtk.Tree_Model.Gtk_Tree_IterTo API docTo specTo body;

67.           B     : Gtk.Tree_Model.Gtk_Tree_IterTo API docTo specTo body) return GintTo API docTo spec;

68.        --  A Gtk_Tree_Iter_Compare_Func should return a negative integer, zero, or

69.        --  a positive integer if a sorts before b, a sorts with b, or a sorts after

70.        --  b respectively. If two iters compare as equal, their order in the sorted

71.        --  model is undefined. In order to ensure that the Gtk_Tree_Sortable

72.        --  behaves as expected, the Gtk_Tree_Iter_Compare_Func must define a

73.        --  partial order on the model, i.e. it must be reflexive, antisymmetric and

74.        --  transitive.

75.        --  For example, if model is a product catalogue, then a compare function

76.        --  for the "price" column could be one which returns price_of(a) -

77.        --  price_of(b).

79.        procedure Set_Default_Sort_FuncTo API docTo body

80.          (Sortable  : Gtk_Tree_SortableTo API docTo spec;

81.           Sort_Func : Gtk_Tree_Iter_Compare_FuncTo API docTo spec);

82.        function Has_Default_Sort_FuncTo API docTo body

83.          (Sortable : Gtk_Tree_SortableTo API docTo spec) return Boolean;

84.        --  Sets the default comparison function used when sorting to be Sort_Func.

85.        --  If the current sort column id of Sortable is Default_Sort_Column_Id,

86.        --  then the model will sort using this function.

87.        --  If Sort_Func is null, then there will be no default comparison function.

88.        --  This means that once the model has been sorted, it can't go back to the

89.        --  default state. In this case, when the current sort column id of Sortable

90.        --  is Default_Sort_Column_Id, the model will be unsorted.

92.        procedure Set_Sort_FuncTo API docTo body

93.          (Sortable       : Gtk_Tree_SortableTo API docTo spec;

94.           Sort_Column_Id : GintTo API docTo spec;

95.           Sort_Func      : Gtk_Tree_Iter_Compare_FuncTo API docTo spec);

96.        --  Sets the comparison function used when sorting to be Sort_Func. If the

97.        --  current sort column id of Sortable is the same as Sort_Column_Id, then

98.        --  the model will sort using this function.

100.        generic

101.           type Data_Type (<>) is private;

102.        package Compare_FuncsTo API docTo body is

103.           type Gtk_Tree_Iter_Compare_Func is access function

104.             (Model     : access Gtk.Tree_Model.Gtk_Tree_Model_RecordTo API docTo specTo body'Class;

105.              A         : Gtk.Tree_Model.Gtk_Tree_IterTo API docTo specTo body;

106.              B         : Gtk.Tree_Model.Gtk_Tree_IterTo API docTo specTo body;

107.              User_Data : Data_TypeTo API docTo spec) return GintTo API docTo spec;

109.           type Destroy_Notify is access procedure (Data : in out Data_TypeTo API docTo spec);

110.           --  Free the memory used by Data

112.           procedure Set_Default_Sort_FuncTo API docTo body

113.             (Sortable  : Gtk_Tree_SortableTo API docTo spec;

114.              Sort_Func : Gtk_Tree_Iter_Compare_FuncTo API docTo spec;

115.              User_Data : Data_TypeTo API docTo spec;

116.              Destroy   : Destroy_NotifyTo API docTo spec := null);

117.           procedure Set_Sort_FuncTo API docTo body

118.             (Sortable       : Gtk_Tree_SortableTo API docTo spec;

119.              Sort_Column_Id : GintTo API docTo spec;

120.              Sort_Func      : Gtk_Tree_Iter_Compare_FuncTo API docTo spec;

121.              User_Data      : Data_TypeTo API docTo spec;

122.              Destroy        : Destroy_NotifyTo API docTo spec := null);

123.           --  Same as above, but an additional user data can be passed to the sort

124.           --  function.

125.        private

126.           --  <doc_ignore>

127.           type Data_Type_Access is access Data_TypeTo API docTo spec;

128.           type Data_Type_Record is record

129.              Func    : Gtk_Tree_Iter_Compare_FuncTo API docTo spec;

130.              Destroy : Destroy_NotifyTo API docTo spec;

131.              Data    : Data_Type_Access;

132.           end record;

133.           type Data_Type_Record_Access is access Data_Type_Record;

134.           pragma Convention (C, Data_Type_Record_Access);

136.           procedure Internal_Destroy_Notify (Data : Data_Type_Record_Access);

137.           pragma Convention (C, Internal_Destroy_Notify);

139.           function Internal_Compare_Func

140.             (Model : System.Address;

141.              A, B  : System.Address;

142.              Data  : Data_Type_Record_Access) return GintTo API docTo spec;

143.           pragma Convention (C, Internal_Compare_Func);

144.           --  </doc_ignore>

145.        end Compare_FuncsTo API docTo specTo body;

146.        --  </doc_ignore>

148.        -------------

149.        -- Signals --

150.        -------------

151.        --  The following new signals are defined for this widget:

153.        --  <signals>

154.        --  - "sort_column_changed"

155.        --    procedure Handler (Sortable : Gtk_Tree_Sortable);

156.        --    Emitted when the sort column is changed through Set_Sort_Column_Id

157.        --  </signals>

159.        Signal_Sort_Column_Changed : constant Glib.Signal_NameTo API docTo spec :=

160.                                       "sort_column_changed";

162.        procedure Sort_Column_ChangedTo API docTo body (Sortable : Gtk_Tree_SortableTo API docTo spec);

163.        --  Emits sort_column_changed signal

165.     private

166.        pragma Import (C, Get_TypeTo API docTo spec, "gtk_tree_sortable_get_type");

167.        pragma Import

168.          (C, Set_Sort_Column_IdTo API docTo spec, "gtk_tree_sortable_set_sort_column_id");

169.        pragma Import

170.          (C, Sort_Column_ChangedTo API docTo spec, "gtk_tree_sortable_sort_column_changed");

171.     end Gtk.Tree_SortableTo API docTo specTo body;