File: gtk-adjustment.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 (244 lines) | stat: -rw-r--r-- 9,642 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
-----------------------------------------------------------------------
--               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>
--
--  This object represents an adjustable bounded value.
--  It is used in many other widgets that have such internal values,
--  like Gtk_Scrollbar, Gtk_Spin_Button, Gtk_Range, ...
--  Modifying the value of these widgets is done through their
--  associated adjustments.
--
--  The modification of the value is left to the user, who should
--  call Value_Changed or Changed to emit the relevant signals.
--
--  The meaning of the most important fields can be explained on the
--  following figure (imagine this is a scrollbar):
--
--  <example>
--     [-------|=================|-------------------]
--    lower    value        value + page_size       upper
--
--  </example>
--  </description>
--  <c_version>2.8.17</c_version>
--  <group>Scrolling</group>

with Glib.Properties;
with Gtk.Object;

package Gtk.Adjustment is

   type Gtk_Adjustment_Record is new Object.Gtk_Object_Record with private;
   type Gtk_Adjustment is access all Gtk_Adjustment_Record'Class;

   procedure Gtk_New
     (Adjustment     : out Gtk_Adjustment;
      Value          : Gdouble;
      Lower          : Gdouble;
      Upper          : Gdouble;
      Step_Increment : Gdouble;
      Page_Increment : Gdouble;
      Page_Size      : Gdouble);
   --  Create a new adjustment.
   --  Value is the initial value of the adjustment. It must be in the
   --  range (Lower .. Upper) and the adjustment's value will never be
   --  outside this range.
   --  Step_Increment is the value used to make minor adjustments, such
   --  as when the user clicks on the arrows of a scrollbar.
   --  Page_Increment is used to make major adjustments, such as when
   --  the user clicks in the through on a scrollbar.
   --  Page_Size is the size of the area that is currently visible
   --  (for instance in a Gtk_Scrolled_Window).

   procedure Initialize
     (Adjustment     : access Gtk_Adjustment_Record'Class;
      Value          : Gdouble;
      Lower          : Gdouble;
      Upper          : Gdouble;
      Step_Increment : Gdouble;
      Page_Increment : Gdouble;
      Page_Size      : Gdouble);
   --  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_Adjustment.

   procedure Set_Value
     (Adjustment : access Gtk_Adjustment_Record; Value : Gdouble);
   function Get_Value
     (Adjustment : access Gtk_Adjustment_Record) return Gdouble;
   --  Modify the current value of the adjustment.
   --  You do not need to call Value_Changed after modifying this value,
   --  this is done automatically.

   procedure Set_Lower
     (Adjustment : access Gtk_Adjustment_Record;
      Lower      : Gdouble);
   function Get_Lower
     (Adjustment : access Gtk_Adjustment_Record) return Gdouble;
   --  Modify the lower bound of the adjustment.
   --  You should call Changed after modifying this value.

   procedure Set_Upper
     (Adjustment : access Gtk_Adjustment_Record;
      Upper      : Gdouble);
   function Get_Upper
     (Adjustment : access Gtk_Adjustment_Record) return Gdouble;
   --  Modify the upper bound of the adjustment.
   --  You should call Changed after modifying this value.

   procedure Set_Step_Increment
     (Adjustment     : access Gtk_Adjustment_Record;
      Step_Increment : Gdouble);
   function Get_Step_Increment
     (Adjustment : access Gtk_Adjustment_Record) return Gdouble;
   --  Modify the step increment of the adjustment.
   --  You should call Changed after modifying this value.

   procedure Set_Page_Increment
     (Adjustment     : access Gtk_Adjustment_Record;
      Page_Increment : Gdouble);
   function Get_Page_Increment
     (Adjustment : access Gtk_Adjustment_Record) return Gdouble;
   --  Modify the page increment of the adjustment.
   --  You should call Changed after modifying this value.

   procedure Set_Page_Size
     (Adjustment : access Gtk_Adjustment_Record;
      Page_Size  : Gdouble);
   function Get_Page_Size
     (Adjustment : access Gtk_Adjustment_Record) return Gdouble;
   --  Modify the page size of the adjustment.
   --  You should call Changed after modifying this value.

   --------------------
   -- Misc functions --
   --------------------

   procedure Clamp_Page
     (Adjustment : access Gtk_Adjustment_Record;
      Lower      : Gdouble;
      Upper      : Gdouble);
   --  Update the Adjustment value to ensure that the range between Lower and
   --  Upper is in the current page (i.e. between value and value +
   --  page_size). If the range is larger than the page size, then only the
   --  start of it will be in the current page.
   --  A "value_changed" signal will be emitted if the value is changed.

   ----------------------
   -- Signals emission --
   ----------------------

   procedure Changed (Adjustment : access Gtk_Adjustment_Record);
   --  Emit the "changed" signal on Adjustment.
   --  This warns any listener that some field other than the value has been
   --  changed.

   procedure Value_Changed (Adjustment : access Gtk_Adjustment_Record);
   --  Emit the "value_changed" signal on Adjustment.
   --  This warns any listener that the value has been changed.

   ----------------
   -- Properties --
   ----------------

   --  <properties>
   --  The following properties are defined for this widget. See
   --  Glib.Properties for more information on properties.
   --
   --  Name:  Lower_Property
   --  Type:  Double
   --  Descr: The minimum value of the adjustment
   --
   --  Name:  Page_Increment_Property
   --  Type:  Double
   --  Descr: The page increment of the adjustment
   --
   --  Name:  Page_Size_Property
   --  Type:  Double
   --  Descr: The page size of the adjustment
   --
   --  Name:  Step_Increment_Property
   --  Type:  Double
   --  Descr: The step increment of the adjustment
   --
   --  Name:  Upper_Property
   --  Type:  Double
   --  Descr: The maximum value of the adjustment
   --
   --  Name:  Value_Property
   --  Type:  Double
   --  Descr: The value of the adjustment
   --
   --  </properties>

   Lower_Property          : constant Glib.Properties.Property_Double;
   Page_Increment_Property : constant Glib.Properties.Property_Double;
   Page_Size_Property      : constant Glib.Properties.Property_Double;
   Step_Increment_Property : constant Glib.Properties.Property_Double;
   Upper_Property          : constant Glib.Properties.Property_Double;
   Value_Property          : constant Glib.Properties.Property_Double;

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

   --  <signals>
   --  The following new signals are defined for this widget:
   --
   --  - "changed"
   --    procedure Handler (Adjustment : access Gtk_Adjustment_Record'Class);
   --
   --    This signal is emitted every time one of the parameters is modified,
   --    except the value.
   --
   --  - "value_changed"
   --    procedure Handler (Adjustment : access Gtk_Adjustment_Record'Class);
   --
   --    This signal is emitted every time the value of the adjustment is
   --    modified
   --  </signals>

   Signal_Changed       : constant String := "changed";
   Signal_Value_Changed : constant String := "value_changed";

private
   type Gtk_Adjustment_Record is new Object.Gtk_Object_Record with null record;

   Lower_Property : constant Glib.Properties.Property_Double :=
     Glib.Properties.Build ("lower");
   Page_Increment_Property : constant Glib.Properties.Property_Double :=
     Glib.Properties.Build ("page-increment");
   Page_Size_Property : constant Glib.Properties.Property_Double :=
     Glib.Properties.Build ("page-size");
   Step_Increment_Property : constant Glib.Properties.Property_Double :=
     Glib.Properties.Build ("step-increment");
   Upper_Property : constant Glib.Properties.Property_Double :=
     Glib.Properties.Build ("upper");
   Value_Property : constant Glib.Properties.Property_Double :=
     Glib.Properties.Build ("value");

   pragma Import (C, Get_Type, "gtk_adjustment_get_type");
end Gtk.Adjustment;