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
|
-- Programmed by Jedidiah Barber
-- Released into the public domain
-- Button/callback test program functionality reproduced in Ada
with
Ada.Command_Line,
FLTK.Asks,
FLTK.Widgets.Buttons,
FLTK.Widgets.Groups.Windows;
function Button
return Integer
is
package ACom renames Ada.Command_Line;
package Ask renames FLTK.Asks;
package Wdg renames FLTK.Widgets;
package Btn renames FLTK.Widgets.Buttons;
package Win renames FLTK.Widgets.Groups.Windows;
procedure Beep_Callback
(This : in out Wdg.Widget'Class) is
begin
Ask.Beep;
end Beep_Callback;
The_Window : Win.Window := Win.Forge.Create (320, 65);
procedure Exit_Callback
(This : in out Wdg.Widget'Class) is
begin
ACom.Set_Exit_Status (ACom.Success);
The_Window.Hide;
end Exit_Callback;
Button_One : Btn.Button := Btn.Forge.Create (The_Window, 20, 20, 80, 25, "&Beep");
Button_Two : Btn.Button := Btn.Forge.Create (The_Window, 120, 20, 80, 25, "&No Op");
Button_Three : Btn.Button := Btn.Forge.Create (The_Window, 220, 20, 80, 25, "E&xit");
begin
Button_One.Set_Callback (Beep_Callback'Unrestricted_Access);
Button_Three.Set_Callback (Exit_Callback'Unrestricted_Access);
The_Window.Show_With_Args;
return FLTK.Run;
end Button;
|