summaryrefslogtreecommitdiff
path: root/src/editor_windows.ads
blob: 7e6d42c422cd5a3ceccd26cbfdfe08b15771face (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
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


with FLTK.Widgets.Groups.Windows.Double;
use FLTK.Widgets.Groups.Windows.Double;
with FLTK.Widgets.Menus;
use FLTK.Widgets.Menus;
with FLTK.Text_Buffers;
use FLTK.Text_Buffers;
private with FLTK.Widgets.Groups.Text_Displays.Text_Editors;
private with FLTK.Widgets.Menus.Menu_Bars;
private with FLTK.Widgets.Boxes;
private with FLTK.Widgets;
private with FLTK.Widgets.Inputs;
private with FLTK.Widgets.Buttons;
private with FLTK.Widgets.Buttons.Enter;
private with FLTK.Widgets.Buttons.Light.Check;


package Editor_Windows is


    type Editor_Window is new Double_Window with private;


    Min_Editor_Height : Integer := 60;
    Min_Editor_Width : Integer := 300;


    function Create
           (X, Y, W, H : in Integer;
            Label_Text : in String)
        return Editor_Window;


    function Create
           (W, H : in Integer)
        return Editor_Window;


    function Get_Buffer
           (This : in Editor_Window)
        return Text_Buffer_Cursor;


    procedure Set_Buffer
           (This : in out Editor_Window;
            Buff : in out Text_Buffer);


    function Get_Menu
           (This : in out Editor_Window)
        return Menu_Cursor;


    procedure Undo (This : in out Editor_Window);
    procedure Cut (This : in out Editor_Window);
    procedure Copy (This : in out Editor_Window);
    procedure Paste (This : in out Editor_Window);
    procedure Delete (This : in out Editor_Window);


    function Get_Insert_Position (This : in Editor_Window) return Natural;
    procedure Set_Insert_Position (This : in out Editor_Window; Pos : in Natural);
    procedure Show_Insert_Position (This : in out Editor_Window);




    type About_Window is new Double_Window with private;


    function Create return About_Window;


    function Create
           (X, Y, W, H : in Integer;
            Label_Text : in String)
        return About_Window;


    function Create
           (W, H : in Integer)
        return About_Window;




    type Find_Window is new Double_Window with private;


    type Find_Callback is interface;
    procedure Call
           (This       : in Find_Callback;
            Item       : in String;
            Match_Case : in Boolean) is abstract;


    function Create return Find_Window;


    function Create
           (X, Y, W, H : in Integer;
            Label_Text : in String)
        return Find_Window;


    function Create
           (W, H : in Integer)
        return Find_Window;


    procedure Set_Find_Callback
           (This : in out Find_Window;
            Func : not null access Find_Callback'Class);




    type Replace_Window is new Double_Window with private;


    type Replace_Callback is interface;
    procedure Call
           (This                : in Replace_Callback;
            Item, Replace_With  : in String;
            Match_Case, Rep_All : in Boolean) is abstract;


    function Create return Replace_Window;


    function Create
           (X, Y, W, H : in Integer;
            Label_Text : in String)
        return Replace_Window;


    function Create
           (W, H : in Integer)
        return Replace_Window;


    procedure Set_Replace_Callback
           (This : in out Replace_Window;
            Func : not null access Replace_Callback'Class);


private


    use FLTK.Widgets.Groups.Text_Displays.Text_Editors;
    use FLTK.Widgets.Menus.Menu_Bars;
    use FLTK.Widgets.Boxes;
    use FLTK.Widgets;
    use FLTK.Widgets.Inputs;
    use FLTK.Widgets.Buttons;
    use FLTK.Widgets.Buttons.Enter;
    use FLTK.Widgets.Buttons.Light.Check;


    type Editor_Window is new Double_Window with
        record
            Bar    : aliased Menu_Bar;
            Editor : Text_Editor;
        end record;


    type Hide_Callback is new Widget_Callback with null record;
    overriding procedure Call
           (This : in     Hide_Callback;
            Item : in out Widget'Class);


    type About_Window is new Double_Window with
        record
            Picture : Box;
            Heading : Box;
            Blurb   : Box;
            Author  : Box;
            Dismiss : Enter_Button;
        end record;


    type Find_Marshaller is new Widget_Callback with null record;
    overriding procedure Call
           (This : in     Find_Marshaller;
            Item : in out Widget'Class);


    type Find_Window is new Double_Window with
        record
            Find_What  : Input;
            Match_Case : Check_Button;
            Cancel     : Button;
            Start      : Enter_Button;
            Callback   : access Find_Callback'Class;
        end record;


    type Replace_Marshaller is new Widget_Callback with null record;
    overriding procedure Call
           (This : in     Replace_Marshaller;
            Item : in out Widget'Class);


    type Replace_Window is new Double_Window with
        record
            Find_What, Replace_With : Input;
            Match_Case, Replace_All : Check_Button;
            Cancel                  : Button;
            Start                   : Enter_Button;
            Callback                : access Replace_Callback'Class;
        end record;


end Editor_Windows;