diff options
author | Jed Barber <jjbarber@y7mail.com> | 2018-03-03 19:29:24 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2018-03-03 19:29:24 +1100 |
commit | 3405e301657315577c3243fc9744eca954faa833 (patch) | |
tree | 6522faa40102c2c11fc804ee2ef440cc4d89bf09 /src/c_fl_roller.cpp | |
parent | 94514ea97b5b4533ef775ef1949de20df58e715f (diff) |
Added FLTK.Widgets.Valuators.Rollers
Diffstat (limited to 'src/c_fl_roller.cpp')
-rw-r--r-- | src/c_fl_roller.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/c_fl_roller.cpp b/src/c_fl_roller.cpp new file mode 100644 index 0000000..94ac576 --- /dev/null +++ b/src/c_fl_roller.cpp @@ -0,0 +1,70 @@ + + +#include <FL/Fl_Roller.H> +#include "c_fl_roller.h" +#include "c_fl_type.h" + + + + +class My_Roller : public Fl_Roller { + public: + using Fl_Roller::Fl_Roller; + friend void roller_set_draw_hook(ROLLER r, void * d); + friend void fl_roller_draw(ROLLER r); + friend void roller_set_handle_hook(ROLLER r, void * h); + friend int fl_roller_handle(ROLLER r, int e); + protected: + void draw(); + void real_draw(); + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; +}; + +void My_Roller::draw() { + (*draw_hook)(this->user_data()); +} + +void My_Roller::real_draw() { + Fl_Roller::draw(); +} + +int My_Roller::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + +int My_Roller::real_handle(int e) { + return Fl_Roller::handle(e); +} + +void roller_set_draw_hook(ROLLER r, void * d) { + reinterpret_cast<My_Roller*>(r)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + +void fl_roller_draw(ROLLER r) { + reinterpret_cast<My_Roller*>(r)->real_draw(); +} + +void roller_set_handle_hook(ROLLER r, void * h) { + reinterpret_cast<My_Roller*>(r)->handle_hook = reinterpret_cast<h_hook_p>(h); +} + +int fl_roller_handle(ROLLER r, int e) { + return reinterpret_cast<My_Roller*>(r)->real_handle(e); +} + + + + +ROLLER new_fl_roller(int x, int y, int w, int h, char* label) { + My_Roller *r = new My_Roller(x, y, w, h, label); + return r; +} + +void free_fl_roller(ROLLER r) { + delete reinterpret_cast<My_Roller*>(r); +} + + |