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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
-- Programmed by Jedidiah Barber
-- Released into the public domain
with
Ada.Iterator_Interfaces;
private with
System.Address_To_Access_Conversions;
package FLTK.Widgets.Groups is
type Group is new Widget with private
with Default_Iterator => Iterate,
Iterator_Element => Widget_Reference,
Variable_Indexing => Child;
type Group_Reference (Data : not null access Group'Class) is limited null record
with Implicit_Dereference => Data;
subtype Index is Positive;
subtype Extended_Index is Natural;
No_Index : constant Extended_Index := Extended_Index'First;
type Clip_Mode is (No_Clip, Clip);
type Cursor is private;
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String := "")
return Group;
function Create
(Parent : in out Group'Class;
X, Y, W, H : in Integer;
Text : in String := "")
return Group;
end Forge;
procedure Add
(This : in out Group;
Item : in out Widget'Class);
procedure Insert
(This : in out Group;
Item : in out Widget'Class;
Place : in Index);
procedure Insert
(This : in out Group;
Item : in out Widget'Class;
Before : in Widget'Class);
procedure Remove
(This : in out Group;
Item : in out Widget'Class);
procedure Remove
(This : in out Group;
Place : in Index);
procedure Clear
(This : in out Group);
function Has_Child
(This : in Group;
Place : in Index)
return Boolean;
function Has_Child
(Place : in Cursor)
return Boolean;
function Child
(This : in Group;
Place : in Index)
return Widget_Reference
with Pre => This.Has_Child (Place);
function Child
(This : in Group;
Place : in Cursor)
return Widget_Reference;
function Find
(This : in Group;
Item : in out Widget'Class)
return Extended_Index;
function Number_Of_Children
(This : in Group)
return Natural;
package Group_Iterators is
new Ada.Iterator_Interfaces (Cursor, Has_Child);
function Iterate
(This : in Group)
return Group_Iterators.Reversible_Iterator'Class;
function Get_Clip_Mode
(This : in Group)
return Clip_Mode;
procedure Set_Clip_Mode
(This : in out Group;
Mode : in Clip_Mode := Clip);
procedure Add_Resizable
(This : in out Group;
Item : in out Widget'Class);
function Get_Resizable
(This : in Group)
return access Widget'Class;
procedure Set_Resizable
(This : in out Group;
Item : in Widget'Class);
procedure Reset_Sizes
(This : in out Group);
procedure Resize
(This : in out Group;
X, Y, W, H : in Integer);
function Get_Current
return access Group'Class;
procedure Set_Current
(To : in Group'Class);
procedure Begin_Current
(This : in out Group);
procedure End_Current
(This : in out Group);
procedure Draw
(This : in out Group);
procedure Draw_Child
(This : in out Group;
Item : in out Widget'Class);
procedure Draw_Children
(This : in out Group);
procedure Draw_Outside_Label
(This : in out Group;
Item : in out Widget'Class);
procedure Update_Child
(This : in out Group;
Item : in out Widget'Class);
function Handle
(This : in out Group;
Event : in Event_Kind)
return Event_Outcome;
private
type Group is new Widget with null record;
overriding procedure Initialize
(This : in out Group);
overriding procedure Finalize
(This : in out Group);
procedure Extra_Init
(This : in out Group;
X, Y, W, H : in Integer;
Text : in String);
procedure Extra_Final
(This : in out Group);
package Group_Convert is new System.Address_To_Access_Conversions (Group);
type Cursor is record
My_Container : access Group;
My_Index : Index'Base := Index'First;
end record;
type Iterator is new Group_Iterators.Reversible_Iterator with record
My_Container : access Group;
end record;
overriding function First
(Object : in Iterator)
return Cursor;
overriding function Next
(Object : in Iterator;
Place : in Cursor)
return Cursor;
overriding function Last
(Object : in Iterator)
return Cursor;
overriding function Previous
(Object : in Iterator;
Place : in Cursor)
return Cursor;
pragma Inline (Add);
pragma Inline (Insert);
pragma Inline (Remove);
pragma Inline (Clear);
pragma Inline (Has_Child);
pragma Inline (Child);
pragma Inline (Find);
pragma Inline (Number_Of_Children);
pragma Inline (Iterate);
pragma Inline (Get_Clip_Mode);
pragma Inline (Set_Clip_Mode);
pragma Inline (Add_Resizable);
pragma Inline (Set_Resizable);
pragma Inline (Reset_Sizes);
pragma Inline (Resize);
pragma Inline (Set_Current);
pragma Inline (Begin_Current);
pragma Inline (End_Current);
pragma Inline (Draw);
pragma Inline (Draw_Child);
pragma Inline (Draw_Children);
pragma Inline (Draw_Outside_Label);
pragma Inline (Update_Child);
pragma Inline (Handle);
end FLTK.Widgets.Groups;
|