diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-10 13:32:17 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-10 13:32:17 +1000 |
commit | 1a184730dae07956109c476824d1536552b2e139 (patch) | |
tree | 82b29ba68530db3894742848f764efcc103dad27 /src/c_fl_file_input.cpp | |
parent | 83b0ddb8b5040e51c0bf8a584d4679e7b82d9203 (diff) |
File_Input widgets added
Diffstat (limited to 'src/c_fl_file_input.cpp')
-rw-r--r-- | src/c_fl_file_input.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/c_fl_file_input.cpp b/src/c_fl_file_input.cpp new file mode 100644 index 0000000..cc8c66f --- /dev/null +++ b/src/c_fl_file_input.cpp @@ -0,0 +1,57 @@ + + +#include <FL/Fl_File_Input.H> +#include "c_fl_file_input.h" + + +typedef void (hook)(void*); +typedef hook* hook_p; + + + + +class My_File_Input : public Fl_File_Input { + public: + using Fl_File_Input::Fl_File_Input; + friend void file_input_set_draw_hook(FILE_INPUT n, void * d); + friend void fl_file_input_draw(FILE_INPUT n); + protected: + void draw(); + void real_draw(); + hook_p draw_hook; +}; + + +void My_File_Input::draw() { + (*draw_hook)(this->user_data()); +} + + +void My_File_Input::real_draw() { + Fl_File_Input::draw(); +} + + +void file_input_set_draw_hook(FILE_INPUT n, void * d) { + reinterpret_cast<My_File_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +} + + +void fl_file_input_draw(FILE_INPUT n) { + reinterpret_cast<My_File_Input*>(n)->real_draw(); +} + + + + +FILE_INPUT new_fl_file_input(int x, int y, int w, int h, char* label) { + My_File_Input *i = new My_File_Input(x, y, w, h, label); + return i; +} + + +void free_fl_file_input(FILE_INPUT i) { + delete reinterpret_cast<My_File_Input*>(i); +} + + |