From 098adf24b20bb7ae71cfd7e6af5517205552e9e5 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 17 May 2018 19:18:34 +1000 Subject: Added FLTK.Widgets.Valuators.Value_Inputs --- src/c_fl_value_input.cpp | 137 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 src/c_fl_value_input.cpp (limited to 'src/c_fl_value_input.cpp') diff --git a/src/c_fl_value_input.cpp b/src/c_fl_value_input.cpp new file mode 100644 index 0000000..91404a6 --- /dev/null +++ b/src/c_fl_value_input.cpp @@ -0,0 +1,137 @@ + + +#include +#include "c_fl_value_input.h" +#include "c_fl_type.h" + + + + +class My_Value_Input : public Fl_Value_Input { + public: + using Fl_Value_Input::Fl_Value_Input; + friend void value_input_set_draw_hook(VALUE_INPUT a, void * d); + friend void fl_value_input_draw(VALUE_INPUT a); + friend void value_input_set_handle_hook(VALUE_INPUT a, void * h); + friend int fl_value_input_handle(VALUE_INPUT 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_Input::draw() { + (*draw_hook)(this->user_data()); +} + +void My_Value_Input::real_draw() { + Fl_Value_Input::draw(); +} + +int My_Value_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + +int My_Value_Input::real_handle(int e) { + return Fl_Value_Input::handle(e); +} + +void value_input_set_draw_hook(VALUE_INPUT a, void * d) { + reinterpret_cast(a)->draw_hook = reinterpret_cast(d); +} + +void fl_value_input_draw(VALUE_INPUT a) { + reinterpret_cast(a)->real_draw(); +} + +void value_input_set_handle_hook(VALUE_INPUT a, void * h) { + reinterpret_cast(a)->handle_hook = reinterpret_cast(h); +} + +int fl_value_input_handle(VALUE_INPUT a, int e) { + return reinterpret_cast(a)->real_handle(e); +} + + + + +VALUE_INPUT new_fl_value_input(int x, int y, int w, int h, char* label) { + My_Value_Input *a = new My_Value_Input(x, y, w, h, label); + return a; +} + +void free_fl_value_input(VALUE_INPUT a) { + delete reinterpret_cast(a); +} + + + + +void * fl_value_input_get_input(VALUE_INPUT v) { + return &(reinterpret_cast(v)->input); +} + + + + +unsigned int fl_value_input_get_cursor_color(VALUE_INPUT v) { + return reinterpret_cast(v)->cursor_color(); +} + +void fl_value_input_set_cursor_color(VALUE_INPUT v, unsigned int c) { + reinterpret_cast(v)->cursor_color(c); +} + + + + +int fl_value_input_get_shortcut(VALUE_INPUT v) { + return reinterpret_cast(v)->Fl_Value_Input::shortcut(); +} + +void fl_value_input_set_shortcut(VALUE_INPUT v, int k) { + reinterpret_cast(v)->Fl_Value_Input::shortcut(k); +} + + + + +int fl_value_input_is_soft(VALUE_INPUT a) { + return reinterpret_cast(a)->soft(); +} + +void fl_value_input_set_soft(VALUE_INPUT a, int t) { + reinterpret_cast(a)->soft(t); +} + + + + +unsigned int fl_value_input_get_text_color(VALUE_INPUT v) { + return reinterpret_cast(v)->textcolor(); +} + +void fl_value_input_set_text_color(VALUE_INPUT v, unsigned int c) { + reinterpret_cast(v)->textcolor(static_cast(c)); +} + +int fl_value_input_get_text_font(VALUE_INPUT v) { + return reinterpret_cast(v)->textfont(); +} + +void fl_value_input_set_text_font(VALUE_INPUT v, int f) { + reinterpret_cast(v)->textfont(static_cast(f)); +} + +int fl_value_input_get_text_size(VALUE_INPUT v) { + return reinterpret_cast(v)->textsize(); +} + +void fl_value_input_set_text_size(VALUE_INPUT v, int s) { + reinterpret_cast(v)->textsize(static_cast(s)); +} + + -- cgit