summaryrefslogtreecommitdiff
path: root/src/c_fl_text_display.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_fl_text_display.cpp')
-rw-r--r--src/c_fl_text_display.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/c_fl_text_display.cpp b/src/c_fl_text_display.cpp
index dc283f7..0114d8d 100644
--- a/src/c_fl_text_display.cpp
+++ b/src/c_fl_text_display.cpp
@@ -6,8 +6,14 @@
#include "c_fl_text_buffer.h"
-typedef void (hook)(void*);
-typedef hook* hook_p;
+
+
+typedef void (d_hook)(void*);
+typedef d_hook* d_hook_p;
+
+
+typedef int (h_hook)(void*,int);
+typedef h_hook* h_hook_p;
@@ -17,10 +23,15 @@ class My_Text_Display : public Fl_Text_Display {
using Fl_Text_Display::Fl_Text_Display;
friend void text_display_set_draw_hook(TEXTDISPLAY td, void * d);
friend void fl_text_display_draw(TEXTDISPLAY td);
+ friend void text_display_set_handle_hook(TEXTDISPLAY td, void * h);
+ friend int fl_text_display_handle(TEXTDISPLAY td, int e);
protected:
void draw();
void real_draw();
- hook_p draw_hook;
+ int handle(int e);
+ int real_handle(int e);
+ d_hook_p draw_hook;
+ h_hook_p handle_hook;
};
@@ -34,8 +45,18 @@ void My_Text_Display::real_draw() {
}
+int My_Text_Display::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Text_Display::real_handle(int e) {
+ return Fl_Text_Display::handle(e);
+}
+
+
void text_display_set_draw_hook(TEXTDISPLAY td, void * d) {
- reinterpret_cast<My_Text_Display*>(td)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Text_Display*>(td)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -44,6 +65,16 @@ void fl_text_display_draw(TEXTDISPLAY td) {
}
+void text_display_set_handle_hook(TEXTDISPLAY td, void * h) {
+ reinterpret_cast<My_Text_Display*>(td)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_text_display_handle(TEXTDISPLAY td, int e) {
+ return reinterpret_cast<My_Text_Display*>(td)->real_handle(e);
+}
+
+
TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label) {