summaryrefslogtreecommitdiff
path: root/src/c_fl_repeat_button.cpp
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-05-13 18:37:11 +1000
committerJed Barber <jjbarber@y7mail.com>2017-05-13 18:37:11 +1000
commit3c1e9610ac0e503787678cea31d79e3126813a2c (patch)
treecb324baa985aebbfc99ebb884cbd4b4131d1f933 /src/c_fl_repeat_button.cpp
parente35f258838e3a5e5d3458e9d9210deaaace08e9d (diff)
Radio_Round_Button, Round_Button, Radio_Button, Repeat_Button, Toggle_Button widgets all now have Handle methods
Diffstat (limited to 'src/c_fl_repeat_button.cpp')
-rw-r--r--src/c_fl_repeat_button.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/c_fl_repeat_button.cpp b/src/c_fl_repeat_button.cpp
index b1f557d..645f911 100644
--- a/src/c_fl_repeat_button.cpp
+++ b/src/c_fl_repeat_button.cpp
@@ -4,8 +4,14 @@
#include "c_fl_repeat_button.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;
@@ -15,10 +21,15 @@ class My_Repeat_Button : public Fl_Repeat_Button {
using Fl_Repeat_Button::Fl_Repeat_Button;
friend void repeat_button_set_draw_hook(REPEATBUTTON b, void * d);
friend void fl_repeat_button_draw(REPEATBUTTON b);
+ friend void repeat_button_set_handle_hook(REPEATBUTTON b, void * h);
+ friend int fl_repeat_button_handle(REPEATBUTTON b, 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;
};
@@ -32,8 +43,18 @@ void My_Repeat_Button::real_draw() {
}
+int My_Repeat_Button::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Repeat_Button::real_handle(int e) {
+ return Fl_Repeat_Button::handle(e);
+}
+
+
void repeat_button_set_draw_hook(REPEATBUTTON b, void * d) {
- reinterpret_cast<My_Repeat_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Repeat_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -42,6 +63,16 @@ void fl_repeat_button_draw(REPEATBUTTON b) {
}
+void repeat_button_set_handle_hook(REPEATBUTTON b, void * h) {
+ reinterpret_cast<My_Repeat_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_repeat_button_handle(REPEATBUTTON b, int e) {
+ return reinterpret_cast<My_Repeat_Button*>(b)->real_handle(e);
+}
+
+
REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label) {