summaryrefslogtreecommitdiff
path: root/src/fltk-tooltips.adb
blob: 720e417a794922ad4321db09c06b0b09ede32e2e (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
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


with

    Interfaces.C,
    System.Address_To_Access_Conversions;

use type

    Interfaces.C.int,
    System.Address;


package body FLTK.Tooltips is


    function fl_tooltip_get_current
        return System.Address;
    pragma Import (C, fl_tooltip_get_current, "fl_tooltip_get_current");
    pragma Inline (fl_tooltip_get_current);

    procedure fl_tooltip_set_current
           (I : in System.Address);
    pragma Import (C, fl_tooltip_set_current, "fl_tooltip_set_current");
    pragma Inline (fl_tooltip_set_current);

    function fl_tooltip_enabled
        return Interfaces.C.int;
    pragma Import (C, fl_tooltip_enabled, "fl_tooltip_enabled");
    pragma Inline (fl_tooltip_enabled);

    procedure fl_tooltip_enable
           (V : in Interfaces.C.int);
    pragma Import (C, fl_tooltip_enable, "fl_tooltip_enable");
    pragma Inline (fl_tooltip_enable);

    procedure fl_tooltip_enter_area
           (I          : in System.Address;
            X, Y, W, H : in Interfaces.C.int;
            T          : in Interfaces.C.char_array);
    pragma Import (C, fl_tooltip_enter_area, "fl_tooltip_enter_area");
    pragma Inline (fl_tooltip_enter_area);




    function fl_tooltip_get_delay
        return Interfaces.C.C_float;
    pragma Import (C, fl_tooltip_get_delay, "fl_tooltip_get_delay");
    pragma Inline (fl_tooltip_get_delay);

    procedure fl_tooltip_set_delay
           (V : in Interfaces.C.C_float);
    pragma Import (C, fl_tooltip_set_delay, "fl_tooltip_set_delay");
    pragma Inline (fl_tooltip_set_delay);

    function fl_tooltip_get_hoverdelay
        return Interfaces.C.C_float;
    pragma Import (C, fl_tooltip_get_hoverdelay, "fl_tooltip_get_hoverdelay");
    pragma Inline (fl_tooltip_get_hoverdelay);

    procedure fl_tooltip_set_hoverdelay
           (V : in Interfaces.C.C_float);
    pragma Import (C, fl_tooltip_set_hoverdelay, "fl_tooltip_set_hoverdelay");
    pragma Inline (fl_tooltip_set_hoverdelay);




    function fl_tooltip_get_color
        return Interfaces.C.unsigned;
    pragma Import (C, fl_tooltip_get_color, "fl_tooltip_get_color");
    pragma Inline (fl_tooltip_get_color);

    procedure fl_tooltip_set_color
           (V : in Interfaces.C.unsigned);
    pragma Import (C, fl_tooltip_set_color, "fl_tooltip_set_color");
    pragma Inline (fl_tooltip_set_color);

    function fl_tooltip_get_margin_height
        return Interfaces.C.int;
    pragma Import (C, fl_tooltip_get_margin_height, "fl_tooltip_get_margin_height");
    pragma Inline (fl_tooltip_get_margin_height);

    --  procedure fl_tooltip_set_margin_height
    --         (V : in Interfaces.C.int);
    --  pragma Import (C, fl_tooltip_set_margin_height, "fl_tooltip_set_margin_height");
    --  pragma Inline (fl_tooltip_set_margin_height);

    function fl_tooltip_get_margin_width
        return Interfaces.C.int;
    pragma Import (C, fl_tooltip_get_margin_width, "fl_tooltip_get_margin_width");
    pragma Inline (fl_tooltip_get_margin_width);

    --  procedure fl_tooltip_set_margin_width
    --         (V : in Interfaces.C.int);
    --  pragma Import (C, fl_tooltip_set_margin_width, "fl_tooltip_set_margin_width");
    --  pragma Inline (fl_tooltip_set_margin_width);

    function fl_tooltip_get_wrap_width
        return Interfaces.C.int;
    pragma Import (C, fl_tooltip_get_wrap_width, "fl_tooltip_get_wrap_width");
    pragma Inline (fl_tooltip_get_wrap_width);

    --  procedure fl_tooltip_set_wrap_width
    --         (V : in Interfaces.C.int);
    --  pragma Import (C, fl_tooltip_set_wrap_width, "fl_tooltip_set_wrap_width");
    --  pragma Inline (fl_tooltip_set_wrap_width);




    function fl_tooltip_get_textcolor
        return Interfaces.C.unsigned;
    pragma Import (C, fl_tooltip_get_textcolor, "fl_tooltip_get_textcolor");
    pragma Inline (fl_tooltip_get_textcolor);

    procedure fl_tooltip_set_textcolor
           (V : in Interfaces.C.unsigned);
    pragma Import (C, fl_tooltip_set_textcolor, "fl_tooltip_set_textcolor");
    pragma Inline (fl_tooltip_set_textcolor);

    function fl_tooltip_get_font
        return Interfaces.C.int;
    pragma Import (C, fl_tooltip_get_font, "fl_tooltip_get_font");
    pragma Inline (fl_tooltip_get_font);

    procedure fl_tooltip_set_font
           (V : in Interfaces.C.int);
    pragma Import (C, fl_tooltip_set_font, "fl_tooltip_set_font");
    pragma Inline (fl_tooltip_set_font);

    function fl_tooltip_get_size
        return Interfaces.C.int;
    pragma Import (C, fl_tooltip_get_size, "fl_tooltip_get_size");
    pragma Inline (fl_tooltip_get_size);

    procedure fl_tooltip_set_size
           (V : in Interfaces.C.int);
    pragma Import (C, fl_tooltip_set_size, "fl_tooltip_set_size");
    pragma Inline (fl_tooltip_set_size);




    function fl_widget_get_user_data
           (W : in System.Address)
        return System.Address;
    pragma Import (C, fl_widget_get_user_data, "fl_widget_get_user_data");
    pragma Inline (fl_widget_get_user_data);

    package Widget_Convert is new
        System.Address_To_Access_Conversions (FLTK.Widgets.Widget'Class);




    function Get_Target
        return access FLTK.Widgets.Widget'Class
    is
        Widget_Ptr : System.Address := fl_tooltip_get_current;
    begin
        if Widget_Ptr /= System.Null_Address then
            return Widget_Convert.To_Pointer (fl_widget_get_user_data (Widget_Ptr));
        else
            return null;
        end if;
    end Get_Target;


    procedure Set_Target
           (To : in FLTK.Widgets.Widget'Class) is
    begin
        fl_tooltip_set_current (Wrapper (To).Void_Ptr);
    end Set_Target;


    function Is_Enabled
        return Boolean is
    begin
        return fl_tooltip_enabled /= 0;
    end Is_Enabled;


    procedure Set_Enabled
           (To : in Boolean) is
    begin
        fl_tooltip_enable (Boolean'Pos (To));
    end Set_Enabled;


    procedure Enter_Area
           (Item       : in FLTK.Widgets.Widget'Class;
            X, Y, W, H : in Integer;
            Tip        : in String) is
    begin
        fl_tooltip_enter_area
           (Wrapper (Item).Void_Ptr,
            Interfaces.C.int (X),
            Interfaces.C.int (Y),
            Interfaces.C.int (W),
            Interfaces.C.int (H),
            Interfaces.C.To_C (Tip));
    end Enter_Area;




    function Get_Delay
        return Float is
    begin
        return Float (fl_tooltip_get_delay);
    end Get_Delay;


    procedure Set_Delay
           (To : in Float) is
    begin
        fl_tooltip_set_delay (Interfaces.C.C_float (To));
    end Set_Delay;


    function Get_Hover_Delay
        return Float is
    begin
        return Float (fl_tooltip_get_hoverdelay);
    end Get_Hover_Delay;


    procedure Set_Hover_Delay
           (To : in Float) is
    begin
        fl_tooltip_set_hoverdelay (Interfaces.C.C_float (To));
    end Set_Hover_Delay;




    function Get_Background_Color
        return Color is
    begin
        return Color (fl_tooltip_get_color);
    end Get_Background_Color;


    procedure Set_Background_Color
           (To : in Color) is
    begin
        fl_tooltip_set_color (Interfaces.C.unsigned (To));
    end Set_Background_Color;


    function Get_Margin_Height
        return Natural is
    begin
        return Natural (fl_tooltip_get_margin_height);
    end Get_Margin_Height;


    --  procedure Set_Margin_Height
    --         (To : in Natural) is
    --  begin
    --      fl_tooltip_set_margin_height (Interfaces.C.int (To));
    --  end Set_Margin_Height;


    function Get_Margin_Width
        return Natural is
    begin
        return Natural (fl_tooltip_get_margin_width);
    end Get_Margin_Width;


    --  procedure Set_Margin_Width
    --         (To : in Natural) is
    --  begin
    --      fl_tooltip_set_margin_width (Interfaces.C.int (To));
    --  end Set_Margin_Width;


    function Get_Wrap_Width
        return Natural is
    begin
        return Natural (fl_tooltip_get_wrap_width);
    end Get_Wrap_Width;


    --  procedure Set_Wrap_Width
    --         (To : in Natural) is
    --  begin
    --      fl_tooltip_set_wrap_width (Interfaces.C.int (To));
    --  end Set_Wrap_Width;




    function Get_Text_Color
        return Color is
    begin
        return Color (fl_tooltip_get_textcolor);
    end Get_Text_Color;


    procedure Set_Text_Color
           (To : in Color) is
    begin
        fl_tooltip_set_textcolor (Interfaces.C.unsigned (To));
    end Set_Text_Color;


    function Get_Text_Font
        return Font_Kind is
    begin
        return Font_Kind'Val (fl_tooltip_get_font);
    end Get_Text_Font;


    procedure Set_Text_Font
           (To : in Font_Kind) is
    begin
        fl_tooltip_set_font (Font_Kind'Pos (To));
    end Set_Text_Font;


    function Get_Text_Size
        return Font_Size is
    begin
        return Font_Size (fl_tooltip_get_size);
    end Get_Text_Size;


    procedure Set_Text_Size
           (To : in Font_Size) is
    begin
        fl_tooltip_set_size (Interfaces.C.int (To));
    end Set_Text_Size;


end FLTK.Tooltips;