From ee210f26aecaaa19e991773a7be58028223d1cb8 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 18 May 2018 01:29:47 +1000 Subject: Added FLTK.Widgets.Valuators.Value_Outputs --- src/c_fl_value_output.cpp | 108 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/c_fl_value_output.cpp (limited to 'src/c_fl_value_output.cpp') diff --git a/src/c_fl_value_output.cpp b/src/c_fl_value_output.cpp new file mode 100644 index 0000000..5e874f9 --- /dev/null +++ b/src/c_fl_value_output.cpp @@ -0,0 +1,108 @@ + + +#include +#include "c_fl_value_output.h" +#include "c_fl_type.h" + + + + +class My_Value_Output : public Fl_Value_Output { + public: + using Fl_Value_Output::Fl_Value_Output; + friend void value_output_set_draw_hook(VALUE_OUTPUT a, void * d); + friend void fl_value_output_draw(VALUE_OUTPUT a); + friend void value_output_set_handle_hook(VALUE_OUTPUT a, void * h); + friend int fl_value_output_handle(VALUE_OUTPUT a, 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_Value_Output::draw() { + (*draw_hook)(this->user_data()); +} + +void My_Value_Output::real_draw() { + Fl_Value_Output::draw(); +} + +int My_Value_Output::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + +int My_Value_Output::real_handle(int e) { + return Fl_Value_Output::handle(e); +} + +void value_output_set_draw_hook(VALUE_OUTPUT a, void * d) { + reinterpret_cast(a)->draw_hook = reinterpret_cast(d); +} + +void fl_value_output_draw(VALUE_OUTPUT a) { + reinterpret_cast(a)->real_draw(); +} + +void value_output_set_handle_hook(VALUE_OUTPUT a, void * h) { + reinterpret_cast(a)->handle_hook = reinterpret_cast(h); +} + +int fl_value_output_handle(VALUE_OUTPUT a, int e) { + return reinterpret_cast(a)->real_handle(e); +} + + + + +VALUE_OUTPUT new_fl_value_output(int x, int y, int w, int h, char* label) { + My_Value_Output *a = new My_Value_Output(x, y, w, h, label); + return a; +} + +void free_fl_value_output(VALUE_OUTPUT a) { + delete reinterpret_cast(a); +} + + + + +int fl_value_output_is_soft(VALUE_OUTPUT a) { + return reinterpret_cast(a)->soft(); +} + +void fl_value_output_set_soft(VALUE_OUTPUT a, int t) { + reinterpret_cast(a)->soft(t); +} + + + + +unsigned int fl_value_output_get_text_color(VALUE_OUTPUT v) { + return reinterpret_cast(v)->textcolor(); +} + +void fl_value_output_set_text_color(VALUE_OUTPUT v, unsigned int c) { + reinterpret_cast(v)->textcolor(static_cast(c)); +} + +int fl_value_output_get_text_font(VALUE_OUTPUT v) { + return reinterpret_cast(v)->textfont(); +} + +void fl_value_output_set_text_font(VALUE_OUTPUT v, int f) { + reinterpret_cast(v)->textfont(static_cast(f)); +} + +int fl_value_output_get_text_size(VALUE_OUTPUT v) { + return reinterpret_cast(v)->textsize(); +} + +void fl_value_output_set_text_size(VALUE_OUTPUT v, int s) { + reinterpret_cast(v)->textsize(static_cast(s)); +} + + -- cgit