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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
-- Programmed by Jedidiah Barber
-- Released into the public domain
package FLTK.Widgets.Groups.Browsers.Check is
-- Since the FLTK 1.3 implementation doesn't provide the following key functions:
--
-- item_at / Item_At
-- item_last / Item_Last
-- item_swap / Item_Swap
-- item_text / Item_Text
--
-- You can't use Sort on a Check_Browser unless you want a crash. The item_*
-- methods in C++ are also private which makes it nigh impossible to properly
-- bind to Ada, so you can't use those either.
--
-- Find_Item is also private in C++ in 1.3 for whatever reason, so that might
-- have unexpected behaviour.
--
-- So, uh, be aware of all that, I guess? Or wait until I get around to 1.4.
-- Using the equivalent of the C++ public API should still work fine right now.
type Check_Browser is new Browser with private;
type Check_Browser_Reference (Data : not null access Check_Browser'Class) is
limited null record with Implicit_Dereference => Data;
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String := "")
return Check_Browser;
end Forge;
-- Adding and removing
procedure Add
(This : in out Check_Browser;
Text : in String;
Checked : in Boolean := False);
procedure Remove
(This : in out Check_Browser;
Index : in Positive);
procedure Clear
(This : in out Check_Browser);
function Number_Of_Items
(This : in Check_Browser)
return Natural;
-- Checking and unchecking
procedure Check_All
(This : in out Check_Browser);
procedure Check_None
(This : in out Check_Browser);
function Is_Checked
(This : in Check_Browser;
Index : in Positive)
return Boolean;
procedure Set_Checked
(This : in out Check_Browser;
Index : in Positive;
State : in Boolean);
function Number_Checked
(This : in Check_Browser)
return Natural;
-- Text and selection
-- Don't confuse this with the missing Item_Cursor version
function Item_Text
(This : in Check_Browser;
Index : in Positive)
return String;
function Selected_Index
(This : in Check_Browser)
return Positive;
-- Item related stuff reimplemented for binding-related reasons.
-- These subprograms are protected on the C++ side.
function Current_Selection
(This : in Check_Browser)
return Item_Cursor;
function Is_Displayed
(This : in Check_Browser;
Item : in Item_Cursor)
return Boolean;
function Find_Item
(This : in Check_Browser;
Y_Pos : in Integer)
return Item_Cursor;
function Top_Item
(This : in Check_Browser)
return Item_Cursor;
-- Graphical dimensions and redrawing reimplemented for binding-related reasons.
-- These subprograms are protected on the C++ side.
procedure Bounding_Box
(This : in Check_Browser;
X, Y, W, H : out Integer);
function Left_Edge
(This : in Check_Browser)
return Integer;
procedure Redraw_Line
(This : in out Check_Browser;
Item : in Item_Cursor);
procedure Redraw_List
(This : in out Check_Browser);
-- Optional overrides reimplemented for binding-related reasons.
-- These subprograms are protected on the C++ side.
function Full_List_Width
(This : in Check_Browser)
return Integer;
function Full_List_Height
(This : in Check_Browser)
return Integer;
function Average_Item_Height
(This : in Check_Browser)
return Integer;
function Item_Quick_Height
(This : in Check_Browser;
Item : in Item_Cursor)
return Integer;
-- These Item_* subprograms are disabled due to a bug in FLTK 1.3.
-- Should be able to bind them properly when 1.4 comes around.
-- function Item_Width
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Integer;
-- function Item_Height
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Integer;
-- function Item_First
-- (This : in Check_Browser)
-- return Item_Cursor;
-- Item_Last missing in 1.3
-- function Item_Next
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Item_Cursor;
-- function Item_Previous
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Item_Cursor;
-- Item_At missing in 1.3
-- procedure Item_Select
-- (This : in out Check_Browser;
-- Item : in Item_Cursor;
-- State : in Boolean := True);
-- function Item_Selected
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Boolean;
-- Item_Swap and Item_Text missing in 1.3
-- procedure Item_Draw
-- (This : in Check_Browser;
-- Item : in Item_Cursor;
-- X, Y, W, H : in Integer);
-- Cache invalidation reimplemented for binding-related reasons.
-- These subprograms are protected on the C++ side.
procedure New_List
(This : in out Check_Browser);
procedure Inserting
(This : in out Check_Browser;
A, B : in Item_Cursor);
procedure Deleting
(This : in out Check_Browser;
Item : in Item_Cursor);
procedure Replacing
(This : in out Check_Browser;
A, B : in Item_Cursor);
procedure Swapping
(This : in out Check_Browser;
A, B : in Item_Cursor);
procedure Draw
(This : in out Check_Browser);
function Handle
(This : in out Check_Browser;
Event : in Event_Kind)
return Event_Outcome;
private
type Check_Browser is new Browser with null record;
overriding procedure Finalize
(This : in out Check_Browser);
procedure Extra_Init
(This : in out Check_Browser;
X, Y, W, H : in Integer;
Text : in String);
procedure Extra_Final
(This : in out Check_Browser);
pragma Inline (Add);
pragma Inline (Remove);
pragma Inline (Clear);
pragma Inline (Number_Of_Items);
pragma Inline (Check_All);
pragma Inline (Check_None);
pragma Inline (Is_Checked);
pragma Inline (Set_Checked);
pragma Inline (Number_Checked);
pragma Inline (Item_Text);
pragma Inline (Selected_Index);
pragma Inline (Current_Selection);
pragma Inline (Find_Item);
pragma Inline (Top_Item);
pragma Inline (Bounding_Box);
pragma Inline (Left_Edge);
pragma Inline (Redraw_Line);
pragma Inline (Redraw_List);
pragma Inline (Full_List_Width);
pragma Inline (Full_List_Height);
pragma Inline (Average_Item_Height);
pragma Inline (Item_Quick_Height);
-- pragma Inline (Item_Width);
-- pragma Inline (Item_Height);
-- pragma Inline (Item_First);
-- pragma Inline (Item_Next);
-- pragma Inline (Item_Previous);
-- pragma Inline (Item_Select);
-- pragma Inline (Item_Selected);
-- pragma Inline (Item_Draw);
pragma Inline (New_List);
pragma Inline (Inserting);
pragma Inline (Deleting);
pragma Inline (Replacing);
pragma Inline (Swapping);
pragma Inline (Draw);
pragma Inline (Handle);
end FLTK.Widgets.Groups.Browsers.Check;
|