File: gtk-layout.ads

package info (click to toggle)
libgtkada2 2.8.1-6lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,496 kB
  • ctags: 3,886
  • sloc: ada: 103,189; ansic: 45,411; perl: 5,500; sh: 2,812; makefile: 1,169; xml: 19
file content (262 lines) | stat: -rw-r--r-- 10,671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
-----------------------------------------------------------------------
--               GtkAda - Ada95 binding for Gtk+/Gnome               --
--                                                                   --
--   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --
--                Copyright (C) 2000-2006 AdaCore                    --
--                                                                   --
-- This library is free software; you can redistribute it and/or     --
-- modify it under the terms of the GNU General Public               --
-- License as published by the Free Software Foundation; either      --
-- version 2 of the License, or (at your option) any later version.  --
--                                                                   --
-- This library is distributed in the hope that it will be useful,   --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of    --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
-- General Public License for more details.                          --
--                                                                   --
-- You should have received a copy of the GNU General Public         --
-- License along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
-- Boston, MA 02111-1307, USA.                                       --
--                                                                   --
-----------------------------------------------------------------------

--  <description>
--  A Gtk_Layout is a widget that can have an almost infinite size, without
--  occupying a lot of memory. Its children can be located anywhere within
--  it, but will only appear on the screen if the visible area of the layout
--  contains them.
--  Just like a Gtk_Viewport, its visible area is indicated by two
--  Gtk_Adjustment widgets, and thus a Gtk_Layout can be put as is in a
--  Gtk_Scrolled_Window.
--  As for Gtk_Fixed containers, the children can be located anywhere in the
--  layout (no automatic organization is done). But, as opposed to Gtk_Fixed
--  widgets, a Gtk_Layout does not try to resize itself to show all its
--  children.
--
--  Starting from GtkAda 2.0, you have to call Set_Size and specify the maximum
--  size of the layout, otherwise children added with Put outside the size
--  defined for the layout will never be visible.
--  One way to do this is to systematically call Set_Size before calling Put,
--  and make sure you specify a size big enough for the layout.
--
--  </description>
--  <c_version>2.8.17</c_version>
--  <group>Layout containers</group>
--  <testgtk>create_layout.adb</testgtk>
--  <screenshot>gtk-layout</screenshot>

with Glib.Properties;
with Gdk.Window;
with Gtk.Adjustment;
with Gtk.Container;
with Gtk.Widget;

package Gtk.Layout is

   type Gtk_Layout_Record is new
     Gtk.Container.Gtk_Container_Record with private;
   type Gtk_Layout is access all Gtk_Layout_Record'Class;

   procedure Gtk_New
     (Layout      : out Gtk_Layout;
      Hadjustment : Adjustment.Gtk_Adjustment := null;
      Vadjustment : Adjustment.Gtk_Adjustment := null);
   --  Create new layout.
   --  You can either give an explicit couple of adjustments, that will
   --  indicate the current visible area. If you don't specify any, they will
   --  be created automatically by GtkAda, which is the usual way to do.
   --  The Layout does not occupy any area on the screen, and you have to
   --  explicitly specify one with Set_Size below.

   procedure Initialize
     (Layout      : access Gtk_Layout_Record'Class;
      Hadjustment : Gtk.Adjustment.Gtk_Adjustment;
      Vadjustment : Gtk.Adjustment.Gtk_Adjustment);
   --  Internal initialization function.
   --  See the section "Creating your own widgets" in the documentation.

   function Get_Type return Gtk.Gtk_Type;
   --  Return the internal value associated with a Gtk_Layout.

   procedure Put
     (Layout : access Gtk_Layout_Record;
      Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
      X      : Gint;
      Y      : Gint);
   --  Insert a new child in the layout.
   --  The child will be displayed on the screen only if at least part of
   --  it intersects the visible area of the layout.
   --  The layout does not resize itself to automatically show the widget.
   --  You also need to call Set_Size, if the size you initially defined is
   --  smaller than (X, Y), or the child will never be visible even if the
   --  layout is scrolled.

   procedure Move
     (Layout : access Gtk_Layout_Record;
      Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
      X      : Gint;
      Y      : Gint);
   --  Move a child of the layout.
   --  Nothing is done if Widget is not already a child of Layout.

   function Get_Bin_Window
     (Widget : access Gtk_Layout_Record) return Gdk.Window.Gdk_Window;
   --  Return the window associated with the layout.
   --  You should use this one rather than Gtk.Widget.Get_Window.

   procedure Set_Size
     (Layout : access Gtk_Layout_Record;
      Width  : Guint;
      Height : Guint);
   procedure Get_Size
     (Layout : access Gtk_Layout_Record;
      Width  : out Guint;
      Height : out Guint);
   --  Specify an absolute size for the layout.
   --  This is not the size on the screen, but the internal size of the widget.
   --  The screen's size can be set with Gtk.Widget.Set_Usize.

   procedure Set_Hadjustment
     (Layout     : access Gtk_Layout_Record;
      Adjustment : Gtk.Adjustment.Gtk_Adjustment);
   function Get_Hadjustment
     (Layout : access Gtk_Layout_Record) return Gtk.Adjustment.Gtk_Adjustment;
   --  Return the adjustment that indicate the horizontal visual area
   --  of the layout.
   --  You generally do not have to modify the value of this adjustment
   --  yourself, since this is done automatically when the layout has
   --  been put in a Gtk_Scrolled_Window.

   procedure Set_Vadjustment
     (Layout     : access Gtk_Layout_Record;
      Adjustment : Gtk.Adjustment.Gtk_Adjustment);
   function Get_Vadjustment
     (Layout : access Gtk_Layout_Record) return Gtk.Adjustment.Gtk_Adjustment;
   --  Return the adjustment that indicate the vertical visual area
   --  of the layout.
   --  You generally do not have to modify the value of this adjustment
   --  yourself, since this is done automatically when the layout has
   --  been put in a Gtk_Scrolled_Window.

   -----------------
   -- Obsolescent --
   -----------------
   --  All subprograms below are now obsolescent in gtk+. They might be removed
   --  from future versions of gtk+ (and therefore GtkAda).
   --  To find out whether your code uses any of these, we recommend compiling
   --  with the -gnatwj switch
   --  <doc_ignore>

   function Get_Width (Layout : access Gtk_Layout_Record) return Guint;
   pragma Obsolescent;
   --  Deprecated, only provided for compatibility, see Get_Size

   function Get_Height (Layout : access Gtk_Layout_Record) return Guint;
   --  pragma Obsolescent;
   --  Deprecated, only provided for compatibility, see Get_Size

   procedure Freeze (Layout : access Gtk_Layout_Record);
   pragma Obsolescent;  --  Freeze
   --  Deprecated, only provided for compatibility.

   procedure Thaw (Layout : access Gtk_Layout_Record);
   pragma Obsolescent;  --  Thaw
   --  Deprecated, only provided for compatibility.

   --  </doc_ignore>

   ----------------
   -- Properties --
   ----------------
   --  The following properties are defined for this widget. See
   --  Glib.Properties for more information on properties.

   --  <properties>
   --  - Name:  Hadjustment_Property
   --    Type:  Gtk_Adjustment_Record'Class
   --    Flags: read-write
   --    Descr: The GtkAdjustment for the horizontal position.
   --    See also: Set_Hadjustment and Get_Hadjustment
   --
   --  - Name:  Vadjustment_Property
   --    Type:  Gtk_Adjustment_Record'Class
   --    Flags: read-write
   --    Descr: The GtkAdjustment for the vertical position.
   --    See also: Set_Vadjustment and Get_Vadjustment
   --
   --  - Name:  Width_Property
   --    Type:  Guint
   --    Flags: read-write
   --    Descr: The width of the layout.
   --    See also: Set_Size and Get_Width
   --
   --  - Name:  Height_Property
   --    Type:  Guint
   --    Flags: read-write
   --    Descr: The height of the layout.
   --    See also: Set_Size and Get_Height
   --  </properties>

   Hadjustment_Property : constant Glib.Properties.Property_Object;
   Vadjustment_Property : constant Glib.Properties.Property_Object;
   Width_Property       : constant Glib.Properties.Property_Uint;
   Height_Property      : constant Glib.Properties.Property_Uint;

   ----------------------
   -- Child Properties --
   ----------------------
   --  The following properties can be set on children of this widget. See
   --  in particular Gtk.Containers.Child_Set_Property.

   --  <child_properties>
   --  Name:  X_Property
   --  Type:  Int
   --  Descr: X position of child widget
   --
   --  Name:  Y_Property
   --  Type:  Int
   --  Descr: Y position of child widget
   --  </child_properties>

   X_Property : constant Glib.Properties.Property_Int;
   Y_Property : constant Glib.Properties.Property_Int;

   -------------
   -- Signals --
   -------------

   --  <signals>
   --  The following new signals are defined for this widget:
   --
   --  - "set_scroll_adjustments"
   --    procedure Handler (Layout : access Gtk_Layout_Record'Class;
   --                       Hadj   : in Gtk.Adjustment.Gtk_Adjustment;
   --                       Vadj   : in Gtk.Adjustment.Gtk_Adjustment);
   --
   --    Emitted whenever at least one of the adjustment of the layout is
   --    changed.
   --  </signals>

   Signal_Set_Scroll_Adjustments : constant String := "set_scroll_adjustments";

private
   type Gtk_Layout_Record is new Gtk.Container.Gtk_Container_Record
     with null record;

   Hadjustment_Property : constant Glib.Properties.Property_Object :=
     Glib.Properties.Build ("hadjustment");
   Vadjustment_Property : constant Glib.Properties.Property_Object :=
     Glib.Properties.Build ("vadjustment");
   Width_Property       : constant Glib.Properties.Property_Uint :=
     Glib.Properties.Build ("width");
   Height_Property      : constant Glib.Properties.Property_Uint :=
     Glib.Properties.Build ("height");

   X_Property : constant Glib.Properties.Property_Int :=
     Glib.Properties.Build ("x");
   Y_Property : constant Glib.Properties.Property_Int :=
     Glib.Properties.Build ("y");

   pragma Import (C, Get_Type, "gtk_layout_get_type");
end Gtk.Layout;