diff options
Diffstat (limited to 'src/c_fl_radio_round_button.cpp')
-rw-r--r-- | src/c_fl_radio_round_button.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/c_fl_radio_round_button.cpp b/src/c_fl_radio_round_button.cpp index de9e928..12d043f 100644 --- a/src/c_fl_radio_round_button.cpp +++ b/src/c_fl_radio_round_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_radio_round_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_Radio_Round_Button : public Fl_Radio_Round_Button { using Fl_Radio_Round_Button::Fl_Radio_Round_Button; friend void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d); friend void fl_radio_round_button_draw(RADIOROUNDBUTTON b); + friend void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h); + friend int fl_radio_round_button_handle(RADIOROUNDBUTTON 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_Radio_Round_Button::real_draw() { } +int My_Radio_Round_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Radio_Round_Button::real_handle(int e) { + return Fl_Radio_Round_Button::handle(e); +} + + void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d) { - reinterpret_cast<My_Radio_Round_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d); + reinterpret_cast<My_Radio_Round_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } @@ -42,6 +63,16 @@ void fl_radio_round_button_draw(RADIOROUNDBUTTON b) { } +void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h) { + reinterpret_cast<My_Radio_Round_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); +} + + +int fl_radio_round_button_handle(RADIOROUNDBUTTON b, int e) { + return reinterpret_cast<My_Radio_Round_Button*>(b)->real_handle(e); +} + + RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* label) { |