// Programmed by Jedidiah Barber // Released into the public domain #include #include "c_fl_input_.h" // Exports from Ada extern "C" void widget_draw_hook(void * ud); extern "C" int widget_handle_hook(void * ud, int e); // Attaching all relevant hooks and friends class My_Input : public Fl_Input_ { public: using Fl_Input_::Fl_Input_; friend void fl_input_draw(INPUT i); friend int fl_input_handle(INPUT i, int e); void draw(); int handle(int e); }; void My_Input::draw() { widget_draw_hook(this->user_data()); } int My_Input::handle(int e) { return widget_handle_hook(this->user_data(), e); } // Flattened C API INPUT new_fl_input(int x, int y, int w, int h, char* label) { My_Input *i = new My_Input(x, y, w, h, label); return i; } void free_fl_input(INPUT i) { delete reinterpret_cast(i); } int fl_input_copy(INPUT i, int c) { return reinterpret_cast(i)->copy(c); } int fl_input_cut(INPUT i) { return reinterpret_cast(i)->cut(); } int fl_input_cut2(INPUT i, int b) { return reinterpret_cast(i)->cut(b); } int fl_input_cut3(INPUT i, int a, int b) { return reinterpret_cast(i)->cut(a,b); } int fl_input_copy_cuts(INPUT i) { return reinterpret_cast(i)->copy_cuts(); } int fl_input_undo(INPUT i) { return reinterpret_cast(i)->undo(); } int fl_input_get_readonly(INPUT i) { return reinterpret_cast(i)->readonly(); } void fl_input_set_readonly(INPUT i, int t) { reinterpret_cast(i)->readonly(t); } int fl_input_get_tab_nav(INPUT i) { return reinterpret_cast(i)->tab_nav(); } void fl_input_set_tab_nav(INPUT i, int t) { reinterpret_cast(i)->tab_nav(t); } int fl_input_get_wrap(INPUT i) { return reinterpret_cast(i)->wrap(); } void fl_input_set_wrap(INPUT i, int t) { reinterpret_cast(i)->wrap(t); } int fl_input_get_input_type(INPUT i) { return reinterpret_cast(i)->input_type(); } void fl_input_set_input_type(INPUT i, int t) { reinterpret_cast(i)->input_type(t); } unsigned long fl_input_get_shortcut(INPUT i) { return reinterpret_cast(i)->shortcut(); } void fl_input_set_shortcut(INPUT i, unsigned long t) { reinterpret_cast(i)->shortcut(t); } int fl_input_get_mark(INPUT i) { return reinterpret_cast(i)->mark(); } int fl_input_set_mark(INPUT i, int t) { return reinterpret_cast(i)->mark(t); } int fl_input_get_position(INPUT i) { return reinterpret_cast(i)->position(); } int fl_input_set_position(INPUT i, int t) { return reinterpret_cast(i)->position(t); } int fl_input_set_position2(INPUT i, int p, int m) { return reinterpret_cast(i)->position(p, m); } unsigned int fl_input_index(INPUT i, int p) { return reinterpret_cast(i)->index(p); } int fl_input_insert(INPUT i, const char * s, int l) { return reinterpret_cast(i)->insert(s,l); } int fl_input_replace(INPUT i, int b, int e, const char * s, int l) { return reinterpret_cast(i)->replace(b,e,s,l); } const char * fl_input_get_value(INPUT i) { return reinterpret_cast(i)->value(); } int fl_input_set_value(INPUT i, char * s, int len) { return reinterpret_cast(i)->value(s,len); } int fl_input_get_maximum_size(INPUT i) { return reinterpret_cast(i)->maximum_size(); } void fl_input_set_maximum_size(INPUT i, int t) { reinterpret_cast(i)->maximum_size(t); } int fl_input_get_size(INPUT i) { return reinterpret_cast(i)->size(); } unsigned int fl_input_get_cursor_color(INPUT i) { return reinterpret_cast(i)->cursor_color(); } void fl_input_set_cursor_color(INPUT i, unsigned int t) { reinterpret_cast(i)->cursor_color(t); } unsigned int fl_input_get_textcolor(INPUT i) { return reinterpret_cast(i)->textcolor(); } void fl_input_set_textcolor(INPUT i, unsigned int t) { reinterpret_cast(i)->textcolor(t); } int fl_input_get_textfont(INPUT i) { return reinterpret_cast(i)->textfont(); } void fl_input_set_textfont(INPUT i, int t) { reinterpret_cast(i)->textfont(t); } int fl_input_get_textsize(INPUT i) { return reinterpret_cast(i)->textsize(); } void fl_input_set_textsize(INPUT i, int t) { reinterpret_cast(i)->textsize(t); } void fl_input_set_size(INPUT i, int w, int h) { reinterpret_cast(i)->size(w,h); } void fl_input_resize(INPUT i, int x, int y, int w, int h) { reinterpret_cast(i)->Fl_Input_::resize(x, y, w, h); } void fl_input_draw(INPUT i) { // This inherits directly from Fl_Widget::draw, and // the Fl_Widget draw method doesn't technically exist, so... (void)(i); // It is more convenient for this function to exist, however, // even though it will likely never be called, because it simplifies // and makes uniform the implementation of the Ada Input Draw subprogram. } int fl_input_handle(INPUT i, int e) { return reinterpret_cast(i)->Fl_Input_::handle(e); }