diff options
author | Jed Barber <jjbarber@y7mail.com> | 2016-05-27 04:03:00 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2016-05-27 04:03:00 +1000 |
commit | b1a8b46960380dc3a771935a09c4e4a23e811c4a (patch) | |
tree | 25d2693835dc3410165e19670b16a0c50a51ef4b /src/fltk_binding/fltk-text_buffers.adb | |
parent | 2b4468a62a55d9f8520582f9aa2e420ab89ed7bd (diff) |
Text buffers, access types and line lengths
Diffstat (limited to 'src/fltk_binding/fltk-text_buffers.adb')
-rw-r--r-- | src/fltk_binding/fltk-text_buffers.adb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/fltk_binding/fltk-text_buffers.adb b/src/fltk_binding/fltk-text_buffers.adb new file mode 100644 index 0000000..12a6a73 --- /dev/null +++ b/src/fltk_binding/fltk-text_buffers.adb @@ -0,0 +1,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; + |