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
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
|
with
Interfaces.C.Strings,
System.Address_To_Access_Conversions,
FLTK.Widgets.Groups.Windows,
FLTK.Images;
use type
Interfaces.C.int,
Interfaces.C.unsigned,
Interfaces.C.Strings.chars_ptr,
System.Address;
package body FLTK.Widgets is
function "+"
(Left, Right : in Callback_Flag)
return Callback_Flag is
begin
return Left or Right;
end "+";
package Group_Convert is new
System.Address_To_Access_Conversions (FLTK.Widgets.Groups.Group'Class);
package Window_Convert is new
System.Address_To_Access_Conversions (FLTK.Widgets.Groups.Windows.Window'Class);
procedure widget_set_draw_hook
(W, D : in System.Address);
pragma Import (C, widget_set_draw_hook, "widget_set_draw_hook");
pragma Inline (widget_set_draw_hook);
procedure widget_set_handle_hook
(W, H : in System.Address);
pragma Import (C, widget_set_handle_hook, "widget_set_handle_hook");
pragma Inline (widget_set_handle_hook);
function new_fl_widget
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_widget, "new_fl_widget");
pragma Inline (new_fl_widget);
procedure free_fl_widget
(F : in System.Address);
pragma Import (C, free_fl_widget, "free_fl_widget");
pragma Inline (free_fl_widget);
procedure fl_widget_activate
(W : in System.Address);
pragma Import (C, fl_widget_activate, "fl_widget_activate");
pragma Inline (fl_widget_activate);
procedure fl_widget_deactivate
(W : in System.Address);
pragma Import (C, fl_widget_deactivate, "fl_widget_deactivate");
pragma Inline (fl_widget_deactivate);
function fl_widget_active
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_active, "fl_widget_active");
pragma Inline (fl_widget_active);
function fl_widget_active_r
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_active_r, "fl_widget_active_r");
pragma Inline (fl_widget_active_r);
procedure fl_widget_set_active
(W : in System.Address);
pragma Import (C, fl_widget_set_active, "fl_widget_set_active");
pragma Inline (fl_widget_set_active);
procedure fl_widget_clear_active
(W : in System.Address);
pragma Import (C, fl_widget_clear_active, "fl_widget_clear_active");
pragma Inline (fl_widget_clear_active);
function fl_widget_changed
(W : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_widget_changed, "fl_widget_changed");
pragma Inline (fl_widget_changed);
procedure fl_widget_set_changed
(W : in System.Address);
pragma Import (C, fl_widget_set_changed, "fl_widget_set_changed");
pragma Inline (fl_widget_set_changed);
procedure fl_widget_clear_changed
(W : in System.Address);
pragma Import (C, fl_widget_clear_changed, "fl_widget_clear_changed");
pragma Inline (fl_widget_clear_changed);
function fl_widget_output
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_output, "fl_widget_output");
pragma Inline (fl_widget_output);
procedure fl_widget_set_output
(W : in System.Address);
pragma Import (C, fl_widget_set_output, "fl_widget_set_output");
pragma Inline (fl_widget_set_output);
procedure fl_widget_clear_output
(W : in System.Address);
pragma Import (C, fl_widget_clear_output, "fl_widget_clear_output");
pragma Inline (fl_widget_clear_output);
function fl_widget_visible
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_visible, "fl_widget_visible");
pragma Inline (fl_widget_visible);
function fl_widget_visible_r
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_visible_r, "fl_widget_visible_r");
pragma Inline (fl_widget_visible_r);
procedure fl_widget_set_visible
(W : in System.Address);
pragma Import (C, fl_widget_set_visible, "fl_widget_set_visible");
pragma Inline (fl_widget_set_visible);
procedure fl_widget_clear_visible
(W : in System.Address);
pragma Import (C, fl_widget_clear_visible, "fl_widget_clear_visible");
pragma Inline (fl_widget_clear_visible);
function fl_widget_get_visible_focus
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_visible_focus, "fl_widget_get_visible_focus");
pragma Inline (fl_widget_get_visible_focus);
procedure fl_widget_set_visible_focus
(W : in System.Address;
T : in Interfaces.C.int);
pragma Import (C, fl_widget_set_visible_focus, "fl_widget_set_visible_focus");
pragma Inline (fl_widget_set_visible_focus);
function fl_widget_take_focus
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_take_focus, "fl_widget_take_focus");
pragma Inline (fl_widget_take_focus);
function fl_widget_takesevents
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_takesevents, "fl_widget_takesevents");
pragma Inline (fl_widget_takesevents);
function fl_widget_get_color
(W : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_widget_get_color, "fl_widget_get_color");
pragma Inline (fl_widget_get_color);
procedure fl_widget_set_color
(W : in System.Address;
T : in Interfaces.C.unsigned);
pragma Import (C, fl_widget_set_color, "fl_widget_set_color");
pragma Inline (fl_widget_set_color);
function fl_widget_get_selection_color
(W : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_widget_get_selection_color, "fl_widget_get_selection_color");
pragma Inline (fl_widget_get_selection_color);
procedure fl_widget_set_selection_color
(W : in System.Address;
T : in Interfaces.C.unsigned);
pragma Import (C, fl_widget_set_selection_color, "fl_widget_set_selection_color");
pragma Inline (fl_widget_set_selection_color);
function fl_widget_get_parent
(W : in System.Address)
return System.Address;
pragma Import (C, fl_widget_get_parent, "fl_widget_get_parent");
pragma Inline (fl_widget_get_parent);
function fl_widget_contains
(W, I : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_contains, "fl_widget_contains");
pragma Inline (fl_widget_contains);
function fl_widget_inside
(W, P : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_inside, "fl_widget_inside");
pragma Inline (fl_widget_inside);
function fl_widget_window
(W : in System.Address)
return System.Address;
pragma Import (C, fl_widget_window, "fl_widget_window");
pragma Inline (fl_widget_window);
function fl_widget_top_window
(W : in System.Address)
return System.Address;
pragma Import (C, fl_widget_top_window, "fl_widget_top_window");
pragma Inline (fl_widget_top_window);
function fl_widget_top_window_offset
(W : in System.Address;
X, Y : out Interfaces.C.int)
return System.Address;
pragma Import (C, fl_widget_top_window_offset, "fl_widget_top_window_offset");
pragma Inline (fl_widget_top_window_offset);
function fl_widget_get_align
(W : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_widget_get_align, "fl_widget_get_align");
pragma Inline (fl_widget_get_align);
procedure fl_widget_set_align
(W : in System.Address;
A : in Interfaces.C.unsigned);
pragma Import (C, fl_widget_set_align, "fl_widget_set_align");
pragma Inline (fl_widget_set_align);
function fl_widget_get_box
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_box, "fl_widget_get_box");
pragma Inline (fl_widget_get_box);
procedure fl_widget_set_box
(W : in System.Address;
B : in Interfaces.C.int);
pragma Import (C, fl_widget_set_box, "fl_widget_set_box");
pragma Inline (fl_widget_set_box);
function fl_widget_tooltip
(W : in System.Address)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_widget_tooltip, "fl_widget_tooltip");
pragma Inline (fl_widget_tooltip);
procedure fl_widget_copy_tooltip
(W : in System.Address;
T : in Interfaces.C.char_array);
pragma Import (C, fl_widget_copy_tooltip, "fl_widget_copy_tooltip");
pragma Inline (fl_widget_copy_tooltip);
function fl_widget_get_label
(W : in System.Address)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_widget_get_label, "fl_widget_get_label");
pragma Inline (fl_widget_get_label);
function fl_widget_get_labelcolor
(W : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_widget_get_labelcolor, "fl_widget_get_labelcolor");
pragma Inline (fl_widget_get_labelcolor);
procedure fl_widget_set_labelcolor
(W : in System.Address;
V : in Interfaces.C.unsigned);
pragma Import (C, fl_widget_set_labelcolor, "fl_widget_set_labelcolor");
pragma Inline (fl_widget_set_labelcolor);
function fl_widget_get_labelfont
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_labelfont, "fl_widget_get_labelfont");
pragma Inline (fl_widget_get_labelfont);
procedure fl_widget_set_labelfont
(W : in System.Address;
F : in Interfaces.C.int);
pragma Import (C, fl_widget_set_labelfont, "fl_widget_set_labelfont");
pragma Inline (fl_widget_set_labelfont);
function fl_widget_get_labelsize
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_labelsize, "fl_widget_get_labelsize");
pragma Inline (fl_widget_get_labelsize);
procedure fl_widget_set_labelsize
(W : in System.Address;
S : in Interfaces.C.int);
pragma Import (C, fl_widget_set_labelsize, "fl_widget_set_labelsize");
pragma Inline (fl_widget_set_labelsize);
function fl_widget_get_labeltype
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_labeltype, "fl_widget_get_labeltype");
pragma Inline (fl_widget_get_labeltype);
procedure fl_widget_set_labeltype
(W : in System.Address;
L : in Interfaces.C.int);
pragma Import (C, fl_widget_set_labeltype, "fl_widget_set_labeltype");
pragma Inline (fl_widget_set_labeltype);
procedure fl_widget_measure_label
(W : in System.Address;
D, H : out Interfaces.C.int);
pragma Import (C, fl_widget_measure_label, "fl_widget_measure_label");
pragma Inline (fl_widget_measure_label);
procedure fl_widget_set_callback
(W, C : in System.Address);
pragma Import (C, fl_widget_set_callback, "fl_widget_set_callback");
pragma Inline (fl_widget_set_callback);
function fl_widget_get_when
(W : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_widget_get_when, "fl_widget_get_when");
pragma Inline (fl_widget_get_when);
procedure fl_widget_set_when
(W : in System.Address;
T : in Interfaces.C.unsigned);
pragma Import (C, fl_widget_set_when, "fl_widget_set_when");
pragma Inline (fl_widget_set_when);
function fl_widget_get_x
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_x, "fl_widget_get_x");
pragma Inline (fl_widget_get_x);
function fl_widget_get_y
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_y, "fl_widget_get_y");
pragma Inline (fl_widget_get_y);
function fl_widget_get_w
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_w, "fl_widget_get_w");
pragma Inline (fl_widget_get_w);
function fl_widget_get_h
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_get_h, "fl_widget_get_h");
pragma Inline (fl_widget_get_h);
procedure fl_widget_size
(W : in System.Address;
D, H : in Interfaces.C.int);
pragma Import (C, fl_widget_size, "fl_widget_size");
pragma Inline (fl_widget_size);
procedure fl_widget_position
(W : in System.Address;
X, Y : in Interfaces.C.int);
pragma Import (C, fl_widget_position, "fl_widget_position");
pragma Inline (fl_widget_position);
procedure fl_widget_set_image
(W, I : in System.Address);
pragma Import (C, fl_widget_set_image, "fl_widget_set_image");
pragma Inline (fl_widget_set_image);
procedure fl_widget_set_deimage
(W, I : in System.Address);
pragma Import (C, fl_widget_set_deimage, "fl_widget_set_deimage");
pragma Inline (fl_widget_set_deimage);
function fl_widget_damage
(W : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_widget_damage, "fl_widget_damage");
pragma Inline (fl_widget_damage);
procedure fl_widget_set_damage
(W : in System.Address;
T : in Interfaces.C.int);
pragma Import (C, fl_widget_set_damage, "fl_widget_set_damage");
pragma Inline (fl_widget_set_damage);
procedure fl_widget_set_damage2
(W : in System.Address;
T : in Interfaces.C.int;
X, Y, D, H : in Interfaces.C.int);
pragma Import (C, fl_widget_set_damage2, "fl_widget_set_damage2");
pragma Inline (fl_widget_set_damage2);
procedure fl_widget_draw_label
(W : in System.Address;
X, Y, D, H : in Interfaces.C.int;
A : in Interfaces.C.unsigned);
pragma Import (C, fl_widget_draw_label, "fl_widget_draw_label");
pragma Inline (fl_widget_draw_label);
procedure fl_widget_redraw
(W : in System.Address);
pragma Import (C, fl_widget_redraw, "fl_widget_redraw");
pragma Inline (fl_widget_redraw);
procedure fl_widget_redraw_label
(W : in System.Address);
pragma Import (C, fl_widget_redraw_label, "fl_widget_redraw_label");
pragma Inline (fl_widget_redraw_label);
procedure Callback_Hook
(W, U : in System.Address)
is
Ada_Widget : access Widget'Class :=
Widget_Convert.To_Pointer (U);
begin
Ada_Widget.Callback.all (Ada_Widget.all);
end Callback_Hook;
procedure Draw_Hook
(U : in System.Address)
is
Ada_Widget : access Widget'Class :=
Widget_Convert.To_Pointer (U);
begin
Ada_Widget.Draw;
end Draw_Hook;
function Handle_Hook
(U : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int
is
Ada_Widget : access Widget'Class :=
Widget_Convert.To_Pointer (U);
begin
return Event_Outcome'Pos (Ada_Widget.Handle (Event_Kind'Val (E)));
end Handle_Hook;
procedure Finalize
(This : in out Widget) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Widget'Class
then
free_fl_widget (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String := "")
return Widget is
begin
return This : Widget do
This.Void_Ptr := new_fl_widget
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
widget_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
widget_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text));
end return;
end Create;
end Forge;
procedure Activate
(This : in out Widget) is
begin
fl_widget_activate (This.Void_Ptr);
end Activate;
procedure Deactivate
(This : in out Widget) is
begin
fl_widget_deactivate (This.Void_Ptr);
end Deactivate;
function Is_Active
(This : in Widget)
return Boolean is
begin
return fl_widget_active (This.Void_Ptr) /= 0;
end Is_Active;
function Is_Tree_Active
(This : in Widget)
return Boolean is
begin
return fl_widget_active_r (This.Void_Ptr) /= 0;
end Is_Tree_Active;
procedure Set_Active
(This : in out Widget;
To : in Boolean) is
begin
if To then
fl_widget_set_active (This.Void_Ptr);
else
fl_widget_clear_active (This.Void_Ptr);
end if;
end Set_Active;
function Has_Changed
(This : in Widget)
return Boolean is
begin
return fl_widget_changed (This.Void_Ptr) /= 0;
end Has_Changed;
procedure Set_Changed
(This : in out Widget;
To : in Boolean) is
begin
if To then
fl_widget_set_changed (This.Void_Ptr);
else
fl_widget_clear_changed (This.Void_Ptr);
end if;
end Set_Changed;
function Is_Output_Only
(This : in Widget)
return Boolean is
begin
return fl_widget_output (This.Void_Ptr) /= 0;
end Is_Output_Only;
procedure Set_Output_Only
(This : in out Widget;
To : in Boolean) is
begin
if To then
fl_widget_set_output (This.Void_Ptr);
else
fl_widget_clear_output (This.Void_Ptr);
end if;
end Set_Output_Only;
function Is_Visible
(This : in Widget)
return Boolean is
begin
return fl_widget_visible (This.Void_Ptr) /= 0;
end Is_Visible;
function Is_Tree_Visible
(This : in Widget)
return Boolean is
begin
return fl_widget_visible_r (This.Void_Ptr) /= 0;
end Is_Tree_Visible;
procedure Set_Visible
(This : in out Widget;
To : in Boolean) is
begin
if To then
fl_widget_set_visible (This.Void_Ptr);
else
fl_widget_clear_visible (This.Void_Ptr);
end if;
end Set_Visible;
function Has_Visible_Focus
(This : in Widget)
return Boolean is
begin
return fl_widget_get_visible_focus (This.Void_Ptr) /= 0;
end Has_Visible_Focus;
procedure Set_Visible_Focus
(This : in out Widget;
To : in Boolean) is
begin
fl_widget_set_visible_focus (This.Void_Ptr, Boolean'Pos (To));
end Set_Visible_Focus;
function Take_Focus
(This : in out Widget)
return Boolean is
begin
return fl_widget_take_focus (This.Void_Ptr) /= 0;
end Take_Focus;
function Takes_Events
(This : in Widget)
return Boolean is
begin
return fl_widget_takesevents (This.Void_Ptr) /= 0;
end Takes_Events;
function Get_Background_Color
(This : in Widget)
return Color is
begin
return Color (fl_widget_get_color (This.Void_Ptr));
end Get_Background_Color;
procedure Set_Background_Color
(This : in out Widget;
To : in Color) is
begin
fl_widget_set_color (This.Void_Ptr, Interfaces.C.unsigned (To));
end Set_Background_Color;
function Get_Selection_Color
(This : in Widget)
return Color is
begin
return Color (fl_widget_get_selection_color (This.Void_Ptr));
end Get_Selection_Color;
procedure Set_Selection_Color
(This : in out Widget;
To : in Color) is
begin
fl_widget_set_selection_color (This.Void_Ptr, Interfaces.C.unsigned (To));
end Set_Selection_Color;
function Parent
(This : in Widget)
return access FLTK.Widgets.Groups.Group'Class
is
Parent_Ptr : System.Address;
Actual_Parent : access FLTK.Widgets.Groups.Group'Class;
begin
Parent_Ptr := fl_widget_get_parent (This.Void_Ptr);
if Parent_Ptr /= System.Null_Address then
Actual_Parent := Group_Convert.To_Pointer (fl_widget_get_user_data (Parent_Ptr));
end if;
return Actual_Parent;
end Parent;
function Contains
(This : in Widget;
Item : in Widget'Class)
return Boolean is
begin
return fl_widget_contains (This.Void_Ptr, Item.Void_Ptr) /= 0;
end Contains;
function Inside
(This : in Widget;
Parent : in Widget'Class)
return Boolean is
begin
return fl_widget_inside (This.Void_Ptr, Parent.Void_Ptr) /= 0;
end Inside;
function Nearest_Window
(This : in Widget)
return access FLTK.Widgets.Groups.Windows.Window'Class
is
Window_Ptr : System.Address;
Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class;
begin
Window_Ptr := fl_widget_window (This.Void_Ptr);
if Window_Ptr /= System.Null_Address then
Actual_Window := Window_Convert.To_Pointer (fl_widget_get_user_data (Window_Ptr));
end if;
return Actual_Window;
end Nearest_Window;
function Top_Window
(This : in Widget)
return access FLTK.Widgets.Groups.Windows.Window'Class
is
Window_Ptr : System.Address;
Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class;
begin
Window_Ptr := fl_widget_top_window (This.Void_Ptr);
if Window_Ptr /= System.Null_Address then
Actual_Window := Window_Convert.To_Pointer (fl_widget_get_user_data (Window_Ptr));
end if;
return Actual_Window;
end Top_Window;
function Top_Window_Offset
(This : in Widget;
Offset_X, Offset_Y : out Integer)
return access FLTK.Widgets.Groups.Windows.Window'Class
is
Window_Ptr : System.Address;
Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class;
begin
Window_Ptr := fl_widget_top_window_offset
(This.Void_Ptr,
Interfaces.C.int (Offset_X),
Interfaces.C.int (Offset_Y));
if Window_Ptr /= System.Null_Address then
Actual_Window := Window_Convert.To_Pointer (fl_widget_get_user_data (Window_Ptr));
end if;
return Actual_Window;
end Top_Window_Offset;
function Get_Alignment
(This : in Widget)
return Alignment is
begin
return Alignment (fl_widget_get_align (This.Void_Ptr));
end Get_Alignment;
procedure Set_Alignment
(This : in out Widget;
New_Align : in Alignment) is
begin
fl_widget_set_align (This.Void_Ptr, Interfaces.C.unsigned (New_Align));
end Set_Alignment;
function Get_Box
(This : in Widget)
return Box_Kind is
begin
return Box_Kind'Val (fl_widget_get_box (This.Void_Ptr));
end Get_Box;
procedure Set_Box
(This : in out Widget;
Box : in Box_Kind) is
begin
fl_widget_set_box (This.Void_Ptr, Box_Kind'Pos (Box));
end Set_Box;
function Get_Tooltip
(This : in Widget)
return String
is
Ptr : Interfaces.C.Strings.chars_ptr := fl_widget_tooltip (This.Void_Ptr);
begin
if Ptr = Interfaces.C.Strings.Null_Ptr then
return "";
else
-- no need for dealloc
return Interfaces.C.Strings.Value (Ptr);
end if;
end Get_Tooltip;
procedure Set_Tooltip
(This : in out Widget;
Text : in String) is
begin
fl_widget_copy_tooltip (This.Void_Ptr, Interfaces.C.To_C (Text));
end Set_Tooltip;
function Get_Label
(This : in Widget)
return String
is
Ptr : Interfaces.C.Strings.chars_ptr := fl_widget_get_label (This.Void_Ptr);
begin
if Ptr = Interfaces.C.Strings.Null_Ptr then
return "";
else
return Interfaces.C.Strings.Value (Ptr);
end if;
end Get_Label;
procedure Set_Label
(This : in out Widget;
Text : in String) is
begin
fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text));
end Set_Label;
function Get_Label_Color
(This : in Widget)
return Color is
begin
return Color (fl_widget_get_labelcolor (This.Void_Ptr));
end Get_Label_Color;
procedure Set_Label_Color
(This : in out Widget;
Value : in Color) is
begin
fl_widget_set_labelcolor (This.Void_Ptr, Interfaces.C.unsigned (Value));
end Set_Label_Color;
function Get_Label_Font
(This : in Widget)
return Font_Kind is
begin
return Font_Kind'Val (fl_widget_get_labelfont (This.Void_Ptr));
end Get_Label_Font;
procedure Set_Label_Font
(This : in out Widget;
Font : in Font_Kind) is
begin
fl_widget_set_labelfont (This.Void_Ptr, Font_Kind'Pos (Font));
end Set_Label_Font;
function Get_Label_Size
(This : in Widget)
return Font_Size is
begin
return Font_Size (fl_widget_get_labelsize (This.Void_Ptr));
end Get_Label_Size;
procedure Set_Label_Size
(This : in out Widget;
Size : in Font_Size) is
begin
fl_widget_set_labelsize (This.Void_Ptr, Interfaces.C.int (Size));
end Set_Label_Size;
function Get_Label_Type
(This : in Widget)
return Label_Kind is
begin
return Label_Kind'Val (fl_widget_get_labeltype (This.Void_Ptr));
end Get_Label_Type;
procedure Set_Label_Type
(This : in out Widget;
Label : in Label_Kind) is
begin
fl_widget_set_labeltype (This.Void_Ptr, Label_Kind'Pos (Label));
end Set_Label_Type;
procedure Measure_Label
(This : in Widget;
W, H : out Integer) is
begin
fl_widget_measure_label
(This.Void_Ptr,
Interfaces.C.int (W),
Interfaces.C.int (H));
end Measure_Label;
function Get_Callback
(This : in Widget)
return Widget_Callback is
begin
return This.Callback;
end Get_Callback;
procedure Set_Callback
(This : in out Widget;
Func : in Widget_Callback) is
begin
if Func /= null then
This.Callback := Func;
fl_widget_set_callback (This.Void_Ptr, Callback_Hook'Address);
end if;
end Set_Callback;
procedure Do_Callback
(This : in out Widget) is
begin
if This.Callback /= null then
This.Callback.all (This);
end if;
end Do_Callback;
function Get_When
(This : in Widget)
return Callback_Flag is
begin
return Callback_Flag (fl_widget_get_when (This.Void_Ptr));
end Get_When;
procedure Set_When
(This : in out Widget;
To : in Callback_Flag) is
begin
fl_widget_set_when (This.Void_Ptr, Interfaces.C.unsigned (To));
end Set_When;
function Get_X
(This : in Widget)
return Integer is
begin
return Integer (fl_widget_get_x (This.Void_Ptr));
end Get_X;
function Get_Y
(This : in Widget)
return Integer is
begin
return Integer (fl_widget_get_y (This.Void_Ptr));
end Get_Y;
function Get_W
(This : in Widget)
return Integer is
begin
return Integer (fl_widget_get_w (This.Void_Ptr));
end Get_W;
function Get_H
(This : in Widget)
return Integer is
begin
return Integer (fl_widget_get_h (This.Void_Ptr));
end Get_H;
procedure Resize
(This : in out Widget;
W, H : in Integer) is
begin
fl_widget_size
(This.Void_Ptr,
Interfaces.C.int (W),
Interfaces.C.int (H));
end Resize;
procedure Reposition
(This : in out Widget;
X, Y : in Integer) is
begin
fl_widget_position
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y));
end Reposition;
function Get_Image
(This : in Widget)
return access FLTK.Images.Image'Class is
begin
return This.Current_Image;
end Get_Image;
procedure Set_Image
(This : in out Widget;
Pic : in out FLTK.Images.Image'Class) is
begin
This.Current_Image := Pic'Unchecked_Access;
fl_widget_set_image
(This.Void_Ptr,
Wrapper (Pic).Void_Ptr);
end Set_Image;
function Get_Inactive_Image
(This : in Widget)
return access FLTK.Images.Image'Class is
begin
return This.Inactive_Image;
end Get_Inactive_Image;
procedure Set_Inactive_Image
(This : in out Widget;
Pic : in out FLTK.Images.Image'Class) is
begin
This.Inactive_Image := Pic'Unchecked_Access;
fl_widget_set_deimage
(This.Void_Ptr,
Wrapper (Pic).Void_Ptr);
end Set_Inactive_Image;
function Is_Damaged
(This : in Widget)
return Boolean is
begin
return fl_widget_damage (This.Void_Ptr) /= 0;
end Is_Damaged;
procedure Set_Damaged
(This : in out Widget;
To : in Boolean) is
begin
fl_widget_set_damage (This.Void_Ptr, Boolean'Pos (To));
end Set_Damaged;
procedure Set_Damaged
(This : in out Widget;
To : in Boolean;
X, Y, W, H : in Integer) is
begin
fl_widget_set_damage2
(This.Void_Ptr,
Boolean'Pos (To),
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H));
end Set_Damaged;
procedure Draw_Label
(This : in Widget;
X, Y, W, H : in Integer;
Align : in Alignment) is
begin
fl_widget_draw_label
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.unsigned (Align));
end Draw_Label;
procedure Redraw
(This : in out Widget) is
begin
fl_widget_redraw (This.Void_Ptr);
end Redraw;
procedure Redraw_Label
(This : in out Widget) is
begin
fl_widget_redraw_label (This.Void_Ptr);
end Redraw_Label;
function Handle
(This : in out Widget;
Event : in Event_Kind)
return Event_Outcome is
begin
return Not_Handled;
end Handle;
end FLTK.Widgets;
|