summaryrefslogtreecommitdiff
path: root/src/fltk_binding/fltk-widgets-groups-text_displays.adb
blob: e2d62d8f5822855866ee1c04a8ac922df60a38a7 (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


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


package body FLTK.Widgets.Groups.Text_Displays is


    function new_fl_text_display
           (X, Y, W, H : in Interfaces.C.int;
            Label      : 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_buffer
           (TD : in System.Address)
        return System.Address;
    pragma Import (C, fl_text_display_get_buffer, "fl_text_display_get_buffer");

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

    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");

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

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

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




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




    function Create
           (X, Y, W, H : in Integer;
            Text       : in String)
        return Text_Display is
    begin
        return This : Text_Display do
            This.Void_Ptr := new_fl_text_display
                   (Interfaces.C.int (X),
                    Interfaces.C.int (Y),
                    Interfaces.C.int (W),
                    Interfaces.C.int (H),
                    Interfaces.C.To_C (Text));
            fl_group_end (This.Void_Ptr);
            fl_widget_set_user_data
                   (This.Void_Ptr,
                    Widget_Convert.To_Address (This'Unchecked_Access));
        end return;
    end Create;




    function Get_Buffer
           (This : in Text_Display)
        return FLTK.Text_Buffers.Text_Buffer_Cursor is
    begin
        return Ref : FLTK.Text_Buffers.Text_Buffer_Cursor (This.Buffer);
    end Get_Buffer;




    procedure Set_Buffer
           (This : in out Text_Display;
            Buff : in out FLTK.Text_Buffers.Text_Buffer) is
    begin
        This.Buffer := Buff'Unchecked_Access;
        fl_text_display_set_buffer (This.Void_Ptr, Wrapper (Buff).Void_Ptr);
    end Set_Buffer;




    function Get_Text_Color
           (This : in Text_Display)
        return Color is
    begin
        return Color (fl_text_display_get_text_color (This.Void_Ptr));
    end Get_Text_Color;




    procedure Set_Text_Color
           (This : in out Text_Display;
            Col  : in     Color) is
    begin
        fl_text_display_set_text_color (This.Void_Ptr, Interfaces.C.int (Col));
    end Set_Text_Color;




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




    procedure Set_Text_Font
           (This : in out Text_Display;
            Font : in     Font_Kind) is
    begin
        fl_text_display_set_text_font (This.Void_Ptr, Font_Kind'Pos (Font));
    end Set_Text_Font;




    function Get_Text_Size
           (This : in Text_Display)
        return Font_Size is
    begin
        return Font_Size (fl_text_display_get_text_size (This.Void_Ptr));
    end Get_Text_Size;




    procedure Set_Text_Size
           (This : in out Text_Display;
            Size : in     Font_Size) is
    begin
        fl_text_display_set_text_size (This.Void_Ptr, Interfaces.C.int (Size));
    end Set_Text_Size;




    function Get_Insert_Position
           (This : in Text_Display)
        return Natural is
    begin
        return Natural (fl_text_display_get_insert_pos (This.Void_Ptr));
    end Get_Insert_Position;




    procedure Set_Insert_Position
           (This : in out Text_Display;
            Pos  : in     Natural) is
    begin
        fl_text_display_set_insert_pos (This.Void_Ptr, Interfaces.C.int (Pos));
    end Set_Insert_Position;




    procedure Show_Insert_Position
           (This : in out Text_Display) is
    begin
        fl_text_display_show_insert_pos (This.Void_Ptr);
    end Show_Insert_Position;


end FLTK.Widgets.Groups.Text_Displays;