summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-inputs.ads
blob: c22efb39569d053e0b17e0de91300ca9127447b0 (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
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


private with

    Interfaces.C.Strings,
    System;


package FLTK.Widgets.Inputs is


    type Input is new Widget with private;

    type Input_Reference (Data : not null access Input'Class) is limited null record
        with Implicit_Dereference => Data;

    type Input_Kind is
       (Normal_Kind, Float_Kind, Integer_Kind, Multiline_Kind,
        Secret_Kind, Readonly_Kind, Wrap_Kind);




    package Forge is

        function Create
               (X, Y, W, H : in Integer;
                Text       : in String)
            return Input;

    end Forge;




    procedure Copy
           (This : in out Input);

    procedure Cut
           (This : in out Input);

    procedure Cut
           (This      : in out Input;
            Num_Bytes : in     Integer);

    procedure Cut
           (This          : in out Input;
            Start, Finish : in     Integer);

    procedure Copy_Cuts
           (This : in out Input);

    procedure Undo
           (This : in out Input);




    function Has_Changed
           (This : in Input)
        return Boolean;

    procedure Clear_Changed
           (This : in out Input);

    function Is_Readonly
           (This : in Input)
        return Boolean;

    procedure Set_Readonly
           (This : in out Input;
            To   : in     Boolean);

    function Is_Tab_Nav
           (This : in Input)
        return Boolean;

    procedure Set_Tab_Nav
           (This : in out Input;
            To   : in     Boolean);

    function Is_Wrap
           (This : in Input)
        return Boolean;

    procedure Set_Wrap
           (This : in out Input;
            To   : in     Boolean);




    function Get_Input_Type
           (This : in Input)
        return Input_Kind;

    function Get_Shortcut_Key
           (This : in Input)
        return Shortcut_Key;

    procedure Set_Shortcut_Key
           (This : in out Input;
            To   : in     Shortcut_Key);

    function Get_Mark
           (This : in Input)
        return Natural;

    procedure Set_Mark
           (This : in out Input;
            To   : in     Natural);

    function Get_Position
           (This : in Input)
        return Natural;

    procedure Set_Position
           (This : in out Input;
            To   : in     Natural);




    function Index
           (This  : in Input;
            Place : in Integer)
        return Character;

    procedure Insert
           (This : in out Input;
            Str  : in     String);

    procedure Replace
           (This     : in out Input;
            From, To : in     Natural;
            New_Text : in     String);

    function Get_Value
           (This : in Input)
        return String;

    procedure Set_Value
           (This : in out Input;
            To   : in     String);




    function Get_Maximum_Size
           (This : in Input)
        return Natural;

    procedure Set_Maximum_Size
           (This : in out Input;
            To   : in     Natural);

    function Size
           (This : in Input)
        return Natural;




    function Get_Cursor_Color
           (This : in Input)
        return Color;

    procedure Set_Cursor_Color
           (This : in out Input;
            To   : in     Color);

    function Get_Text_Color
           (This : in Input)
        return Color;

    procedure Set_Text_Color
           (This : in out Input;
            To   : in     Color);

    function Get_Text_Font
           (This : in Input)
        return Font_Kind;

    procedure Set_Text_Font
           (This : in out Input;
            To   : in     Font_Kind);

    function Get_Text_Size
           (This : in Input)
        return Font_Size;

    procedure Set_Text_Size
           (This : in out Input;
            To   : in     Font_Size);




    procedure Resize
           (This : in out Input;
            W, H : in     Integer);




    procedure Draw
           (This : in out Input);

    function Handle
           (This  : in out Input;
            Event : in     Event_Kind)
        return Event_Outcome;




    package Extra is

        procedure Set_Input_Type
               (This : in out Input;
                To   : in     Input_Kind);

    end Extra;


private


    type Input is new Widget with record
        Was_Changed : Boolean := False;
    end record;

    overriding procedure Finalize
           (This : in out Input);




    pragma Inline (Copy);
    pragma Inline (Cut);
    pragma Inline (Copy_Cuts);
    pragma Inline (Undo);


    pragma Inline (Has_Changed);
    pragma Inline (Clear_Changed);
    pragma Inline (Is_Readonly);
    pragma Inline (Set_Readonly);
    pragma Inline (Is_Tab_Nav);
    pragma Inline (Set_Tab_Nav);
    pragma Inline (Is_Wrap);
    pragma Inline (Set_Wrap);


    pragma Inline (Get_Input_Type);
    pragma Inline (Get_Shortcut_Key);
    pragma Inline (Set_Shortcut_Key);
    pragma Inline (Get_Mark);
    pragma Inline (Set_Mark);
    pragma Inline (Get_Position);
    pragma Inline (Set_Position);


    pragma Inline (Index);
    pragma Inline (Insert);
    pragma Inline (Replace);
    pragma Inline (Get_Value);
    pragma Inline (Set_Value);


    pragma Inline (Get_Maximum_Size);
    pragma Inline (Set_Maximum_Size);
    pragma Inline (Size);


    pragma Inline (Get_Cursor_Color);
    pragma Inline (Set_Cursor_Color);
    pragma Inline (Get_Text_Color);
    pragma Inline (Set_Text_Color);
    pragma Inline (Get_Text_Font);
    pragma Inline (Set_Text_Font);
    pragma Inline (Get_Text_Size);
    pragma Inline (Set_Text_Size);


    pragma Inline (Resize);


    pragma Inline (Draw);
    pragma Inline (Handle);




    Input_Kind_Values : array (Input_Kind) of Interfaces.C.int :=
       (Normal_Kind    => 0,
        Float_Kind     => 1,
        Integer_Kind   => 2,
        Multiline_Kind => 4,
        Secret_Kind    => 5,
        Readonly_Kind  => 8,
        Wrap_Kind      => 16);




    function fl_input_get_value
           (F : in System.Address)
        return Interfaces.C.Strings.chars_ptr;
    pragma Import (C, fl_input_get_value, "fl_input_get_value");
    pragma Inline (fl_input_get_value);


end FLTK.Widgets.Inputs;