summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2016-10-04 21:34:08 +1100
committerJed Barber <jjbarber@y7mail.com>2016-10-04 21:34:08 +1100
commit8d0d41649b6b4699cfb2c6c05dda09c29b4c3d15 (patch)
treea001b2f1d41be35939322dd7e44acb4be80b180d
parent3f1a529a3b82c322678163cb70a8884fdf3eb920 (diff)
Basic replace functionality added
-rw-r--r--c_fl_text_buffer.cpp5
-rw-r--r--c_fl_text_buffer.h1
-rw-r--r--fltk-text_buffers.adb20
-rw-r--r--fltk-text_buffers.ads6
4 files changed, 32 insertions, 0 deletions
diff --git a/c_fl_text_buffer.cpp b/c_fl_text_buffer.cpp
index b0df365..8b0cde1 100644
--- a/c_fl_text_buffer.cpp
+++ b/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/c_fl_text_buffer.h b/c_fl_text_buffer.h
index cd64112..5a1ab08 100644
--- a/c_fl_text_buffer.h
+++ b/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/fltk-text_buffers.adb b/fltk-text_buffers.adb
index 6df96cb..b3b8344 100644
--- a/fltk-text_buffers.adb
+++ b/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/fltk-text_buffers.ads b/fltk-text_buffers.ads
index 0bb881e..a560076 100644
--- a/fltk-text_buffers.ads
+++ b/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;