summaryrefslogtreecommitdiff
path: root/src/fltk_binding/fltk-text_buffers.adb
blob: 12a6a7325d2b5045fada64f5c0c1213d776b1bf2 (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


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


package body FLTK.Text_Buffers is


    function new_fl_text_buffer
           (RS, PGS : in Interfaces.C.int)
        return System.Address;
    pragma Import (C, new_fl_text_buffer, "new_fl_text_buffer");

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




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




    function Create
           (Requested_Size     : in Natural := 0;
            Preferred_Gap_Size : in Natural := 1024)
        return Text_Buffer is

        VP : System.Address;

    begin
        VP := new_fl_text_buffer
                   (Interfaces.C.int (Requested_Size),
                    Interfaces.C.int (Preferred_Gap_Size));
        return (Ada.Finalization.Limited_Controlled with Void_Ptr => VP);
    end Create;


end FLTK.Text_Buffers;