summaryrefslogtreecommitdiff
path: root/src/c_fl_group.cpp
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-05-13 23:05:47 +1000
committerJed Barber <jjbarber@y7mail.com>2017-05-13 23:05:47 +1000
commitf4b68da1d14d39ab4140d8c5e7fbbf45525e7e77 (patch)
tree86fa5a4d39c6d6e83f8d269ae63338257b4f9ce2 /src/c_fl_group.cpp
parent3c1e9610ac0e503787678cea31d79e3126813a2c (diff)
Text_Editor, Text_Display, Double_Window, Single_Window, Menu_Window, Window, Group widgets all now have Handle methods
Diffstat (limited to 'src/c_fl_group.cpp')
-rw-r--r--src/c_fl_group.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/c_fl_group.cpp b/src/c_fl_group.cpp
index d02476a..88fe477 100644
--- a/src/c_fl_group.cpp
+++ b/src/c_fl_group.cpp
@@ -6,8 +6,14 @@
#include "c_fl_widget.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_Group : public Fl_Group {
using Fl_Group::Fl_Group;
friend void group_set_draw_hook(GROUP g, void * d);
friend void fl_group_draw(GROUP g);
+ friend void group_set_handle_hook(GROUP g, void * h);
+ friend int fl_group_handle(GROUP g, 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_Group::real_draw() {
}
+int My_Group::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Group::real_handle(int e) {
+ return Fl_Group::handle(e);
+}
+
+
void group_set_draw_hook(GROUP g, void * d) {
- reinterpret_cast<My_Group*>(g)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Group*>(g)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -44,6 +65,16 @@ void fl_group_draw(GROUP g) {
}
+void group_set_handle_hook(GROUP g, void * h) {
+ reinterpret_cast<My_Group*>(g)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_group_handle(GROUP g, int e) {
+ return reinterpret_cast<My_Group*>(g)->real_handle(e);
+}
+
+
GROUP new_fl_group(int x, int y, int w, int h, char* label) {