summaryrefslogtreecommitdiff
path: root/src/adapad.adb
blob: 2f4c483e8b828f8ca2815cbd8f3d5332ea7ea267 (plain)
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


with FLTK;
with Editors;
use Editors;
with FLTK.Text_Buffers;
use FLTK.Text_Buffers;
with FLTK.Widgets;
use FLTK.Widgets;
with FLTK.Widgets.Menus;
use FLTK.Widgets.Menus;


with Ada.Text_IO;


function AdaPad return Integer is


    Pad : aliased Editor_Window := Create (0, 0, 640, 400, "AdaPad");
    Buffer : Text_Buffer := Create;


    type Editor_Callback is abstract new Widget_Callback with
        record
            Editor : access Editor_Window;
        end record;


    type Open_Callback is new Editor_Callback with null record;
    Open_CB : aliased Open_Callback := (Editor => Pad'Access);


    overriding procedure Call
           (This : in     Open_Callback;
            Item : in out Widget'Class) is
    begin
        Ada.Text_IO.Put_Line ("Open callback executed.");
    end Call;


begin


    declare
        Bar : Menu_Cursor := Pad.Get_Menu;
    begin
        Bar.Add ("File/Open", Open_CB'Access);
    end;


    Pad.Set_Buffer (Buffer);
    Pad.Show;
    return FLTK.Run;


end AdaPad;