summaryrefslogtreecommitdiff
path: root/src/fltk_binding/fltk-widget-group-text_display.adb
blob: e558d9a29e9be85fe9061ae84343bae6f614a217 (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


with Interfaces.C;
with System;
use type System.Address;


package body FLTK.Widget.Group.Text_Display is


    function new_fl_text_display
           (X, Y, W, H : in Interfaces.C.int;
            L          : in Interfaces.C.char_array)
        return System.Address;
    pragma Import (C, new_fl_text_display, "new_fl_text_display");

    procedure free_fl_text_display
           (TD : in System.Address);
    pragma Import (C, free_fl_text_display, "free_fl_text_display");

    function fl_text_display_get_text_color
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_text_color, "fl_text_display_get_text_color");

    procedure fl_text_display_set_text_color
           (TD : in System.Address;
            C  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_text_color, "fl_text_display_set_text_color");

    function fl_text_display_get_text_font
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_text_font, "fl_text_display_get_text_font");

    procedure fl_text_display_set_text_font
           (TD : in System.Address;
            F  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_text_font, "fl_text_display_set_text_font");

    function fl_text_display_get_text_size
           (TD : in System.Address)
        return Interfaces.C.int;
    pragma Import (C, fl_text_display_get_text_size, "fl_text_display_get_text_size");

    procedure fl_text_display_set_text_size
           (TD : in System.Address;
            S  : in Interfaces.C.int);
    pragma Import (C, fl_text_display_set_text_size, "fl_text_display_set_text_size");




    procedure fl_group_end
           (G : in System.Address);
    pragma Import (C, fl_group_end, "fl_group_end");




    procedure Finalize (This : in out Text_Display_Type) is
    begin
        if (This.Void_Ptr /= System.Null_Address) then
            free_fl_text_display (This.Void_Ptr);
        end if;
    end Finalize;




    function Create
           (X, Y, W, H : in Integer;
            Label      : in String)
        return Text_Display_Type is

        VP : System.Address;

    begin
        VP := new_fl_text_display
                   (Interfaces.C.int (X),
                    Interfaces.C.int (Y),
                    Interfaces.C.int (W),
                    Interfaces.C.int (H),
                    Interfaces.C.To_C (Label));
        fl_group_end (VP);
        return (Ada.Finalization.Limited_Controlled with Void_Ptr => VP);
    end Create;




    function Get_Text_Color
           (TD : in Text_Display_Type)
        return Color is
    begin
        return Color (fl_text_display_get_text_color (TD.Void_Ptr));
    end Get_Text_Color;




    procedure Set_Text_Color
           (TD : in Text_Display_Type;
            C : in Color) is
    begin
        fl_text_display_set_text_color (TD.Void_Ptr, Interfaces.C.int (C));
    end Set_Text_Color;




    function Get_Text_Font
           (TD : in Text_Display_Type)
        return Font_Kind is
    begin
        return Font_Kind'Val (fl_text_display_get_text_font (TD.Void_Ptr));
    end Get_Text_Font;




    procedure Set_Text_Font
           (TD : in Text_Display_Type;
            F : in Font_Kind) is
    begin
        fl_text_display_set_text_font (TD.Void_Ptr, Font_Kind'Pos (F));
    end Set_Text_Font;




    function Get_Text_Size
           (TD : in Text_Display_Type)
        return Font_Size is
    begin
        return Font_Size (fl_text_display_get_text_size (TD.Void_Ptr));
    end Get_Text_Size;




    procedure Set_Text_Size
           (TD : in Text_Display_Type;
            S : in Font_Size) is
    begin
        fl_text_display_set_text_size (TD.Void_Ptr, Interfaces.C.int (S));
    end Set_Text_Size;


end FLTK.Widget.Group.Text_Display;