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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
|
-- Programmed by Jedidiah Barber
-- Released into the public domain
with
Interfaces.C.Strings;
use type
Interfaces.C.int;
package body FLTK.Widgets.Groups.Browsers.Check is
------------------------
-- Functions From C --
------------------------
function new_fl_check_browser
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return Storage.Integer_Address;
pragma Import (C, new_fl_check_browser, "new_fl_check_browser");
pragma Inline (new_fl_check_browser);
procedure free_fl_check_browser
(C : in Storage.Integer_Address);
pragma Import (C, free_fl_check_browser, "free_fl_check_browser");
pragma Inline (free_fl_check_browser);
function fl_check_browser_add
(C : in Storage.Integer_Address;
S : in Interfaces.C.char_array;
B : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_add, "fl_check_browser_add");
pragma Inline (fl_check_browser_add);
function fl_check_browser_remove
(C : in Storage.Integer_Address;
I : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_remove, "fl_check_browser_remove");
pragma Inline (fl_check_browser_remove);
procedure fl_check_browser_clear
(C : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_clear, "fl_check_browser_clear");
pragma Inline (fl_check_browser_clear);
function fl_check_browser_nitems
(C : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_nitems, "fl_check_browser_nitems");
pragma Inline (fl_check_browser_nitems);
procedure fl_check_browser_check_all
(C : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_check_all, "fl_check_browser_check_all");
pragma Inline (fl_check_browser_check_all);
procedure fl_check_browser_check_none
(C : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_check_none, "fl_check_browser_check_none");
pragma Inline (fl_check_browser_check_none);
function fl_check_browser_get_checked
(C : in Storage.Integer_Address;
I : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_get_checked, "fl_check_browser_get_checked");
pragma Inline (fl_check_browser_get_checked);
procedure fl_check_browser_set_checked
(C : in Storage.Integer_Address;
I, B : in Interfaces.C.int);
pragma Import (C, fl_check_browser_set_checked, "fl_check_browser_set_checked");
pragma Inline (fl_check_browser_set_checked);
function fl_check_browser_nchecked
(C : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_nchecked, "fl_check_browser_nchecked");
pragma Inline (fl_check_browser_nchecked);
function fl_check_browser_text
(C : in Storage.Integer_Address;
I : in Interfaces.C.int)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_check_browser_text, "fl_check_browser_text");
pragma Inline (fl_check_browser_text);
function fl_check_browser_value
(C : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_value, "fl_check_browser_value");
pragma Inline (fl_check_browser_value);
function fl_check_browser_selection
(B : in Storage.Integer_Address)
return Storage.Integer_Address;
pragma Import (C, fl_check_browser_selection, "fl_check_browser_selection");
pragma Inline (fl_check_browser_selection);
function fl_check_browser_displayed
(B, I : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_displayed, "fl_check_browser_displayed");
pragma Inline (fl_check_browser_displayed);
function fl_check_browser_find_item
(B : in Storage.Integer_Address;
Y : in Interfaces.C.int)
return Storage.Integer_Address;
pragma Import (C, fl_check_browser_find_item, "fl_check_browser_find_item");
pragma Inline (fl_check_browser_find_item);
function fl_check_browser_top
(B : in Storage.Integer_Address)
return Storage.Integer_Address;
pragma Import (C, fl_check_browser_top, "fl_check_browser_top");
pragma Inline (fl_check_browser_top);
procedure fl_check_browser_bbox
(B : in Storage.Integer_Address;
X, Y, W, H : out Interfaces.C.int);
pragma Import (C, fl_check_browser_bbox, "fl_check_browser_bbox");
pragma Inline (fl_check_browser_bbox);
function fl_check_browser_leftedge
(B : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_leftedge, "fl_check_browser_leftedge");
pragma Inline (fl_check_browser_leftedge);
procedure fl_check_browser_redraw_line
(B, I : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_redraw_line, "fl_check_browser_redraw_line");
pragma Inline (fl_check_browser_redraw_line);
procedure fl_check_browser_redraw_lines
(B : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_redraw_lines, "fl_check_browser_redraw_lines");
pragma Inline (fl_check_browser_redraw_lines);
function fl_check_browser_full_width
(B : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_full_width, "fl_check_browser_full_width");
pragma Inline (fl_check_browser_full_width);
function fl_check_browser_full_height
(B : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_full_height, "fl_check_browser_full_height");
pragma Inline (fl_check_browser_full_height);
function fl_check_browser_incr_height
(B : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_incr_height, "fl_check_browser_incr_height");
pragma Inline (fl_check_browser_incr_height);
function fl_check_browser_item_quick_height
(B, I : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_item_quick_height, "fl_check_browser_item_quick_height");
pragma Inline (fl_check_browser_item_quick_height);
function fl_check_browser_item_width
(C, I : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_item_width, "fl_check_browser_item_width");
pragma Inline (fl_check_browser_item_width);
function fl_check_browser_item_height
(C, I : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_item_height, "fl_check_browser_item_height");
pragma Inline (fl_check_browser_item_height);
function fl_check_browser_item_first
(C : in Storage.Integer_Address)
return Storage.Integer_Address;
pragma Import (C, fl_check_browser_item_first, "fl_check_browser_item_first");
pragma Inline (fl_check_browser_item_first);
-- Missing item_last
function fl_check_browser_item_next
(C, I : in Storage.Integer_Address)
return Storage.Integer_Address;
pragma Import (C, fl_check_browser_item_next, "fl_check_browser_item_next");
pragma Inline (fl_check_browser_item_next);
function fl_check_browser_item_prev
(C, I : in Storage.Integer_Address)
return Storage.Integer_Address;
pragma Import (C, fl_check_browser_item_prev, "fl_check_browser_item_prev");
pragma Inline (fl_check_browser_item_prev);
-- Missing item_at
procedure fl_check_browser_item_select
(C, I : in Storage.Integer_Address;
V : in Interfaces.C.int);
pragma Import (C, fl_check_browser_item_select, "fl_check_browser_item_select");
pragma Inline (fl_check_browser_item_select);
function fl_check_browser_item_selected
(C, I : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_item_selected, "fl_check_browser_item_selected");
pragma Inline (fl_check_browser_item_selected);
-- Missing item_swap and item_text
procedure fl_check_browser_item_draw
(C, I : in Storage.Integer_Address;
X, Y, W, H : in Interfaces.C.int);
pragma Import (C, fl_check_browser_item_draw, "fl_check_browser_item_draw");
pragma Inline (fl_check_browser_item_draw);
procedure fl_check_browser_new_list
(B : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_new_list, "fl_check_browser_new_list");
pragma Inline (fl_check_browser_new_list);
procedure fl_check_browser_inserting
(B, A1, A2 : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_inserting, "fl_check_browser_inserting");
pragma Inline (fl_check_browser_inserting);
procedure fl_check_browser_deleting
(B, I : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_deleting, "fl_check_browser_deleting");
pragma Inline (fl_check_browser_deleting);
procedure fl_check_browser_replacing
(B, A1, A2 : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_replacing, "fl_check_browser_replacing");
pragma Inline (fl_check_browser_replacing);
procedure fl_check_browser_swapping
(B, A1, A2 : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_swapping, "fl_check_browser_swapping");
pragma Inline (fl_check_browser_swapping);
procedure fl_check_browser_draw
(B : in Storage.Integer_Address);
pragma Import (C, fl_check_browser_draw, "fl_check_browser_draw");
pragma Inline (fl_check_browser_draw);
function fl_check_browser_handle
(B : in Storage.Integer_Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_check_browser_handle, "fl_check_browser_handle");
pragma Inline (fl_check_browser_handle);
-------------------
-- Destructors --
-------------------
procedure Extra_Final
(This : in out Check_Browser) is
begin
Extra_Final (Browser (This));
end Extra_Final;
procedure Finalize
(This : in out Check_Browser) is
begin
Extra_Final (This);
if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then
free_fl_check_browser (This.Void_Ptr);
This.Void_Ptr := Null_Pointer;
end if;
end Finalize;
--------------------
-- Constructors --
--------------------
procedure Extra_Init
(This : in out Check_Browser;
X, Y, W, H : in Integer;
Text : in String) is
begin
Extra_Init (Browser (This), X, Y, W, H, Text);
end Extra_Init;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String := "")
return Check_Browser is
begin
return This : Check_Browser do
This.Void_Ptr := new_fl_check_browser
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
Extra_Init (This, X, Y, W, H, Text);
end return;
end Create;
end Forge;
-------------------------
-- Check_Browser API --
-------------------------
procedure Add
(This : in out Check_Browser;
Text : in String;
Checked : in Boolean := False)
is
Code : Interfaces.C.int := fl_check_browser_add
(This.Void_Ptr,
Interfaces.C.To_C (Text),
Boolean'Pos (Checked));
begin
null;
end Add;
procedure Remove
(This : in out Check_Browser;
Index : in Positive)
is
Code : Interfaces.C.int := fl_check_browser_remove
(This.Void_Ptr,
Interfaces.C.int (Index));
begin
null;
end Remove;
procedure Clear
(This : in out Check_Browser) is
begin
fl_check_browser_clear (This.Void_Ptr);
end Clear;
function Number_Of_Items
(This : in Check_Browser)
return Natural is
begin
return Natural (fl_check_browser_nitems (This.Void_Ptr));
end Number_Of_Items;
procedure Check_All
(This : in out Check_Browser) is
begin
fl_check_browser_check_all (This.Void_Ptr);
end Check_All;
procedure Check_None
(This : in out Check_Browser) is
begin
fl_check_browser_check_none (This.Void_Ptr);
end Check_None;
function Is_Checked
(This : in Check_Browser;
Index : in Positive)
return Boolean is
begin
return fl_check_browser_get_checked (This.Void_Ptr, Interfaces.C.int (Index)) /= 0;
end Is_Checked;
procedure Set_Checked
(This : in out Check_Browser;
Index : in Positive;
State : in Boolean) is
begin
fl_check_browser_set_checked
(This.Void_Ptr,
Interfaces.C.int (Index),
Boolean'Pos (State));
end Set_Checked;
function Number_Checked
(This : in Check_Browser)
return Natural is
begin
return Natural (fl_check_browser_nchecked (This.Void_Ptr));
end Number_Checked;
function Item_Text
(This : in Check_Browser;
Index : in Positive)
return String is
begin
return Interfaces.C.Strings.Value
(fl_check_browser_text (This.Void_Ptr, Interfaces.C.int (Index)));
end Item_Text;
function Selected_Index
(This : in Check_Browser)
return Positive is
begin
return Positive (fl_check_browser_value (This.Void_Ptr));
end Selected_Index;
function Current_Selection
(This : in Check_Browser)
return Item_Cursor is
begin
return Address_To_Cursor (fl_check_browser_selection (This.Void_Ptr));
end Current_Selection;
function Is_Displayed
(This : in Check_Browser;
Item : in Item_Cursor)
return Boolean
is
Code : Interfaces.C.int := fl_check_browser_displayed
(This.Void_Ptr,
Cursor_To_Address (Item));
begin
if Code not in 0 .. 1 then
raise Internal_FLTK_Error;
end if;
return Boolean'Val (Code);
end Is_Displayed;
function Find_Item
(This : in Check_Browser;
Y_Pos : in Integer)
return Item_Cursor is
begin
return Address_To_Cursor
(fl_check_browser_find_item (This.Void_Ptr, Interfaces.C.int (Y_Pos)));
end Find_Item;
function Top_Item
(This : in Check_Browser)
return Item_Cursor is
begin
return Address_To_Cursor (fl_check_browser_top (This.Void_Ptr));
end Top_Item;
procedure Bounding_Box
(This : in Check_Browser;
X, Y, W, H : out Integer) is
begin
fl_check_browser_bbox
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H));
end Bounding_Box;
function Left_Edge
(This : in Check_Browser)
return Integer is
begin
return Integer (fl_check_browser_leftedge (This.Void_Ptr));
end Left_Edge;
procedure Redraw_Line
(This : in out Check_Browser;
Item : in Item_Cursor) is
begin
fl_check_browser_redraw_line (This.Void_Ptr, Cursor_To_Address (Item));
end Redraw_Line;
procedure Redraw_List
(This : in out Check_Browser) is
begin
fl_check_browser_redraw_lines (This.Void_Ptr);
end Redraw_List;
function Full_List_Width
(This : in Check_Browser)
return Integer is
begin
return Integer (fl_check_browser_full_width (This.Void_Ptr));
end Full_List_Width;
function Full_List_Height
(This : in Check_Browser)
return Integer is
begin
return Integer (fl_check_browser_full_height (This.Void_Ptr));
end Full_List_Height;
function Average_Item_Height
(This : in Check_Browser)
return Integer is
begin
return Integer (fl_check_browser_incr_height (This.Void_Ptr));
end Average_Item_Height;
function Item_Quick_Height
(This : in Check_Browser;
Item : in Item_Cursor)
return Integer is
begin
return Integer (fl_check_browser_item_quick_height
(This.Void_Ptr,
Cursor_To_Address (Item)));
end Item_Quick_Height;
-- function Item_Width
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Integer is
-- begin
-- return Integer (fl_check_browser_item_width
-- (This.Void_Ptr,
-- Cursor_To_Address (Item)));
-- end Item_Width;
-- function Item_Height
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Integer is
-- begin
-- return Integer (fl_check_browser_item_height
-- (This.Void_Ptr,
-- Cursor_To_Address (Item)));
-- end Item_Height;
-- function Item_First
-- (This : in Check_Browser)
-- return Item_Cursor is
-- begin
-- return Address_To_Cursor (fl_check_browser_item_first (This.Void_Ptr));
-- end Item_First;
-- Note that Item_Last is not implemented
-- function Item_Next
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Item_Cursor is
-- begin
-- return Address_To_Cursor (fl_check_browser_item_next
-- (This.Void_Ptr,
-- Cursor_To_Address (Item)));
-- end Item_Next;
-- function Item_Previous
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Item_Cursor is
-- begin
-- return Address_To_Cursor (fl_check_browser_item_prev
-- (This.Void_Ptr,
-- Cursor_To_Address (Item)));
-- end Item_Previous;
-- Note that Item_At is not implemented
-- procedure Item_Select
-- (This : in out Check_Browser;
-- Item : in Item_Cursor;
-- State : in Boolean := True) is
-- begin
-- fl_check_browser_item_select
-- (This.Void_Ptr,
-- Cursor_To_Address (Item),
-- Boolean'Pos (State));
-- end Item_Select;
-- function Item_Selected
-- (This : in Check_Browser;
-- Item : in Item_Cursor)
-- return Boolean is
-- begin
-- return fl_check_browser_selected (This.Void_Ptr, Cursor_To_Address (Item)) /= 0;
-- end Item_Selected;
-- Note that Item_Swap and Item_Text are not implemented
-- procedure Item_Draw
-- (This : in Check_Browser;
-- Item : in Item_Cursor;
-- X, Y, W, H : in Integer) is
-- begin
-- fl_check_browser_item_draw
-- (This.Void_Ptr,
-- Cursor_To_Address (Item),
-- Interfaces.C.int (X),
-- Interfaces.C.int (Y),
-- Interfaces.C.int (W),
-- Interfaces.C.int (H));
-- end Item_Draw;
procedure New_List
(This : in out Check_Browser) is
begin
fl_check_browser_new_list (This.Void_Ptr);
end New_List;
procedure Inserting
(This : in out Check_Browser;
A, B : in Item_Cursor) is
begin
fl_check_browser_inserting
(This.Void_Ptr,
Cursor_To_Address (A),
Cursor_To_Address (B));
end Inserting;
procedure Deleting
(This : in out Check_Browser;
Item : in Item_Cursor) is
begin
fl_check_browser_deleting
(This.Void_Ptr,
Cursor_To_Address (Item));
end Deleting;
procedure Replacing
(This : in out Check_Browser;
A, B : in Item_Cursor) is
begin
fl_check_browser_replacing
(This.Void_Ptr,
Cursor_To_Address (A),
Cursor_To_Address (B));
end Replacing;
procedure Swapping
(This : in out Check_Browser;
A, B : in Item_Cursor) is
begin
fl_check_browser_swapping
(This.Void_Ptr,
Cursor_To_Address (A),
Cursor_To_Address (B));
end Swapping;
procedure Draw
(This : in out Check_Browser) is
begin
fl_check_browser_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Check_Browser;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_check_browser_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Groups.Browsers.Check;
|