1------------------------------------------------------------------------------
2--                                                                          --
3--      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       --
4--                     Copyright (C) 2000-2015, AdaCore                     --
5--                                                                          --
6-- This library is free software;  you can redistribute it and/or modify it --
7-- under terms of the  GNU General Public License  as published by the Free --
8-- Software  Foundation;  either version 3,  or (at your  option) any later --
9-- version. This library is distributed in the hope that it will be useful, --
10-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
12--                                                                          --
13-- As a special exception under Section 7 of GPL version 3, you are granted --
14-- additional permissions described in the GCC Runtime Library Exception,   --
15-- version 3.1, as published by the Free Software Foundation.               --
16--                                                                          --
17-- You should have received a copy of the GNU General Public License and    --
18-- a copy of the GCC Runtime Library Exception along with this program;     --
19-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
20-- <http://www.gnu.org/licenses/>.                                          --
21--                                                                          --
22------------------------------------------------------------------------------
23
24--  <description>
25--  A Gtk.Tool_Item_Group.Gtk_Tool_Item_Group is used together with
26--  Gtk.Tool_Palette.Gtk_Tool_Palette to add Gtk_Tool_Items to a palette like
27--  container with different categories and drag and drop support.
28--
29--  </description>
30pragma Ada_2005;
31
32pragma Warnings (Off, "*is already use-visible*");
33with Glib;            use Glib;
34with Glib.Properties; use Glib.Properties;
35with Glib.Types;      use Glib.Types;
36with Gtk.Buildable;   use Gtk.Buildable;
37with Gtk.Container;   use Gtk.Container;
38with Gtk.Enums;       use Gtk.Enums;
39with Gtk.Size_Group;  use Gtk.Size_Group;
40with Gtk.Tool_Item;   use Gtk.Tool_Item;
41with Gtk.Tool_Shell;  use Gtk.Tool_Shell;
42with Gtk.Widget;      use Gtk.Widget;
43with Pango.Layout;    use Pango.Layout;
44
45package Gtk.Tool_Item_Group is
46
47   type Gtk_Tool_Item_Group_Record is new Gtk_Container_Record with null record;
48   type Gtk_Tool_Item_Group is access all Gtk_Tool_Item_Group_Record'Class;
49
50   ------------------
51   -- Constructors --
52   ------------------
53
54   procedure Gtk_New (Self : out Gtk_Tool_Item_Group; Label : UTF8_String);
55   procedure Initialize
56      (Self  : not null access Gtk_Tool_Item_Group_Record'Class;
57       Label : UTF8_String);
58   --  Creates a new tool item group with label Label.
59   --  Since: gtk+ 2.20
60   --  "label": the label of the new group
61
62   function Gtk_Tool_Item_Group_New
63      (Label : UTF8_String) return Gtk_Tool_Item_Group;
64   --  Creates a new tool item group with label Label.
65   --  Since: gtk+ 2.20
66   --  "label": the label of the new group
67
68   function Get_Type return Glib.GType;
69   pragma Import (C, Get_Type, "gtk_tool_item_group_get_type");
70
71   -------------
72   -- Methods --
73   -------------
74
75   function Get_Collapsed
76      (Self : not null access Gtk_Tool_Item_Group_Record) return Boolean;
77   --  Gets whether Group is collapsed or expanded.
78   --  Since: gtk+ 2.20
79
80   procedure Set_Collapsed
81      (Self      : not null access Gtk_Tool_Item_Group_Record;
82       Collapsed : Boolean);
83   --  Sets whether the Group should be collapsed or expanded.
84   --  Since: gtk+ 2.20
85   --  "collapsed": whether the Group should be collapsed or expanded
86
87   function Get_Drop_Item
88      (Self : not null access Gtk_Tool_Item_Group_Record;
89       X    : Gint;
90       Y    : Gint) return Gtk.Tool_Item.Gtk_Tool_Item;
91   --  Gets the tool item at position (x, y).
92   --  Since: gtk+ 2.20
93   --  "x": the x position
94   --  "y": the y position
95
96   function Get_Ellipsize
97      (Self : not null access Gtk_Tool_Item_Group_Record)
98       return Pango.Layout.Pango_Ellipsize_Mode;
99   --  Gets the ellipsization mode of Group.
100   --  Since: gtk+ 2.20
101
102   procedure Set_Ellipsize
103      (Self      : not null access Gtk_Tool_Item_Group_Record;
104       Ellipsize : Pango.Layout.Pango_Ellipsize_Mode);
105   --  Sets the ellipsization mode which should be used by labels in Group.
106   --  Since: gtk+ 2.20
107   --  "ellipsize": the Pango.Layout.Pango_Ellipsize_Mode labels in Group
108   --  should use
109
110   function Get_Header_Relief
111      (Self : not null access Gtk_Tool_Item_Group_Record)
112       return Gtk.Enums.Gtk_Relief_Style;
113   --  Gets the relief mode of the header button of Group.
114   --  Since: gtk+ 2.20
115
116   procedure Set_Header_Relief
117      (Self  : not null access Gtk_Tool_Item_Group_Record;
118       Style : Gtk.Enums.Gtk_Relief_Style);
119   --  Set the button relief of the group header. See Gtk.Button.Set_Relief
120   --  for details.
121   --  Since: gtk+ 2.20
122   --  "style": the Gtk.Enums.Gtk_Relief_Style
123
124   function Get_Item_Position
125      (Self : not null access Gtk_Tool_Item_Group_Record;
126       Item : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class)
127       return Gint;
128   --  Gets the position of Item in Group as index.
129   --  Since: gtk+ 2.20
130   --  "item": a Gtk.Tool_Item.Gtk_Tool_Item
131
132   procedure Set_Item_Position
133      (Self     : not null access Gtk_Tool_Item_Group_Record;
134       Item     : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class;
135       Position : Gint);
136   --  Sets the position of Item in the list of children of Group.
137   --  Since: gtk+ 2.20
138   --  "item": the Gtk.Tool_Item.Gtk_Tool_Item to move to a new position,
139   --  should be a child of Group.
140   --  "position": the new position of Item in Group, starting with 0. The
141   --  position -1 means end of list.
142
143   function Get_Label
144      (Self : not null access Gtk_Tool_Item_Group_Record) return UTF8_String;
145   --  Gets the label of Group.
146   --  Since: gtk+ 2.20
147
148   procedure Set_Label
149      (Self  : not null access Gtk_Tool_Item_Group_Record;
150       Label : UTF8_String);
151   --  Sets the label of the tool item group. The label is displayed in the
152   --  header of the group.
153   --  Since: gtk+ 2.20
154   --  "label": the new human-readable label of of the group
155
156   function Get_Label_Widget
157      (Self : not null access Gtk_Tool_Item_Group_Record)
158       return Gtk.Widget.Gtk_Widget;
159   --  Gets the label widget of Group. See
160   --  Gtk.Tool_Item_Group.Set_Label_Widget.
161   --  Since: gtk+ 2.20
162
163   procedure Set_Label_Widget
164      (Self         : not null access Gtk_Tool_Item_Group_Record;
165       Label_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class);
166   --  Sets the label of the tool item group. The label widget is displayed in
167   --  the header of the group, in place of the usual label.
168   --  Since: gtk+ 2.20
169   --  "label_widget": the widget to be displayed in place of the usual label
170
171   function Get_N_Items
172      (Self : not null access Gtk_Tool_Item_Group_Record) return Guint;
173   --  Gets the number of tool items in Group.
174   --  Since: gtk+ 2.20
175
176   function Get_Nth_Item
177      (Self  : not null access Gtk_Tool_Item_Group_Record;
178       Index : Guint) return Gtk.Tool_Item.Gtk_Tool_Item;
179   --  Gets the tool item at Index in group.
180   --  Since: gtk+ 2.20
181   --  "index": the index
182
183   procedure Insert
184      (Self     : not null access Gtk_Tool_Item_Group_Record;
185       Item     : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class;
186       Position : Gint);
187   --  Inserts Item at Position in the list of children of Group.
188   --  Since: gtk+ 2.20
189   --  "item": the Gtk.Tool_Item.Gtk_Tool_Item to insert into Group
190   --  "position": the position of Item in Group, starting with 0. The
191   --  position -1 means end of list.
192
193   ---------------------------------------------
194   -- Inherited subprograms (from interfaces) --
195   ---------------------------------------------
196   --  Methods inherited from the Buildable interface are not duplicated here
197   --  since they are meant to be used by tools, mostly. If you need to call
198   --  them, use an explicit cast through the "-" operator below.
199
200   function Get_Ellipsize_Mode
201      (Self : not null access Gtk_Tool_Item_Group_Record)
202       return Pango.Layout.Pango_Ellipsize_Mode;
203
204   function Get_Icon_Size
205      (Self : not null access Gtk_Tool_Item_Group_Record)
206       return Gtk.Enums.Gtk_Icon_Size;
207
208   function Get_Orientation
209      (Self : not null access Gtk_Tool_Item_Group_Record)
210       return Gtk.Enums.Gtk_Orientation;
211
212   function Get_Relief_Style
213      (Self : not null access Gtk_Tool_Item_Group_Record)
214       return Gtk.Enums.Gtk_Relief_Style;
215
216   function Get_Style
217      (Self : not null access Gtk_Tool_Item_Group_Record)
218       return Gtk.Enums.Gtk_Toolbar_Style;
219
220   function Get_Text_Alignment
221      (Self : not null access Gtk_Tool_Item_Group_Record) return Gfloat;
222
223   function Get_Text_Orientation
224      (Self : not null access Gtk_Tool_Item_Group_Record)
225       return Gtk.Enums.Gtk_Orientation;
226
227   function Get_Text_Size_Group
228      (Self : not null access Gtk_Tool_Item_Group_Record)
229       return Gtk.Size_Group.Gtk_Size_Group;
230
231   procedure Rebuild_Menu
232      (Self : not null access Gtk_Tool_Item_Group_Record);
233
234   ----------------
235   -- Properties --
236   ----------------
237   --  The following properties are defined for this widget. See
238   --  Glib.Properties for more information on properties)
239
240   Collapsed_Property : constant Glib.Properties.Property_Boolean;
241
242   Ellipsize_Property : constant Pango.Layout.Property_Pango_Ellipsize_Mode;
243   --  Type: Pango.Layout.Pango_Ellipsize_Mode
244
245   Header_Relief_Property : constant Gtk.Enums.Property_Gtk_Relief_Style;
246
247   Label_Property : constant Glib.Properties.Property_String;
248
249   Label_Widget_Property : constant Glib.Properties.Property_Object;
250   --  Type: Gtk.Widget.Gtk_Widget
251
252   ----------------
253   -- Interfaces --
254   ----------------
255   --  This class implements several interfaces. See Glib.Types
256   --
257   --  - "Buildable"
258   --
259   --  - "ToolShell"
260
261   package Implements_Gtk_Buildable is new Glib.Types.Implements
262     (Gtk.Buildable.Gtk_Buildable, Gtk_Tool_Item_Group_Record, Gtk_Tool_Item_Group);
263   function "+"
264     (Widget : access Gtk_Tool_Item_Group_Record'Class)
265   return Gtk.Buildable.Gtk_Buildable
266   renames Implements_Gtk_Buildable.To_Interface;
267   function "-"
268     (Interf : Gtk.Buildable.Gtk_Buildable)
269   return Gtk_Tool_Item_Group
270   renames Implements_Gtk_Buildable.To_Object;
271
272   package Implements_Gtk_Tool_Shell is new Glib.Types.Implements
273     (Gtk.Tool_Shell.Gtk_Tool_Shell, Gtk_Tool_Item_Group_Record, Gtk_Tool_Item_Group);
274   function "+"
275     (Widget : access Gtk_Tool_Item_Group_Record'Class)
276   return Gtk.Tool_Shell.Gtk_Tool_Shell
277   renames Implements_Gtk_Tool_Shell.To_Interface;
278   function "-"
279     (Interf : Gtk.Tool_Shell.Gtk_Tool_Shell)
280   return Gtk_Tool_Item_Group
281   renames Implements_Gtk_Tool_Shell.To_Object;
282
283private
284   Label_Widget_Property : constant Glib.Properties.Property_Object :=
285     Glib.Properties.Build ("label-widget");
286   Label_Property : constant Glib.Properties.Property_String :=
287     Glib.Properties.Build ("label");
288   Header_Relief_Property : constant Gtk.Enums.Property_Gtk_Relief_Style :=
289     Gtk.Enums.Build ("header-relief");
290   Ellipsize_Property : constant Pango.Layout.Property_Pango_Ellipsize_Mode :=
291     Pango.Layout.Build ("ellipsize");
292   Collapsed_Property : constant Glib.Properties.Property_Boolean :=
293     Glib.Properties.Build ("collapsed");
294end Gtk.Tool_Item_Group;
295