diff options
author | Jed Barber <jjbarber@y7mail.com> | 2016-10-04 21:34:08 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2016-10-04 21:34:08 +1100 |
commit | 3b643fb37910c216d921e742ae30471606093ed9 (patch) | |
tree | eecb814e11d0223ca51939f7a1dea85e2882d1ae /src/fltk_binding | |
parent | 1f9e7a15d9414b1a96691111069523a70e107f16 (diff) |
Basic replace functionality added
Diffstat (limited to 'src/fltk_binding')
-rw-r--r-- | src/fltk_binding/c_fl_text_buffer.cpp | 5 | ||||
-rw-r--r-- | src/fltk_binding/c_fl_text_buffer.h | 1 | ||||
-rw-r--r-- | src/fltk_binding/fltk-text_buffers.adb | 20 | ||||
-rw-r--r-- | src/fltk_binding/fltk-text_buffers.ads | 6 |
4 files changed, 32 insertions, 0 deletions
diff --git a/src/fltk_binding/c_fl_text_buffer.cpp b/src/fltk_binding/c_fl_text_buffer.cpp index b0df365..8b0cde1 100644 --- a/src/fltk_binding/c_fl_text_buffer.cpp +++ b/src/fltk_binding/c_fl_text_buffer.cpp @@ -35,6 +35,11 @@ void fl_text_buffer_call_predelete_callbacks(TEXTBUFFER tb) { } +void fl_text_buffer_insert(TEXTBUFFER tb, int p, const char * item) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->insert(p, item); +} + + int fl_text_buffer_length(TEXTBUFFER tb) { return reinterpret_cast<Fl_Text_Buffer*>(tb)->length(); } diff --git a/src/fltk_binding/c_fl_text_buffer.h b/src/fltk_binding/c_fl_text_buffer.h index cd64112..5a1ab08 100644 --- a/src/fltk_binding/c_fl_text_buffer.h +++ b/src/fltk_binding/c_fl_text_buffer.h @@ -15,6 +15,7 @@ extern "C" void fl_text_buffer_add_modify_callback(TEXTBUFFER tb, void * cb, voi extern "C" void fl_text_buffer_add_predelete_callback(TEXTBUFFER tb, void * cb, void * ud); extern "C" void fl_text_buffer_call_modify_callbacks(TEXTBUFFER tb); extern "C" void fl_text_buffer_call_predelete_callbacks(TEXTBUFFER tb); +extern "C" void fl_text_buffer_insert(TEXTBUFFER tb, int p, const char * item); extern "C" int fl_text_buffer_length(TEXTBUFFER tb); extern "C" int fl_text_buffer_loadfile(TEXTBUFFER tb, char * n); extern "C" void fl_text_buffer_remove_selection(TEXTBUFFER tb); diff --git a/src/fltk_binding/fltk-text_buffers.adb b/src/fltk_binding/fltk-text_buffers.adb index 6df96cb..b3b8344 100644 --- a/src/fltk_binding/fltk-text_buffers.adb +++ b/src/fltk_binding/fltk-text_buffers.adb @@ -46,6 +46,12 @@ package body FLTK.Text_Buffers is pragma Import (C, fl_text_buffer_call_predelete_callbacks, "fl_text_buffer_call_predelete_callbacks"); + procedure fl_text_buffer_insert + (TB : in System.Address; + P : in Interfaces.C.int; + I : in Interfaces.C.char_array); + pragma Import (C, fl_text_buffer_insert, "fl_text_buffer_insert"); + function fl_text_buffer_length (TB : in System.Address) return Interfaces.C.int; @@ -237,6 +243,20 @@ package body FLTK.Text_Buffers is + procedure Insert_Text + (This : in out Text_Buffer; + Pos : in Natural; + Item : in String) is + begin + fl_text_buffer_insert + (This.Void_Ptr, + Interfaces.C.int (Pos), + Interfaces.C.To_C (Item)); + end Insert_Text; + + + + function Length (This : in Text_Buffer) return Natural is diff --git a/src/fltk_binding/fltk-text_buffers.ads b/src/fltk_binding/fltk-text_buffers.ads index 0bb881e..a560076 100644 --- a/src/fltk_binding/fltk-text_buffers.ads +++ b/src/fltk_binding/fltk-text_buffers.ads @@ -56,6 +56,12 @@ package FLTK.Text_Buffers is (This : in out Text_Buffer); + procedure Insert_Text + (This : in out Text_Buffer; + Pos : in Natural; + Item : in String); + + function Length (This : in Text_Buffer) return Natural; |