From d97b613255832ea94cc288656a9c4daa06c41ebc Mon Sep 17 00:00:00 2001 From: Aditya Siram Date: Mon, 27 Feb 2017 18:32:51 -0600 Subject: [PATCH] Custom Widgets. --- c-src/DerivedText_Editor.cpp | 96 ++++- c-src/DerivedText_Editor.h | 22 +- c-src/Fl_AdjusterC.cpp | 144 ++++++- c-src/Fl_AdjusterC.h | 37 +- c-src/Fl_CallbackC.h | 1 + c-src/Fl_Check_ButtonC.cpp | 135 ++++++- c-src/Fl_Check_ButtonC.h | 34 +- c-src/Fl_ChoiceC.cpp | 141 +++++-- c-src/Fl_ChoiceC.h | 49 ++- c-src/Fl_ClockC.cpp | 135 ++++++- c-src/Fl_ClockC.h | 34 +- c-src/Fl_Color_ChooserC.cpp | 40 +- c-src/Fl_Color_ChooserC.h | 20 +- c-src/Fl_CounterC.cpp | 147 ++++++- c-src/Fl_CounterC.h | 32 ++ c-src/Fl_DialC.cpp | 143 ++++++- c-src/Fl_DialC.h | 31 ++ c-src/Fl_File_BrowserC.cpp | 132 ++++-- c-src/Fl_File_BrowserC.h | 40 +- c-src/Fl_File_InputC.cpp | 135 ++++++- c-src/Fl_File_InputC.h | 33 +- c-src/Fl_InputC.cpp | 136 ++++++- c-src/Fl_InputC.h | 37 +- c-src/Fl_Light_ButtonC.cpp | 134 ++++++- c-src/Fl_Light_ButtonC.h | 32 ++ c-src/Fl_Menu_BarC.cpp | 130 +++++- c-src/Fl_Menu_BarC.h | 31 ++ c-src/Fl_Menu_ButtonC.cpp | 137 ++++++- c-src/Fl_Menu_ButtonC.h | 31 ++ c-src/Fl_OutputC.cpp | 139 ++++++- c-src/Fl_OutputC.h | 38 +- c-src/Fl_PackC.cpp | 132 +++++- c-src/Fl_PackC.h | 31 ++ c-src/Fl_PositionerC.cpp | 135 ++++++- c-src/Fl_PositionerC.h | 35 +- c-src/Fl_ProgressC.cpp | 138 ++++++- c-src/Fl_ProgressC.h | 32 ++ c-src/Fl_Repeat_ButtonC.cpp | 134 ++++++- c-src/Fl_Repeat_ButtonC.h | 31 ++ c-src/Fl_Return_ButtonC.cpp | 135 ++++++- c-src/Fl_Return_ButtonC.h | 31 ++ c-src/Fl_RollerC.cpp | 146 ++++++- c-src/Fl_RollerC.h | 32 ++ c-src/Fl_Round_ButtonC.cpp | 135 ++++++- c-src/Fl_Round_ButtonC.h | 31 ++ c-src/Fl_ScrollC.cpp | 127 +++++- c-src/Fl_ScrollC.h | 31 ++ c-src/Fl_ScrollbarC.cpp | 135 ++++++- c-src/Fl_ScrollbarC.h | 31 ++ c-src/Fl_SliderC.cpp | 139 +++++-- c-src/Fl_SliderC.h | 31 ++ c-src/Fl_SpinnerC.cpp | 129 +++++- c-src/Fl_SpinnerC.h | 32 ++ c-src/Fl_Sys_Menu_BarC.cpp | 135 ++++++- c-src/Fl_Sys_Menu_BarC.h | 31 ++ c-src/Fl_Table_RowC.cpp | 55 ++- c-src/Fl_Table_RowC.h | 15 +- c-src/Fl_TabsC.cpp | 138 ++++++- c-src/Fl_TabsC.h | 32 ++ c-src/Fl_Text_DisplayC.cpp | 222 +++++++--- c-src/Fl_Text_DisplayC.h | 31 ++ c-src/Fl_Text_EditorC.cpp | 319 ++++++++------- c-src/Fl_Text_EditorC.h | 15 +- c-src/Fl_TileC.cpp | 134 ++++++- c-src/Fl_TileC.h | 32 ++ c-src/Fl_TimerC.cpp | 124 +++++- c-src/Fl_TimerC.h | 30 ++ c-src/Fl_TreeC.cpp | 155 +++++-- c-src/Fl_TreeC.h | 31 ++ c-src/Fl_Value_InputC.cpp | 137 ++++++- c-src/Fl_Value_InputC.h | 32 ++ c-src/Fl_Value_OutputC.cpp | 138 ++++++- c-src/Fl_Value_OutputC.h | 32 ++ c-src/Fl_Value_SliderC.cpp | 138 ++++++- c-src/Fl_Value_SliderC.h | 34 +- c-src/Fl_WizardC.cpp | 156 +++++++- c-src/Fl_WizardC.h | 33 ++ c-src/Makefile.in | 2 +- scripts/skeletons.el | 159 ++++++-- src/Graphics/UI/FLTK/LowLevel/Adjuster.chs | 78 +++- src/Graphics/UI/FLTK/LowLevel/CheckButton.chs | 78 +++- src/Graphics/UI/FLTK/LowLevel/Choice.chs | 71 +++- src/Graphics/UI/FLTK/LowLevel/Clock.chs | 81 +++- .../UI/FLTK/LowLevel/ColorChooser.chs | 79 +++- src/Graphics/UI/FLTK/LowLevel/Counter.chs | 89 ++++- src/Graphics/UI/FLTK/LowLevel/Dial.chs | 86 +++- src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs | 78 ++++ src/Graphics/UI/FLTK/LowLevel/FileInput.chs | 79 +++- src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs | 378 +++++++++++++++--- src/Graphics/UI/FLTK/LowLevel/Input.chs | 74 +++- src/Graphics/UI/FLTK/LowLevel/LightButton.chs | 77 +++- src/Graphics/UI/FLTK/LowLevel/MenuBar.chs | 74 +++- src/Graphics/UI/FLTK/LowLevel/MenuButton.chs | 79 +++- src/Graphics/UI/FLTK/LowLevel/Output.chs | 78 +++- src/Graphics/UI/FLTK/LowLevel/Pack.chs | 79 +++- src/Graphics/UI/FLTK/LowLevel/Positioner.chs | 93 ++++- src/Graphics/UI/FLTK/LowLevel/Progress.chs | 83 +++- .../UI/FLTK/LowLevel/RepeatButton.chs | 80 +++- .../UI/FLTK/LowLevel/ReturnButton.chs | 59 ++- src/Graphics/UI/FLTK/LowLevel/Roller.chs | 55 ++- src/Graphics/UI/FLTK/LowLevel/RoundButton.chs | 78 +++- src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs | 83 +++- src/Graphics/UI/FLTK/LowLevel/Scrolled.chs | 88 +++- src/Graphics/UI/FLTK/LowLevel/Slider.chs | 92 ++++- src/Graphics/UI/FLTK/LowLevel/Spinner.chs | 76 +++- src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs | 80 +++- src/Graphics/UI/FLTK/LowLevel/TableRow.chs | 34 +- src/Graphics/UI/FLTK/LowLevel/Tabs.chs | 60 ++- src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs | 90 ++++- src/Graphics/UI/FLTK/LowLevel/TextEditor.chs | 78 +++- src/Graphics/UI/FLTK/LowLevel/Tile.chs | 76 +++- src/Graphics/UI/FLTK/LowLevel/Timer.chs | 84 +++- src/Graphics/UI/FLTK/LowLevel/Tree.chs | 80 +++- src/Graphics/UI/FLTK/LowLevel/ValueInput.chs | 84 +++- src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs | 80 +++- src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs | 87 +++- src/Graphics/UI/FLTK/LowLevel/Wizard.chs | 77 +++- 117 files changed, 8754 insertions(+), 1120 deletions(-) diff --git a/c-src/DerivedText_Editor.cpp b/c-src/DerivedText_Editor.cpp index af46e730..45e79f6b 100644 --- a/c-src/DerivedText_Editor.cpp +++ b/c-src/DerivedText_Editor.cpp @@ -5,13 +5,24 @@ DerivedText_Editor::Key_Binding_With_Callback* DerivedText_Editor::global_key_bindings = 0; #endif +DerivedText_Editor::DerivedText_Editor(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Text_Editor(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; +} +DerivedText_Editor::DerivedText_Editor(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Text_Editor(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; +} +DerivedText_Editor::~DerivedText_Editor(){ + free(overriddenFuncs); +} DerivedText_Editor::DerivedText_Editor(int x,int y,int w,int h,const char* t) : Fl_Text_Editor(x,y,w,h,t){ - key_bindings = 0; - key_bindings = get_default_keybindings(); - curr_callback_context = 0; - default_callback_context_ = 0; - default_key_function_ = C_to_Fl_Callback::intercept; - } + key_bindings = 0; + key_bindings = get_default_keybindings(); + curr_callback_context = 0; + default_callback_context_ = 0; + default_key_function_ = C_to_Fl_Callback::intercept; +} C_to_Fl_Callback* DerivedText_Editor::get_curr_callback_context(){ return curr_callback_context; } @@ -34,9 +45,9 @@ void DerivedText_Editor::replace_key_bindings(Key_Binding_With_Callback** l) { replace_key_bindings(&key_bindings, l); } void DerivedText_Editor::add_key_binding(int key, - int state, - C_to_Fl_Callback* callback_context, - Key_Binding_With_Callback** list){ + int state, + C_to_Fl_Callback* callback_context, + Key_Binding_With_Callback** list){ Key_Binding_With_Callback* curr = *list; // iterate to the last binding while(curr->next){curr = curr->next;} @@ -94,7 +105,7 @@ void DerivedText_Editor::remove_key_binding(int key, int state, Key_Binding_With Key_Binding_With_Callback* curr = *list; Key_Binding_With_Callback* last = NULL; for (;curr;last = curr, curr = curr->next){ - if (curr->key == key && curr->state == state) break; + if (curr->key == key && curr->state == state) break; } if (!curr) return; if (last) last->next = curr->next; @@ -127,7 +138,7 @@ int DerivedText_Editor::handle_key(){ if (Fl::compose_state) { int pos = this->insert_position(); this->buffer()->select(pos - Fl::compose_state, pos); - } + } #endif show_insert_position(); set_changed(); @@ -145,3 +156,66 @@ int DerivedText_Editor::handle_key(){ if (default_key_function_ && !state) return default_key_function_(c, this); return 0; } + +void DerivedText_Editor::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Text_Editor) this); + } + else { + Fl_Text_Editor::draw(); + } +} + +void DerivedText_Editor::draw_super(){ + Fl_Text_Editor::draw(); +} + +int DerivedText_Editor::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Text_Editor) this,event); + } + else { + i = Fl_Text_Editor::handle(event); + } + return i; +} +int DerivedText_Editor::handle_super(int event){ + return Fl_Text_Editor::handle(event); +} + +void DerivedText_Editor::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Text_Editor) this,x,y,w,h); + } + else { + Fl_Text_Editor::resize(x,y,w,h); + } +} + +void DerivedText_Editor::resize_super(int x, int y, int w, int h){ + Fl_Text_Editor::resize(x,y,w,h); +} +void DerivedText_Editor::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Text_Editor) this); + } + else { + Fl_Text_Editor::show(); + } +} +void DerivedText_Editor::show_super(){ + Fl_Text_Editor::show(); +} + +void DerivedText_Editor::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Text_Editor) this); + } + else { + Fl_Text_Editor::hide(); + } +} +void DerivedText_Editor::hide_super(){ + Fl_Text_Editor::hide(); +} diff --git a/c-src/DerivedText_Editor.h b/c-src/DerivedText_Editor.h index 00b0d9aa..b97b5444 100644 --- a/c-src/DerivedText_Editor.h +++ b/c-src/DerivedText_Editor.h @@ -2,12 +2,14 @@ #define __DERIVEDTEXT_EDITOR__ #include "FL/Fl.H" #include "FL/Fl_Text_Editor.H" - +#include "Fl_Types.h" class C_to_Fl_Callback; class DerivedText_Editor : public Fl_Text_Editor { private: C_to_Fl_Callback* curr_callback_context; + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; public: typedef int (*Key_Func)(int key, DerivedText_Editor* editor); struct Key_Binding_With_Callback { @@ -32,10 +34,10 @@ class DerivedText_Editor : public Fl_Text_Editor { // Unlike Fl_Text_Editor a new binding is appended rather than prepended void add_key_binding(int key, int state, C_to_Fl_Callback* callback_context, - Key_Binding_With_Callback** list); + Key_Binding_With_Callback** list); void add_key_binding(Key_Binding_With_Callback* new_bindings, - Key_Binding_With_Callback** old_bindings){ + Key_Binding_With_Callback** old_bindings){ Key_Binding_With_Callback* curr = *old_bindings; // iterate to the last binding while(curr->next){curr = curr->next;} @@ -58,11 +60,23 @@ class DerivedText_Editor : public Fl_Text_Editor { C_to_Fl_Callback* get_curr_callback_context(); C_to_Fl_Callback* get_default_callback_context(); DerivedText_Editor(int x,int y,int w,int h,const char* t=0); + DerivedText_Editor(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + DerivedText_Editor(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + ~DerivedText_Editor(); protected: int handle_key(); Key_Func default_key_function_; static Key_Binding_With_Callback* global_key_bindings; C_to_Fl_Callback* default_callback_context_; }; - #endif /* __DERIVEDTEXT_EDITOR__ */ diff --git a/c-src/Fl_AdjusterC.cpp b/c-src/Fl_AdjusterC.cpp index eb90aea5..e56a61d2 100644 --- a/c-src/Fl_AdjusterC.cpp +++ b/c-src/Fl_AdjusterC.cpp @@ -1,7 +1,81 @@ #include "Fl_AdjusterC.h" #ifdef __cplusplus EXPORT { -#endif + Fl_DerivedAdjuster::Fl_DerivedAdjuster(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Adjuster(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedAdjuster::Fl_DerivedAdjuster(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Adjuster(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedAdjuster::~Fl_DerivedAdjuster(){ + free(overriddenFuncs); + } + void Fl_DerivedAdjuster::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Adjuster) this); + } + else { + Fl_Adjuster::draw(); + } + } + + void Fl_DerivedAdjuster::draw_super(){ + Fl_Adjuster::draw(); + } + + int Fl_DerivedAdjuster::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Adjuster) this,event); + } + else { + i = Fl_Adjuster::handle(event); + } + return i; + } + int Fl_DerivedAdjuster::handle_super(int event){ + return Fl_Adjuster::handle(event); + } + + void Fl_DerivedAdjuster::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Adjuster) this,x,y,w,h); + } + else { + Fl_Adjuster::resize(x,y,w,h); + } + } + + void Fl_DerivedAdjuster::resize_super(int x, int y, int w, int h){ + Fl_Adjuster::resize(x,y,w,h); + } + void Fl_DerivedAdjuster::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Adjuster) this); + } + else { + Fl_Adjuster::show(); + } + } + void Fl_DerivedAdjuster::show_super(){ + Fl_Adjuster::show(); + } + + void Fl_DerivedAdjuster::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Adjuster) this); + } + else { + Fl_Adjuster::hide(); + } + } + void Fl_DerivedAdjuster::hide_super(){ + Fl_Adjuster::hide(); + } + +#endif FL_EXPORT_C(fl_Group,Fl_Adjuster_parent)(fl_Adjuster adjuster){ return (static_cast(adjuster))->parent(); } @@ -152,12 +226,6 @@ EXPORT { FL_EXPORT_C(int,Fl_Adjuster_visible_r)(fl_Adjuster adjuster){ return (static_cast(adjuster))->visible_r(); } - FL_EXPORT_C(void,Fl_Adjuster_show)(fl_Adjuster adjuster){ - (static_cast(adjuster))->show(); - } - FL_EXPORT_C(void,Fl_Adjuster_hide)(fl_Adjuster adjuster){ - (static_cast(adjuster))->hide(); - } FL_EXPORT_C(void,Fl_Adjuster_set_visible)(fl_Adjuster adjuster){ (static_cast(adjuster))->visible(); } @@ -254,9 +322,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Adjuster_as_gl_window)(fl_Adjuster adjuster){ return (static_cast(adjuster))->as_gl_window(); } - FL_EXPORT_C(void,Fl_Adjuster_resize)(fl_Adjuster adjuster,int X,int Y,int W,int H){ - (static_cast(adjuster))->resize(X,Y,W,H); - } FL_EXPORT_C(void,Fl_Adjuster_bounds)(fl_Adjuster adjuster,double a,double b){ (static_cast(adjuster))->bounds(a,b); } @@ -308,14 +373,6 @@ EXPORT { FL_EXPORT_C(double,Fl_Adjuster_increment)(fl_Adjuster adjuster,double v,int n){ return (static_cast(adjuster))->increment(v,n); } - FL_EXPORT_C(fl_Adjuster,Fl_Adjuster_New_WithLabel)(int x,int y,int w,int h,const char* label){ - Fl_Adjuster* adjuster = new Fl_Adjuster(x,y,w,h,label); - return (fl_Adjuster) adjuster; - } - FL_EXPORT_C(fl_Adjuster,Fl_Adjuster_New)(int x,int y,int w,int h){ - Fl_Adjuster* adjuster = new Fl_Adjuster(x,y,w,h); - return (fl_Adjuster) adjuster; - } FL_EXPORT_C(void,Fl_Adjuster_Destroy)(fl_Adjuster adjuster){ delete (static_cast(adjuster)); } @@ -325,6 +382,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Adjuster_set_soft)(fl_Adjuster adjuster,int soft){ (static_cast(adjuster))->soft(soft); } + FL_EXPORT_C(fl_Adjuster, Fl_Adjuster_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedAdjuster* w = new Fl_DerivedAdjuster(X,Y,W,H,fs); + return (fl_Adjuster)w; + } + FL_EXPORT_C(fl_Adjuster, Fl_Adjuster_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedAdjuster* w = new Fl_DerivedAdjuster(X,Y,W,H,label,fs); + return (fl_Adjuster)w; + } + FL_EXPORT_C(fl_Adjuster, Fl_OverriddenAdjuster_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedAdjuster* w = new Fl_DerivedAdjuster(X,Y,W,H,fs); + return (fl_Adjuster)w; + } + FL_EXPORT_C(fl_Adjuster, Fl_OverriddenAdjuster_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedAdjuster* w = new Fl_DerivedAdjuster(X,Y,W,H,label,fs); + return (fl_Adjuster)w; + } + FL_EXPORT_C(void, Fl_Adjuster_draw)(fl_Adjuster o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Adjuster_draw_super)(fl_Adjuster o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Adjuster_handle)(fl_Adjuster o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Adjuster_handle_super)(fl_Adjuster o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Adjuster_resize)(fl_Adjuster o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Adjuster_resize_super)(fl_Adjuster o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Adjuster_show)(fl_Adjuster o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Adjuster_show_super)(fl_Adjuster o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Adjuster_hide)(fl_Adjuster o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Adjuster_hide_super)(fl_Adjuster o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } -#endif +#endif diff --git a/c-src/Fl_AdjusterC.h b/c-src/Fl_AdjusterC.h index 42ae3927..d37565fa 100644 --- a/c-src/Fl_AdjusterC.h +++ b/c-src/Fl_AdjusterC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Adjuster.H" #include "Fl_CallbackC.h" +#include "Fl_Types.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedAdjuster : public Fl_Adjuster { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedAdjuster(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedAdjuster(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedAdjuster(); + }; #endif FL_EXPORT_C(fl_Group, Fl_Adjuster_parent)(fl_Adjuster adjuster); FL_EXPORT_C(void, Fl_Adjuster_set_parent)(fl_Adjuster adjuster, fl_Group grp); @@ -57,8 +77,6 @@ EXPORT { FL_EXPORT_C(void, Fl_Adjuster_set_when)(fl_Adjuster adjuster, uchar i); FL_EXPORT_C(unsigned int, Fl_Adjuster_visible)(fl_Adjuster adjuster); FL_EXPORT_C(int, Fl_Adjuster_visible_r)(fl_Adjuster adjuster); - FL_EXPORT_C(void, Fl_Adjuster_show)(fl_Adjuster adjuster); - FL_EXPORT_C(void, Fl_Adjuster_hide)(fl_Adjuster adjuster); FL_EXPORT_C(void, Fl_Adjuster_set_visible)(fl_Adjuster adjuster); FL_EXPORT_C(void, Fl_Adjuster_clear_visible)(fl_Adjuster adjuster); FL_EXPORT_C(unsigned int, Fl_Adjuster_active)(fl_Adjuster adjuster); @@ -91,7 +109,6 @@ EXPORT { FL_EXPORT_C(fl_Window, Fl_Adjuster_top_window)(fl_Adjuster adjuster); FL_EXPORT_C(fl_Window , Fl_Adjuster_top_window_offset)(fl_Adjuster adjuster, int* xoff, int* yoff); FL_EXPORT_C(fl_Gl_Window, Fl_Adjuster_as_gl_window)(fl_Adjuster adjuster); - FL_EXPORT_C(void, Fl_Adjuster_resize)(fl_Table table,int X, int Y, int W, int H); /* Inherited from Fl_Valuator */ FL_EXPORT_C(void, Fl_Adjuster_bounds)(fl_Adjuster adjuster, double a, double b); @@ -118,6 +135,20 @@ EXPORT { FL_EXPORT_C(void, Fl_Adjuster_Destroy)(fl_Adjuster adjuster); FL_EXPORT_C(int, Fl_Adjuster_soft)(fl_Adjuster adjuster); FL_EXPORT_C(void, Fl_Adjuster_set_soft)(fl_Adjuster adjuster, int soft); + + FL_EXPORT_C(fl_Adjuster, Fl_OverriddenAdjuster_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Adjuster, Fl_OverriddenAdjuster_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Adjuster_draw)(fl_Adjuster o); + FL_EXPORT_C(void, Fl_Adjuster_draw_super)(fl_Adjuster o); + FL_EXPORT_C(int, Fl_Adjuster_handle)(fl_Adjuster o, int event); + FL_EXPORT_C(int, Fl_Adjuster_handle_super)(fl_Adjuster o, int event); + FL_EXPORT_C(void, Fl_Adjuster_resize)(fl_Adjuster o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Adjuster_resize_super)(fl_Adjuster o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Adjuster_show)(fl_Adjuster o); + FL_EXPORT_C(void, Fl_Adjuster_show_super)(fl_Adjuster o); + FL_EXPORT_C(void, Fl_Adjuster_hide)(fl_Adjuster o); + FL_EXPORT_C(void, Fl_Adjuster_hide_super)(fl_Adjuster o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_CallbackC.h b/c-src/Fl_CallbackC.h index a8079894..04eeab6c 100644 --- a/c-src/Fl_CallbackC.h +++ b/c-src/Fl_CallbackC.h @@ -15,6 +15,7 @@ #include #include #include + /** Pass a C callback function to an Fl_Window */ diff --git a/c-src/Fl_Check_ButtonC.cpp b/c-src/Fl_Check_ButtonC.cpp index c96a47c3..4295aadf 100644 --- a/c-src/Fl_Check_ButtonC.cpp +++ b/c-src/Fl_Check_ButtonC.cpp @@ -2,10 +2,82 @@ #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Check_Button_handle)(fl_Check_Button self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedCheck_Button::Fl_DerivedCheck_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Check_Button(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedCheck_Button::Fl_DerivedCheck_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Check_Button(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedCheck_Button::~Fl_DerivedCheck_Button(){ + free(overriddenFuncs); + } + void Fl_DerivedCheck_Button::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Check_Button) this); + } + else { + Fl_Check_Button::draw(); + } + } + + void Fl_DerivedCheck_Button::draw_super(){ + Fl_Check_Button::draw(); + } + + int Fl_DerivedCheck_Button::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Check_Button) this,event); + } + else { + i = Fl_Check_Button::handle(event); + } + return i; + } + int Fl_DerivedCheck_Button::handle_super(int event){ + return Fl_Check_Button::handle(event); + } + + void Fl_DerivedCheck_Button::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Check_Button) this,x,y,w,h); + } + else { + Fl_Check_Button::resize(x,y,w,h); + } + } + + void Fl_DerivedCheck_Button::resize_super(int x, int y, int w, int h){ + Fl_Check_Button::resize(x,y,w,h); + } + void Fl_DerivedCheck_Button::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Check_Button) this); + } + else { + Fl_Check_Button::show(); + } + } + void Fl_DerivedCheck_Button::show_super(){ + Fl_Check_Button::show(); } + + void Fl_DerivedCheck_Button::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Check_Button) this); + } + else { + Fl_Check_Button::hide(); + } + } + void Fl_DerivedCheck_Button::hide_super(){ + Fl_Check_Button::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Check_Button_parent)(fl_Check_Button b){ return (fl_Group) (static_cast(b))->parent(); } @@ -251,14 +323,6 @@ EXPORT { (static_cast(b))->measure_label(*ww,*hh); } - FL_EXPORT_C(fl_Check_Button, Fl_Check_Button_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Check_Button* button = new Fl_Check_Button(x,y,w,h,label); - return (static_cast(button)); - } - FL_EXPORT_C(fl_Check_Button, Fl_Check_Button_New)(int x, int y, int w, int h) { - Fl_Check_Button* button = new Fl_Check_Button(x,y,w,h,0); - return (fl_Check_Button)button; - } FL_EXPORT_C(void,Fl_Check_Button_Destroy)(fl_Check_Button button){ delete (static_cast(button)); } @@ -292,6 +356,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Check_Button_set_down_color)(fl_Check_Button b,Fl_Color c){ (static_cast(b))->down_color(c); } + FL_EXPORT_C(fl_Check_Button, Fl_Check_Button_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedCheck_Button* w = new Fl_DerivedCheck_Button(X,Y,W,H,fs); + return (fl_Check_Button)w; + } + FL_EXPORT_C(fl_Check_Button, Fl_Check_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedCheck_Button* w = new Fl_DerivedCheck_Button(X,Y,W,H,label,fs); + return (fl_Check_Button)w; + } + FL_EXPORT_C(fl_Check_Button, Fl_OverriddenCheck_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedCheck_Button* w = new Fl_DerivedCheck_Button(X,Y,W,H,fs); + return (fl_Check_Button)w; + } + FL_EXPORT_C(fl_Check_Button, Fl_OverriddenCheck_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedCheck_Button* w = new Fl_DerivedCheck_Button(X,Y,W,H,label,fs); + return (fl_Check_Button)w; + } + FL_EXPORT_C(void, Fl_Check_Button_draw)(fl_Check_Button o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Check_Button_draw_super)(fl_Check_Button o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Check_Button_handle)(fl_Check_Button o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Check_Button_handle_super)(fl_Check_Button o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Check_Button_resize)(fl_Check_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Check_Button_resize_super)(fl_Check_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Check_Button_show)(fl_Check_Button o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Check_Button_show_super)(fl_Check_Button o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Check_Button_hide)(fl_Check_Button o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Check_Button_hide_super)(fl_Check_Button o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Check_ButtonC.h b/c-src/Fl_Check_ButtonC.h index e713e9ad..38344b4d 100644 --- a/c-src/Fl_Check_ButtonC.h +++ b/c-src/Fl_Check_ButtonC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Check_Button.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedCheck_Button : public Fl_Check_Button { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedCheck_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedCheck_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedCheck_Button(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Check_Button_handle)(fl_Check_Button self, int event); @@ -93,7 +112,7 @@ EXPORT { FL_EXPORT_C(fl_Check_Button, Fl_Check_Button_New_WithLabel)(int x, int y, int w, int h, const char* label); FL_EXPORT_C(fl_Check_Button, Fl_Check_Button_New)(int x, int y, int w, int h); FL_EXPORT_C(void, Fl_Check_Button_Destroy)(fl_Check_Button button); - + FL_EXPORT_C(char , Fl_Check_Button_value)(fl_Check_Button b); FL_EXPORT_C(int , Fl_Check_Button_set_value)(fl_Check_Button b, int v); FL_EXPORT_C(int , Fl_Check_Button_set)(fl_Check_Button b); @@ -105,6 +124,19 @@ EXPORT { FL_EXPORT_C(void , Fl_Check_Button_set_down_box)(fl_Check_Button b,Fl_Boxtype boxtype); FL_EXPORT_C(Fl_Color , Fl_Check_Button_down_color )(fl_Check_Button b); FL_EXPORT_C(void , Fl_Check_Button_set_down_color)(fl_Check_Button b, Fl_Color c); + FL_EXPORT_C(fl_Check_Button, Fl_OverriddenCheck_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Check_Button, Fl_OverriddenCheck_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Check_Button_draw)(fl_Check_Button o); + FL_EXPORT_C(void, Fl_Check_Button_draw_super)(fl_Check_Button o); + FL_EXPORT_C(int, Fl_Check_Button_handle)(fl_Check_Button o, int event); + FL_EXPORT_C(int, Fl_Check_Button_handle_super)(fl_Check_Button o, int event); + FL_EXPORT_C(void, Fl_Check_Button_resize)(fl_Check_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Check_Button_resize_super)(fl_Check_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Check_Button_show)(fl_Check_Button o); + FL_EXPORT_C(void, Fl_Check_Button_show_super)(fl_Check_Button o); + FL_EXPORT_C(void, Fl_Check_Button_hide)(fl_Check_Button o); + FL_EXPORT_C(void, Fl_Check_Button_hide_super)(fl_Check_Button o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ChoiceC.cpp b/c-src/Fl_ChoiceC.cpp index 671e40d5..21752bab 100644 --- a/c-src/Fl_ChoiceC.cpp +++ b/c-src/Fl_ChoiceC.cpp @@ -2,28 +2,82 @@ #include "UtilsC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Choice_handle )(fl_Choice choice, int event){ - return (static_cast(choice))->handle(event); + Fl_DerivedChoice::Fl_DerivedChoice(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Choice(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedChoice::Fl_DerivedChoice(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Choice(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedChoice::~Fl_DerivedChoice(){ + free(overriddenFuncs); + } + void Fl_DerivedChoice::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Choice) this); + } + else { + Fl_Choice::draw(); + } + } + + void Fl_DerivedChoice::draw_super(){ + Fl_Choice::draw(); } - FL_EXPORT_C(void,Fl_Choice_resize_super )(fl_Choice choice,int x, int y, int w, int h){ - (static_cast(choice))->resize(x,y,w,h); + + int Fl_DerivedChoice::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Choice) this,event); + } + else { + i = Fl_Choice::handle(event); + } + return i; } - FL_EXPORT_C(void,Fl_Choice_resize )(fl_Choice choice,int x, int y, int w, int h){ - (static_cast(choice))->resize(x,y,w,h); + int Fl_DerivedChoice::handle_super(int event){ + return Fl_Choice::handle(event); } - FL_EXPORT_C(void,Fl_Choice_show_super)(fl_Choice choice){ - (static_cast(choice))->show(); + + void Fl_DerivedChoice::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Choice) this,x,y,w,h); + } + else { + Fl_Choice::resize(x,y,w,h); + } } - FL_EXPORT_C(void,Fl_Choice_show )(fl_Choice choice){ - (static_cast(choice))->show(); + + void Fl_DerivedChoice::resize_super(int x, int y, int w, int h){ + Fl_Choice::resize(x,y,w,h); } - FL_EXPORT_C(void,Fl_Choice_hide_super)(fl_Choice choice){ - (static_cast(choice))->hide(); + void Fl_DerivedChoice::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Choice) this); + } + else { + Fl_Choice::show(); + } } - FL_EXPORT_C(void,Fl_Choice_hide )(fl_Choice choice){ - (static_cast(choice))->hide(); + void Fl_DerivedChoice::show_super(){ + Fl_Choice::show(); } + + void Fl_DerivedChoice::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Choice) this); + } + else { + Fl_Choice::hide(); + } + } + void Fl_DerivedChoice::hide_super(){ + Fl_Choice::hide(); + } + + +#endif FL_EXPORT_C(fl_Window,Fl_Choice_as_window_super)(fl_Choice choice){ return (static_cast(choice))->as_window(); } @@ -273,14 +327,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Choice_measure_label)(fl_Choice choice,int* ww,int* hh){ (static_cast(choice))->measure_label(*ww,*hh); } - FL_EXPORT_C(fl_Choice, Fl_Choice_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Choice* choice = new Fl_Choice(x,y,w,h,label); - return (static_cast(choice)); - } - FL_EXPORT_C(fl_Choice, Fl_Choice_New)(int x, int y, int w, int h) { - Fl_Choice* choice = new Fl_Choice(x,y,w,h); - return (static_cast(choice)); - } FL_EXPORT_C(void, Fl_Choice_Destroy)(fl_Choice choice) { delete (static_cast(choice)); } @@ -439,6 +485,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Choice_set_down_color)(fl_Choice choice,unsigned c){ (static_cast(choice))->down_color(c); } + FL_EXPORT_C(fl_Choice, Fl_Choice_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedChoice* w = new Fl_DerivedChoice(X,Y,W,H,fs); + return (fl_Choice)w; + } + FL_EXPORT_C(fl_Choice, Fl_Choice_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedChoice* w = new Fl_DerivedChoice(X,Y,W,H,label,fs); + return (fl_Choice)w; + } + FL_EXPORT_C(fl_Choice, Fl_OverriddenChoice_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedChoice* w = new Fl_DerivedChoice(X,Y,W,H,fs); + return (fl_Choice)w; + } + FL_EXPORT_C(fl_Choice, Fl_OverriddenChoice_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedChoice* w = new Fl_DerivedChoice(X,Y,W,H,label,fs); + return (fl_Choice)w; + } + FL_EXPORT_C(void, Fl_Choice_draw)(fl_Choice o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Choice_draw_super)(fl_Choice o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Choice_handle)(fl_Choice o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Choice_handle_super)(fl_Choice o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Choice_resize)(fl_Choice o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Choice_resize_super)(fl_Choice o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Choice_show)(fl_Choice o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Choice_show_super)(fl_Choice o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Choice_hide)(fl_Choice o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Choice_hide_super)(fl_Choice o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ChoiceC.h b/c-src/Fl_ChoiceC.h index 7632509c..ef3826d2 100644 --- a/c-src/Fl_ChoiceC.h +++ b/c-src/Fl_ChoiceC.h @@ -8,10 +8,28 @@ #include "FL/Fl_Choice.H" #include "Fl_CallbackC.h" #include "Fl_Menu_C.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedChoice : public Fl_Choice { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedChoice(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedChoice(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedChoice(); + }; #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int, Fl_Choice_handle)(fl_Group self, int event); FL_EXPORT_C(fl_Group, Fl_Choice_parent)(fl_Choice choice); FL_EXPORT_C(void, Fl_Choice_set_parent)(fl_Choice choice, fl_Group grp); FL_EXPORT_C(uchar, Fl_Choice_type)(fl_Choice choice); @@ -60,10 +78,6 @@ EXPORT { FL_EXPORT_C(void, Fl_Choice_set_when)(fl_Choice choice, uchar i); FL_EXPORT_C(unsigned int, Fl_Choice_visible)(fl_Choice choice); FL_EXPORT_C(int, Fl_Choice_visible_r)(fl_Choice choice); - FL_EXPORT_C(void, Fl_Choice_show_super)(fl_Choice choice); - FL_EXPORT_C(void, Fl_Choice_show)(fl_Choice choice); - FL_EXPORT_C(void, Fl_Choice_hide_super)(fl_Choice choice); - FL_EXPORT_C(void, Fl_Choice_hide)(fl_Choice choice); FL_EXPORT_C(void, Fl_Choice_set_visible)(fl_Choice choice); FL_EXPORT_C(void, Fl_Choice_clear_visible)(fl_Choice choice); FL_EXPORT_C(unsigned int, Fl_Choice_active)(fl_Choice choice); @@ -105,7 +119,7 @@ EXPORT { FL_EXPORT_C(void, Fl_Choice_resize_super)(fl_Choice choice,int X, int Y, int W, int H); FL_EXPORT_C(void, Fl_Choice_resize)(fl_Choice choice,int X, int Y, int W, int H); - /* Fl_Choice specific */ + /* Fl_Choice specific */ FL_EXPORT_C(fl_Choice, Fl_Choice_New_WithLabel)(int x, int y, int w, int h, const char* label); FL_EXPORT_C(fl_Choice , Fl_Choice_New)(int x, int y, int w, int h); FL_EXPORT_C(void, Fl_Choice_Destroy)(fl_Choice choice); @@ -142,18 +156,18 @@ EXPORT { FL_EXPORT_C(int, Fl_Choice_add_with_shortcutname_user_data_flags)(fl_Choice choice, char* name, char* shortcut, fl_Callback* cb, void* user_data, int flags); FL_EXPORT_C(int, Fl_Choice_add_with_name)(fl_Choice choice, char* name); FL_EXPORT_C(int , Fl_Choice_size)(fl_Choice choice); - FL_EXPORT_C(void, Fl_Choice_set_size)(fl_Choice choice, int W, int H); + FL_EXPORT_C(void, Fl_Choice_set_size)(fl_Choice choice, int W, int H); FL_EXPORT_C(void, Fl_Choice_clear)(fl_Choice choice); FL_EXPORT_C(int, Fl_Choice_clear_submenu)(fl_Choice choice, int index); FL_EXPORT_C(void, Fl_Choice_replace)(fl_Choice choice, int, char* name); FL_EXPORT_C(void, Fl_Choice_remove)(fl_Choice choice, int); - FL_EXPORT_C(void, Fl_Choice_shortcut)(fl_Choice choice, int i, int s); - FL_EXPORT_C(void, Fl_Choice_set_mode)(fl_Choice choice, int i,int fl); - FL_EXPORT_C(int , Fl_Choice_mode)(fl_Choice choice, int i); + FL_EXPORT_C(void, Fl_Choice_shortcut)(fl_Choice choice, int i, int s); + FL_EXPORT_C(void, Fl_Choice_set_mode)(fl_Choice choice, int i,int fl); + FL_EXPORT_C(int , Fl_Choice_mode)(fl_Choice choice, int i); FL_EXPORT_C(fl_Menu_Item, Fl_Choice_mvalue)(fl_Choice choice); FL_EXPORT_C(int, Fl_Choice_value)(fl_Choice choice); FL_EXPORT_C(int, Fl_Choice_set_value_with_item)(fl_Choice choice, fl_Menu_Item item); - FL_EXPORT_C(int, Fl_Choice_set_value_with_index)(fl_Choice choice, int index); + FL_EXPORT_C(int, Fl_Choice_set_value_with_index)(fl_Choice choice, int index); FL_EXPORT_C(char*, Fl_Choice_text)(fl_Choice choice); FL_EXPORT_C(char*, Fl_Choice_text_with_index)(fl_Choice choice, int i); FL_EXPORT_C(Fl_Font, Fl_Choice_textfont)(fl_Choice choice); @@ -166,6 +180,19 @@ EXPORT { FL_EXPORT_C(void, Fl_Choice_set_down_box)(fl_Choice choice, Fl_Boxtype b); FL_EXPORT_C(Fl_Color, Fl_Choice_down_color)(fl_Choice choice); FL_EXPORT_C(void, Fl_Choice_set_down_color)(fl_Choice choice, unsigned c); + FL_EXPORT_C(fl_Choice, Fl_OverriddenChoice_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Choice, Fl_OverriddenChoice_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Choice_draw)(fl_Choice o); + FL_EXPORT_C(void, Fl_Choice_draw_super)(fl_Choice o); + FL_EXPORT_C(int, Fl_Choice_handle)(fl_Choice o, int event); + FL_EXPORT_C(int, Fl_Choice_handle_super)(fl_Choice o, int event); + FL_EXPORT_C(void, Fl_Choice_resize)(fl_Choice o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Choice_resize_super)(fl_Choice o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Choice_show)(fl_Choice o); + FL_EXPORT_C(void, Fl_Choice_show_super)(fl_Choice o); + FL_EXPORT_C(void, Fl_Choice_hide)(fl_Choice o); + FL_EXPORT_C(void, Fl_Choice_hide_super)(fl_Choice o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ClockC.cpp b/c-src/Fl_ClockC.cpp index 3f32c2e8..c7cf2031 100644 --- a/c-src/Fl_ClockC.cpp +++ b/c-src/Fl_ClockC.cpp @@ -1,11 +1,82 @@ #include "Fl_ClockC.h" - #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Clock_handle)(fl_Clock self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedClock::Fl_DerivedClock(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Clock(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedClock::Fl_DerivedClock(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Clock(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedClock::~Fl_DerivedClock(){ + free(overriddenFuncs); + } + void Fl_DerivedClock::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Clock) this); + } + else { + Fl_Clock::draw(); + } + } + + void Fl_DerivedClock::draw_super(){ + Fl_Clock::draw(); + } + + int Fl_DerivedClock::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Clock) this,event); + } + else { + i = Fl_Clock::handle(event); + } + return i; + } + int Fl_DerivedClock::handle_super(int event){ + return Fl_Clock::handle(event); + } + + void Fl_DerivedClock::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Clock) this,x,y,w,h); + } + else { + Fl_Clock::resize(x,y,w,h); + } + } + + void Fl_DerivedClock::resize_super(int x, int y, int w, int h){ + Fl_Clock::resize(x,y,w,h); + } + void Fl_DerivedClock::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Clock) this); + } + else { + Fl_Clock::show(); + } } + void Fl_DerivedClock::show_super(){ + Fl_Clock::show(); + } + + void Fl_DerivedClock::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Clock) this); + } + else { + Fl_Clock::hide(); + } + } + void Fl_DerivedClock::hide_super(){ + Fl_Clock::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Clock_parent)(fl_Clock b){ return (fl_Group) (static_cast(b))->parent(); } @@ -266,14 +337,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Clock_as_gl_window)(fl_Clock clock){ return (fl_Gl_Window) (static_cast(clock))->as_gl_window(); } - FL_EXPORT_C(fl_Clock, Fl_Clock_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Clock* clock = new Fl_Clock(x,y,w,h,label); - return (static_cast(clock)); - } - FL_EXPORT_C(fl_Clock, Fl_Clock_New)(int x, int y, int w, int h) { - Fl_Clock* clock = new Fl_Clock(x,y,w,h,0); - return (fl_Clock)clock; - } FL_EXPORT_C(fl_Clock, Fl_Clock_New_WithClockType)(uchar t, int x, int y, int w, int h, const char* label) { Fl_Clock* clock = new Fl_Clock(t,x,y,w,h,label); return (fl_Clock)clock; @@ -299,6 +362,54 @@ EXPORT { FL_EXPORT_C(int,Fl_Clock_second)(fl_Clock clock){ return (static_cast(clock))->second(); } + FL_EXPORT_C(void, Fl_Clock_draw)(fl_Clock o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Clock_draw_super)(fl_Clock o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Clock_handle)(fl_Clock o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Clock_handle_super)(fl_Clock o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Clock_resize)(fl_Clock o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Clock_resize_super)(fl_Clock o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Clock_show)(fl_Clock o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Clock_show_super)(fl_Clock o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Clock_hide)(fl_Clock o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Clock_hide_super)(fl_Clock o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Clock, Fl_Clock_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedClock* w = new Fl_DerivedClock(X,Y,W,H,fs); + return (fl_Clock)w; + } + FL_EXPORT_C(fl_Clock, Fl_Clock_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedClock* w = new Fl_DerivedClock(X,Y,W,H,label,fs); + return (fl_Clock)w; + } + FL_EXPORT_C(fl_Clock, Fl_OverriddenClock_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedClock* w = new Fl_DerivedClock(X,Y,W,H,fs); + return (fl_Clock)w; + } + FL_EXPORT_C(fl_Clock, Fl_OverriddenClock_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedClock* w = new Fl_DerivedClock(X,Y,W,H,label,fs); + return (fl_Clock)w; + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ClockC.h b/c-src/Fl_ClockC.h index b70779c7..68d38c30 100644 --- a/c-src/Fl_ClockC.h +++ b/c-src/Fl_ClockC.h @@ -7,14 +7,33 @@ #include "FL/Fl.H" #include "FL/Fl_Clock.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedClock : public Fl_Clock { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedClock(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedClock(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedClock(); + }; + #endif #define FL_SQUARE_CLOCK 0 #define FL_ROUND_CLOCK 1 #define FL_ANALOG_CLOCK FL_SQUARE_CLOCK #define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /* Inherited from Fl_Widget */ - FL_EXPORT_C(int,Fl_Clock_handle)(fl_Clock self, int event); FL_EXPORT_C(fl_Group, Fl_Clock_parent)(fl_Clock clock); FL_EXPORT_C(void, Fl_Clock_set_parent)(fl_Clock clock, fl_Group grp); FL_EXPORT_C(uchar, Fl_Clock_type)(fl_Clock clock); @@ -107,6 +126,19 @@ EXPORT { FL_EXPORT_C(int, Fl_Clock_hour)(fl_Clock clock); FL_EXPORT_C(int, Fl_Clock_minute)(fl_Clock clock); FL_EXPORT_C(int, Fl_Clock_second)(fl_Clock clock); + FL_EXPORT_C(fl_Clock, Fl_OverriddenClock_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Clock, Fl_OverriddenClock_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Clock_draw)(fl_Clock o); + FL_EXPORT_C(void, Fl_Clock_draw_super)(fl_Clock o); + FL_EXPORT_C(int, Fl_Clock_handle)(fl_Clock o, int event); + FL_EXPORT_C(int, Fl_Clock_handle_super)(fl_Clock o, int event); + FL_EXPORT_C(void, Fl_Clock_resize)(fl_Clock o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Clock_resize_super)(fl_Clock o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Clock_show)(fl_Clock o); + FL_EXPORT_C(void, Fl_Clock_show_super)(fl_Clock o); + FL_EXPORT_C(void, Fl_Clock_hide)(fl_Clock o); + FL_EXPORT_C(void, Fl_Clock_hide_super)(fl_Clock o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Color_ChooserC.cpp b/c-src/Fl_Color_ChooserC.cpp index 1a37262d..0660e2fd 100644 --- a/c-src/Fl_Color_ChooserC.cpp +++ b/c-src/Fl_Color_ChooserC.cpp @@ -467,37 +467,33 @@ EXPORT { FL_EXPORT_C(int, flc_color_chooser_with_uchar_m)(const char* name, uchar* r, uchar* g, uchar* b, int m){ return fl_color_chooser(name,*r,*g,*b,m); } - FL_EXPORT_C(void, Fl_Color_Chooser_draw)(fl_Color_Chooser w){ - (static_cast(w))->draw(); + FL_EXPORT_C(void, Fl_Color_Chooser_draw)(fl_Color_Chooser o){ + (static_cast(o))->draw(); } - FL_EXPORT_C(void, Fl_Color_Chooser_draw_super)(fl_Color_Chooser w){ - (static_cast(w))->draw(); + FL_EXPORT_C(void, Fl_Color_Chooser_draw_super)(fl_Color_Chooser o){ + (static_cast(o))->draw_super(); } - FL_EXPORT_C(int, Fl_Color_Chooser_handle)(fl_Color_Chooser w, int event){ - return (static_cast(w))->handle(event); + FL_EXPORT_C(int, Fl_Color_Chooser_handle_super)(fl_Color_Chooser o, int event){ + return (static_cast(o))->handle_super(event); } - FL_EXPORT_C(int, Fl_Color_Chooser_handle_super)(fl_Color_Chooser w, int event){ - return (static_cast(w))->handle(event); + FL_EXPORT_C(void, Fl_Color_Chooser_resize)(fl_Color_Chooser o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); } - FL_EXPORT_C(void, Fl_Color_Chooser_resize)(fl_Color_Chooser w, int x, int y, int w, int h){ - (static_cast(w))->resize(x,y,w,h); + FL_EXPORT_C(void, Fl_Color_Chooser_resize_super)(fl_Color_Chooser o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); } - FL_EXPORT_C(void, Fl_Color_Chooser_resize_super)(fl_Color_Chooser w, int x, int y, int w, int h){ - (static_cast(w))->resize(x,y,w,h); + FL_EXPORT_C(void, Fl_Color_Chooser_show)(fl_Color_Chooser o){ + (static_cast(o))->show(); } - FL_EXPORT_C(void, Fl_Color_Chooser_show)(fl_Color_Chooser w){ - (static_cast(w))->show(); + FL_EXPORT_C(void, Fl_Color_Chooser_show_super)(fl_Color_Chooser o){ + (static_cast(o))->show_super(); } - FL_EXPORT_C(void, Fl_Color_Chooser_show_super)(fl_Color_Chooser w){ - (static_cast(w))->show(); + FL_EXPORT_C(void, Fl_Color_Chooser_hide)(fl_Color_Chooser o){ + (static_cast(o))->hide(); } - FL_EXPORT_C(void, Fl_Color_Chooser_hide)(fl_Color_Chooser w){ - (static_cast(w))->hide(); + FL_EXPORT_C(void, Fl_Color_Chooser_hide_super)(fl_Color_Chooser o){ + (static_cast(o))->hide_super(); } - FL_EXPORT_C(void, Fl_Color_Chooser_hide_super)(fl_Color_Chooser w){ - (static_cast(w))->hide(); - } - #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Color_ChooserC.h b/c-src/Fl_Color_ChooserC.h index 0d48282b..6e7846b0 100644 --- a/c-src/Fl_Color_ChooserC.h +++ b/c-src/Fl_Color_ChooserC.h @@ -166,17 +166,17 @@ EXPORT { FL_EXPORT_C(int, flc_color_chooser_with_m)(const char* name, double* r, double* g, double* b, int m); FL_EXPORT_C(int, flc_color_chooser_with_uchar)(const char* name, uchar* r, uchar* g, uchar* b); FL_EXPORT_C(int, flc_color_chooser_with_uchar_m)(const char* name, uchar* r, uchar* g, uchar* b, int m); + FL_EXPORT_C(void, Fl_Color_Chooser_draw)(fl_Color_Chooser o); + FL_EXPORT_C(void, Fl_Color_Chooser_draw_super)(fl_Color_Chooser o); + FL_EXPORT_C(int, Fl_Color_Chooser_handle)(fl_Color_Chooser o, int event); + FL_EXPORT_C(int, Fl_Color_Chooser_handle_super)(fl_Color_Chooser o, int event); + FL_EXPORT_C(void, Fl_Color_Chooser_resize)(fl_Color_Chooser o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Color_Chooser_resize_super)(fl_Color_Chooser o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Color_Chooser_show)(fl_Color_Chooser o); + FL_EXPORT_C(void, Fl_Color_Chooser_show_super)(fl_Color_Chooser o); + FL_EXPORT_C(void, Fl_Color_Chooser_hide)(fl_Color_Chooser o); + FL_EXPORT_C(void, Fl_Color_Chooser_hide_super)(fl_Color_Chooser o); - FL_EXPORT_C(void, Fl_Color_Chooser_draw)(fl_Color_Chooser w); - FL_EXPORT_C(void, Fl_Color_Chooser_draw_super)(fl_Color_Chooser w); - FL_EXPORT_C(int, Fl_Color_Chooser_handle)(fl_Color_Chooser w, int event); - FL_EXPORT_C(int, Fl_Color_Chooser_handle_super)(fl_Color_Chooser w, int event); - FL_EXPORT_C(void, Fl_Color_Chooser_resize)(fl_Color_Chooser w, int x, int y, int w, int h); - FL_EXPORT_C(void, Fl_Color_Chooser_resize_super)(fl_Color_Chooser w, int x, int y, int w, int h); - FL_EXPORT_C(void, Fl_Color_Chooser_show)(fl_Color_Chooser w); - FL_EXPORT_C(void, Fl_Color_Chooser_show_super)(fl_Color_Chooser w); - FL_EXPORT_C(void, Fl_Color_Chooser_hide)(fl_Color_Chooser w); - FL_EXPORT_C(void, Fl_Color_Chooser_hide_super)(fl_Color_Chooser w); #ifdef __cplusplus } diff --git a/c-src/Fl_CounterC.cpp b/c-src/Fl_CounterC.cpp index 79bfaaa6..6324c3ed 100644 --- a/c-src/Fl_CounterC.cpp +++ b/c-src/Fl_CounterC.cpp @@ -1,7 +1,82 @@ #include "Fl_CounterC.h" #ifdef __cplusplus EXPORT { -#endif + Fl_DerivedCounter::Fl_DerivedCounter(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Counter(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedCounter::Fl_DerivedCounter(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Counter(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedCounter::~Fl_DerivedCounter(){ + free(overriddenFuncs); + } + void Fl_DerivedCounter::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Counter) this); + } + else { + Fl_Counter::draw(); + } + } + + void Fl_DerivedCounter::draw_super(){ + Fl_Counter::draw(); + } + + int Fl_DerivedCounter::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Counter) this,event); + } + else { + i = Fl_Counter::handle(event); + } + return i; + } + int Fl_DerivedCounter::handle_super(int event){ + return Fl_Counter::handle(event); + } + + void Fl_DerivedCounter::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Counter) this,x,y,w,h); + } + else { + Fl_Counter::resize(x,y,w,h); + } + } + + void Fl_DerivedCounter::resize_super(int x, int y, int w, int h){ + Fl_Counter::resize(x,y,w,h); + } + void Fl_DerivedCounter::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Counter) this); + } + else { + Fl_Counter::show(); + } + } + void Fl_DerivedCounter::show_super(){ + Fl_Counter::show(); + } + + void Fl_DerivedCounter::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Counter) this); + } + else { + Fl_Counter::hide(); + } + } + void Fl_DerivedCounter::hide_super(){ + Fl_Counter::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Counter_parent)(fl_Counter counter){ return (static_cast(counter))->parent(); } @@ -152,12 +227,6 @@ EXPORT { FL_EXPORT_C(int,Fl_Counter_visible_r)(fl_Counter counter){ return (static_cast(counter))->visible_r(); } - FL_EXPORT_C(void,Fl_Counter_show)(fl_Counter counter){ - (static_cast(counter))->show(); - } - FL_EXPORT_C(void,Fl_Counter_hide)(fl_Counter counter){ - (static_cast(counter))->hide(); - } FL_EXPORT_C(void,Fl_Counter_set_visible)(fl_Counter counter){ (static_cast(counter))->visible(); } @@ -254,9 +323,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Counter_as_gl_window)(fl_Counter counter){ return (static_cast(counter))->as_gl_window(); } - FL_EXPORT_C(void,Fl_Counter_resize)(fl_Counter counter,int X,int Y,int W,int H){ - (static_cast(counter))->resize(X,Y,W,H); - } FL_EXPORT_C(void,Fl_Counter_bounds)(fl_Counter counter,double a,double b){ (static_cast(counter))->bounds(a,b); } @@ -308,14 +374,6 @@ EXPORT { FL_EXPORT_C(double,Fl_Counter_increment)(fl_Counter counter,double v,int n){ return (static_cast(counter))->increment(v,n); } - FL_EXPORT_C(fl_Counter,Fl_Counter_New_WithLabel)(int x,int y,int w,int h,const char* label){ - Fl_Counter* counter = new Fl_Counter(x,y,w,h,label); - return (fl_Counter) counter; - } - FL_EXPORT_C(fl_Counter,Fl_Counter_New)(int x,int y,int w,int h){ - Fl_Counter* counter = new Fl_Counter(x,y,w,h); - return (fl_Counter) counter; - } FL_EXPORT_C(fl_Simple_Counter,Fl_Simple_Counter_New_WithLabel)(int x,int y,int w,int h,const char* label){ Fl_Simple_Counter* simple_counter = new Fl_Simple_Counter(x,y,w,h,label); return (fl_Simple_Counter) simple_counter; @@ -345,12 +403,57 @@ EXPORT { FL_EXPORT_C(Fl_Color,Fl_Counter_textcolor)(fl_Counter counter){ return (static_cast(counter))->textcolor(); } - FL_EXPORT_C(int,Fl_Counter_handle)(fl_Counter counter,int event){ - return (static_cast(counter))->handle(event); - } FL_EXPORT_C(void,Fl_Counter_lstep)(fl_Counter counter,double lstep){ (static_cast(counter))->lstep(lstep); } + FL_EXPORT_C(void, Fl_Counter_draw)(fl_Counter o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Counter_draw_super)(fl_Counter o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Counter_handle)(fl_Counter o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Counter_handle_super)(fl_Counter o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Counter_resize)(fl_Counter o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Counter_resize_super)(fl_Counter o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Counter_show)(fl_Counter o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Counter_show_super)(fl_Counter o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Counter_hide)(fl_Counter o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Counter_hide_super)(fl_Counter o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Counter, Fl_Counter_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedCounter* w = new Fl_DerivedCounter(X,Y,W,H,fs); + return (fl_Counter)w; + } + FL_EXPORT_C(fl_Counter, Fl_Counter_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedCounter* w = new Fl_DerivedCounter(X,Y,W,H,label,fs); + return (fl_Counter)w; + } + FL_EXPORT_C(fl_Counter, Fl_OverriddenCounter_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedCounter* w = new Fl_DerivedCounter(X,Y,W,H,fs); + return (fl_Counter)w; + } + FL_EXPORT_C(fl_Counter, Fl_OverriddenCounter_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedCounter* w = new Fl_DerivedCounter(X,Y,W,H,label,fs); + return (fl_Counter)w; + } #ifdef __cplusplus } -#endif +#endif diff --git a/c-src/Fl_CounterC.h b/c-src/Fl_CounterC.h index a1a60542..8392d579 100644 --- a/c-src/Fl_CounterC.h +++ b/c-src/Fl_CounterC.h @@ -8,7 +8,26 @@ #include "FL/Fl_Counter.H" #include "FL/Fl_Simple_Counter.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedCounter : public Fl_Counter { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedCounter(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedCounter(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedCounter(); + }; #endif #ifndef INTERNAL_LINKAGE typedef enum Counter_Type { @@ -133,6 +152,19 @@ EXPORT { FL_EXPORT_C(Fl_Fontsize, Fl_Counter_textsize)(fl_Counter counter); FL_EXPORT_C(void, Fl_Counter_set_textcolor)(fl_Counter counter, Fl_Color text); FL_EXPORT_C(Fl_Color, Fl_Counter_textcolor)(fl_Counter counter); + FL_EXPORT_C(fl_Counter, Fl_OverriddenCounter_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Counter, Fl_OverriddenCounter_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Counter_draw)(fl_Counter o); + FL_EXPORT_C(void, Fl_Counter_draw_super)(fl_Counter o); + FL_EXPORT_C(int, Fl_Counter_handle)(fl_Counter o, int event); + FL_EXPORT_C(int, Fl_Counter_handle_super)(fl_Counter o, int event); + FL_EXPORT_C(void, Fl_Counter_resize)(fl_Counter o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Counter_resize_super)(fl_Counter o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Counter_show)(fl_Counter o); + FL_EXPORT_C(void, Fl_Counter_show_super)(fl_Counter o); + FL_EXPORT_C(void, Fl_Counter_hide)(fl_Counter o); + FL_EXPORT_C(void, Fl_Counter_hide_super)(fl_Counter o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_DialC.cpp b/c-src/Fl_DialC.cpp index 55ebd582..953186b7 100644 --- a/c-src/Fl_DialC.cpp +++ b/c-src/Fl_DialC.cpp @@ -1,7 +1,80 @@ #include "Fl_DialC.h" #ifdef __cplusplus EXPORT { -#endif + Fl_DerivedDial::Fl_DerivedDial(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Dial(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedDial::Fl_DerivedDial(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Dial(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedDial::~Fl_DerivedDial(){ + free(overriddenFuncs); + } + void Fl_DerivedDial::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Dial) this); + } + else { + Fl_Dial::draw(); + } + } + + void Fl_DerivedDial::draw_super(){ + Fl_Dial::draw(); + } + + int Fl_DerivedDial::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Dial) this,event); + } + else { + i = Fl_Dial::handle(event); + } + return i; + } + int Fl_DerivedDial::handle_super(int event){ + return Fl_Dial::handle(event); + } + + void Fl_DerivedDial::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Dial) this,x,y,w,h); + } + else { + Fl_Dial::resize(x,y,w,h); + } + } + + void Fl_DerivedDial::resize_super(int x, int y, int w, int h){ + Fl_Dial::resize(x,y,w,h); + } + void Fl_DerivedDial::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Dial) this); + } + else { + Fl_Dial::show(); + } + } + void Fl_DerivedDial::show_super(){ + Fl_Dial::show(); + } + + void Fl_DerivedDial::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Dial) this); + } + else { + Fl_Dial::hide(); + } + } + void Fl_DerivedDial::hide_super(){ + Fl_Dial::hide(); + } +#endif FL_EXPORT_C(fl_Group,Fl_Dial_parent)(fl_Dial dial){ return (static_cast(dial))->parent(); } @@ -152,12 +225,6 @@ EXPORT { FL_EXPORT_C(int,Fl_Dial_visible_r)(fl_Dial dial){ return (static_cast(dial))->visible_r(); } - FL_EXPORT_C(void,Fl_Dial_show)(fl_Dial dial){ - (static_cast(dial))->show(); - } - FL_EXPORT_C(void,Fl_Dial_hide)(fl_Dial dial){ - (static_cast(dial))->hide(); - } FL_EXPORT_C(void,Fl_Dial_set_visible)(fl_Dial dial){ (static_cast(dial))->visible(); } @@ -254,9 +321,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Dial_as_gl_window)(fl_Dial dial){ return (static_cast(dial))->as_gl_window(); } - FL_EXPORT_C(void,Fl_Dial_resize)(fl_Dial dial,int X,int Y,int W,int H){ - (static_cast(dial))->resize(X,Y,W,H); - } FL_EXPORT_C(void,Fl_Dial_bounds)(fl_Dial dial,double a,double b){ (static_cast(dial))->bounds(a,b); } @@ -308,14 +372,6 @@ EXPORT { FL_EXPORT_C(double,Fl_Dial_increment)(fl_Dial dial,double v,int n){ return (static_cast(dial))->increment(v,n); } - FL_EXPORT_C(fl_Dial,Fl_Dial_New_WithLabel)(int x,int y,int w,int h,const char* label){ - Fl_Dial* dial = new Fl_Dial(x,y,w,h,label); - return (fl_Dial) dial; - } - FL_EXPORT_C(fl_Dial,Fl_Dial_New)(int x,int y,int w,int h){ - Fl_Dial* dial = new Fl_Dial(x,y,w,h); - return (fl_Dial) dial; - } FL_EXPORT_C(fl_Fill_Dial,Fl_Fill_Dial_New)(int x,int y,int w,int h,const char* label){ Fl_Fill_Dial* dial = new Fl_Fill_Dial(x,y,w,h,label); return (fl_Fill_Dial) dial; @@ -343,9 +399,54 @@ EXPORT { FL_EXPORT_C(short,Fl_Dial_angle2)(fl_Dial dial){ return (static_cast(dial))->angle2(); } - FL_EXPORT_C(int,Fl_Dial_handle)(fl_Dial dial,int event){ - return (static_cast(dial))->handle(event); + FL_EXPORT_C(void, Fl_Dial_draw)(fl_Dial o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Dial_draw_super)(fl_Dial o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Dial_handle)(fl_Dial o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Dial_handle_super)(fl_Dial o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Dial_resize)(fl_Dial o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Dial_resize_super)(fl_Dial o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Dial_show)(fl_Dial o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Dial_show_super)(fl_Dial o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Dial_hide)(fl_Dial o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Dial_hide_super)(fl_Dial o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Dial, Fl_Dial_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedDial* w = new Fl_DerivedDial(X,Y,W,H,fs); + return (fl_Dial)w; + } + FL_EXPORT_C(fl_Dial, Fl_Dial_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedDial* w = new Fl_DerivedDial(X,Y,W,H,label,fs); + return (fl_Dial)w; + } + FL_EXPORT_C(fl_Dial, Fl_OverriddenDial_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedDial* w = new Fl_DerivedDial(X,Y,W,H,fs); + return (fl_Dial)w; + } + FL_EXPORT_C(fl_Dial, Fl_OverriddenDial_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedDial* w = new Fl_DerivedDial(X,Y,W,H,label,fs); + return (fl_Dial)w; } #ifdef __cplusplus } -#endif +#endif diff --git a/c-src/Fl_DialC.h b/c-src/Fl_DialC.h index 0cfbc07b..d17ef955 100644 --- a/c-src/Fl_DialC.h +++ b/c-src/Fl_DialC.h @@ -9,7 +9,26 @@ #include "FL/Fl_Fill_Dial.H" #include "FL/Fl_Line_Dial.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedDial : public Fl_Dial { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedDial(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedDial(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedDial(); + }; #endif #ifndef INTERNAL_LINKAGE typedef enum Dial_Type { @@ -134,6 +153,18 @@ EXPORT { FL_EXPORT_C(short, Fl_Dial_angle1)(fl_Dial dial); FL_EXPORT_C(short, Fl_Dial_angle2)(fl_Dial dial); FL_EXPORT_C(int, Fl_Dial_handle)(fl_Dial dial, int event); + FL_EXPORT_C(fl_Dial, Fl_OverriddenDial_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Dial, Fl_OverriddenDial_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Dial_draw)(fl_Dial o); + FL_EXPORT_C(void, Fl_Dial_draw_super)(fl_Dial o); + FL_EXPORT_C(int, Fl_Dial_handle)(fl_Dial o, int event); + FL_EXPORT_C(int, Fl_Dial_handle_super)(fl_Dial o, int event); + FL_EXPORT_C(void, Fl_Dial_resize)(fl_Dial o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Dial_resize_super)(fl_Dial o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Dial_show)(fl_Dial o); + FL_EXPORT_C(void, Fl_Dial_show_super)(fl_Dial o); + FL_EXPORT_C(void, Fl_Dial_hide)(fl_Dial o); + FL_EXPORT_C(void, Fl_Dial_hide_super)(fl_Dial o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_File_BrowserC.cpp b/c-src/Fl_File_BrowserC.cpp index aa732845..93d6e972 100644 --- a/c-src/Fl_File_BrowserC.cpp +++ b/c-src/Fl_File_BrowserC.cpp @@ -1,10 +1,82 @@ #include "Fl_File_BrowserC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_File_Browser_handle)(fl_File_Browser self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedFile_Browser::Fl_DerivedFile_Browser(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_File_Browser(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedFile_Browser::Fl_DerivedFile_Browser(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_File_Browser(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedFile_Browser::~Fl_DerivedFile_Browser(){ + free(overriddenFuncs); + } + void Fl_DerivedFile_Browser::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_File_Browser) this); + } + else { + Fl_File_Browser::draw(); + } + } + + void Fl_DerivedFile_Browser::draw_super(){ + Fl_File_Browser::draw(); + } + + int Fl_DerivedFile_Browser::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_File_Browser) this,event); + } + else { + i = Fl_File_Browser::handle(event); + } + return i; + } + int Fl_DerivedFile_Browser::handle_super(int event){ + return Fl_File_Browser::handle(event); + } + + void Fl_DerivedFile_Browser::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_File_Browser) this,x,y,w,h); + } + else { + Fl_File_Browser::resize(x,y,w,h); + } + } + + void Fl_DerivedFile_Browser::resize_super(int x, int y, int w, int h){ + Fl_File_Browser::resize(x,y,w,h); + } + void Fl_DerivedFile_Browser::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_File_Browser) this); + } + else { + Fl_File_Browser::show(); + } + } + void Fl_DerivedFile_Browser::show_super(){ + Fl_File_Browser::show(); } + + void Fl_DerivedFile_Browser::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_File_Browser) this); + } + else { + Fl_File_Browser::hide(); + } + } + void Fl_DerivedFile_Browser::hide_super(){ + Fl_File_Browser::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_File_Browser_parent)(fl_File_Browser file_browser){ return (fl_Group) (static_cast(file_browser))->parent(); } @@ -153,12 +225,6 @@ EXPORT { FL_EXPORT_C(int,Fl_File_Browser_visible_r)(fl_File_Browser file_browser){ return (static_cast(file_browser))->visible_r(); } - FL_EXPORT_C(void,Fl_File_Browser_show_super)(fl_File_Browser file_browser){ - return (static_cast(file_browser))->show(); - } - FL_EXPORT_C(void,Fl_File_Browser_hide_super)(fl_File_Browser file_browser){ - return (static_cast(file_browser))->hide(); - } FL_EXPORT_C(void,Fl_File_Browser_clear_visible)(fl_File_Browser file_browser){ (static_cast(file_browser))->clear_visible(); } @@ -285,18 +351,6 @@ EXPORT { FL_EXPORT_C(fl_Widget,Fl_File_Browser__ddfdesign_kludge)(fl_File_Browser file_browser){ return (static_cast(file_browser))->_ddfdesign_kludge(); } - // FL_EXPORT_C(void,Fl_File_Browser_forms_end)(fl_File_Browser self){ - // (static_cast(self))->forms_end(); - // } - - FL_EXPORT_C(fl_File_Browser, Fl_File_Browser_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_File_Browser* file_browser = new Fl_File_Browser(x,y,w,h,label); - return (static_cast(file_browser)); - } - FL_EXPORT_C(fl_File_Browser, Fl_File_Browser_New)(int x, int y, int w, int h) { - Fl_File_Browser* file_browser = new Fl_File_Browser(x,y,w,h,0); - return (fl_File_Browser)file_browser; - } FL_EXPORT_C(void,Fl_File_Browser_Destroy)(fl_File_Browser file_browser){ delete (static_cast(file_browser)); } @@ -361,15 +415,9 @@ EXPORT { FL_EXPORT_C(void,Fl_File_Browser_show_with_line)(fl_File_Browser file_browser,int line){ (static_cast(file_browser))->show(line); } - FL_EXPORT_C(void,Fl_File_Browser_show)(fl_File_Browser file_browser){ - (static_cast(file_browser))->show(); - } FL_EXPORT_C(void,Fl_File_Browser_hide_with_line)(fl_File_Browser file_browser,int line){ (static_cast(file_browser))->hide(line); } - FL_EXPORT_C(void,Fl_File_Browser_hide)(fl_File_Browser file_browser){ - (static_cast(file_browser))->hide(); - } FL_EXPORT_C(int,Fl_File_Browser_visible)(fl_File_Browser file_browser,int line){ return (static_cast(file_browser))->visible(line); } @@ -517,6 +565,36 @@ EXPORT { FL_EXPORT_C(void,Fl_File_Browser_set_filetype)(fl_File_Browser file_browser,int t){ (static_cast(file_browser))->filetype(t); } + FL_EXPORT_C(void, Fl_File_Browser_draw)(fl_File_Browser o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_File_Browser_draw_super)(fl_File_Browser o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_File_Browser_handle)(fl_File_Browser o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_File_Browser_handle_super)(fl_File_Browser o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_File_Browser_resize)(fl_File_Browser o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_File_Browser_resize_super)(fl_File_Browser o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_File_Browser_show)(fl_File_Browser o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_File_Browser_show_super)(fl_File_Browser o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_File_Browser_hide)(fl_File_Browser o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_File_Browser_hide_super)(fl_File_Browser o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_File_BrowserC.h b/c-src/Fl_File_BrowserC.h index 50f07df6..cda6df18 100644 --- a/c-src/Fl_File_BrowserC.h +++ b/c-src/Fl_File_BrowserC.h @@ -6,7 +6,26 @@ // the callback mechanism included below to work. #include "FL/Fl.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedFile_Browser : public Fl_File_Browser { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedFile_Browser(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedFile_Browser(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedFile_Browser(); + }; #endif #include "filenameC.h" @@ -18,14 +37,6 @@ EXPORT { #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int , Fl_File_Browser_handle_super)(fl_File_Browser file_browser,int event); - FL_EXPORT_C(int , Fl_File_Browser_handle )(fl_File_Browser file_browser,int event); - FL_EXPORT_C(void, Fl_File_Browser_resize_super)(fl_File_Browser file_browser,int x, int y, int w, int h); - FL_EXPORT_C(void, Fl_File_Browser_resize )(fl_File_Browser file_browser,int x, int y, int w, int h); - FL_EXPORT_C(void, Fl_File_Browser_show_super)(fl_File_Browser file_browser); - FL_EXPORT_C(void, Fl_File_Browser_show )(fl_File_Browser file_browser); - FL_EXPORT_C(void, Fl_File_Browser_hide_super)(fl_File_Browser file_browser); - FL_EXPORT_C(void, Fl_File_Browser_hide )(fl_File_Browser file_browser); FL_EXPORT_C(fl_Window, Fl_File_Browser_as_window_super)(fl_File_Browser file_browser); FL_EXPORT_C(fl_Window, Fl_File_Browser_as_window )(fl_File_Browser file_browser); FL_EXPORT_C(fl_Gl_Window, Fl_File_Browser_as_gl_window_super)(fl_File_Browser file_browser); @@ -208,6 +219,19 @@ EXPORT { FL_EXPORT_C(int, Fl_File_Browser_load)(fl_File_Browser file_browser,const char *directory, Fl_File_Sort_F* sort); FL_EXPORT_C(int, Fl_File_Browser_filetype)(fl_File_Browser file_browser); FL_EXPORT_C(void, Fl_File_Browser_set_filetype)(fl_File_Browser file_browser,int t); + FL_EXPORT_C(fl_File_Browser, Fl_OverriddenFile_Browser_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_File_Browser, Fl_OverriddenFile_Browser_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_File_Browser_draw)(fl_File_Browser o); + FL_EXPORT_C(void, Fl_File_Browser_draw_super)(fl_File_Browser o); + FL_EXPORT_C(int, Fl_File_Browser_handle)(fl_File_Browser o, int event); + FL_EXPORT_C(int, Fl_File_Browser_handle_super)(fl_File_Browser o, int event); + FL_EXPORT_C(void, Fl_File_Browser_resize)(fl_File_Browser o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_File_Browser_resize_super)(fl_File_Browser o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_File_Browser_show)(fl_File_Browser o); + FL_EXPORT_C(void, Fl_File_Browser_show_super)(fl_File_Browser o); + FL_EXPORT_C(void, Fl_File_Browser_hide)(fl_File_Browser o); + FL_EXPORT_C(void, Fl_File_Browser_hide_super)(fl_File_Browser o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_File_InputC.cpp b/c-src/Fl_File_InputC.cpp index 5c791a85..0f76e585 100644 --- a/c-src/Fl_File_InputC.cpp +++ b/c-src/Fl_File_InputC.cpp @@ -2,11 +2,81 @@ #ifdef __cplusplus EXPORT { + Fl_DerivedFile_Input::Fl_DerivedFile_Input(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_File_Input(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedFile_Input::Fl_DerivedFile_Input(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_File_Input(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedFile_Input::~Fl_DerivedFile_Input(){ + free(overriddenFuncs); + } + void Fl_DerivedFile_Input::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_File_Input) this); + } + else { + Fl_File_Input::draw(); + } + } + + void Fl_DerivedFile_Input::draw_super(){ + Fl_File_Input::draw(); + } + + int Fl_DerivedFile_Input::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_File_Input) this,event); + } + else { + i = Fl_File_Input::handle(event); + } + return i; + } + int Fl_DerivedFile_Input::handle_super(int event){ + return Fl_File_Input::handle(event); + } + + void Fl_DerivedFile_Input::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_File_Input) this,x,y,w,h); + } + else { + Fl_File_Input::resize(x,y,w,h); + } + } + + void Fl_DerivedFile_Input::resize_super(int x, int y, int w, int h){ + Fl_File_Input::resize(x,y,w,h); + } + void Fl_DerivedFile_Input::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_File_Input) this); + } + else { + Fl_File_Input::show(); + } + } + void Fl_DerivedFile_Input::show_super(){ + Fl_File_Input::show(); + } + + void Fl_DerivedFile_Input::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_File_Input) this); + } + else { + Fl_File_Input::hide(); + } + } + void Fl_DerivedFile_Input::hide_super(){ + Fl_File_Input::hide(); + } #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int,Fl_File_Input_handle)(fl_File_Input self, int event){ - return (static_cast(self))->handle(event); - } FL_EXPORT_C(fl_Group,Fl_File_Input_parent)(fl_File_Input file_input){ return (fl_Group) (static_cast(file_input))->parent(); } @@ -267,20 +337,9 @@ EXPORT { return (fl_Gl_Window) (static_cast(file_input))->as_gl_window(); } /* Fl_File_Input specific functions */ - FL_EXPORT_C(fl_File_Input, Fl_File_Input_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_File_Input* file_input = new Fl_File_Input(x,y,w,h,label); - return (static_cast(file_input)); - } - FL_EXPORT_C(fl_File_Input, Fl_File_Input_New)(int x, int y, int w, int h) { - Fl_File_Input* file_input = new Fl_File_Input(x,y,w,h,0); - return (static_cast(file_input)); - } FL_EXPORT_C(void,Fl_File_Input_Destroy)(fl_File_Input file_input){ delete (static_cast(file_input)); } - FL_EXPORT_C(void,Fl_File_Input_resize)(fl_File_Input file_input,int X,int Y,int W,int H){ - (static_cast(file_input))->resize(X,Y,W,H); - } FL_EXPORT_C(int,Fl_File_Input_static_value)(fl_File_Input file_input,const char* text){ return (static_cast(file_input))->static_value(text); } @@ -422,6 +481,54 @@ EXPORT { FL_EXPORT_C(void,Fl_File_Input_set_down_box)(fl_File_Input file_input,Fl_Boxtype color){ (static_cast(file_input))->down_box(color); } + FL_EXPORT_C(void, Fl_File_Input_draw)(fl_File_Input o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_File_Input_draw_super)(fl_File_Input o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_File_Input_handle)(fl_File_Input o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_File_Input_handle_super)(fl_File_Input o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_File_Input_resize)(fl_File_Input o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_File_Input_resize_super)(fl_File_Input o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_File_Input_show)(fl_File_Input o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_File_Input_show_super)(fl_File_Input o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_File_Input_hide)(fl_File_Input o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_File_Input_hide_super)(fl_File_Input o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_File_Input, Fl_File_Input_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedFile_Input* w = new Fl_DerivedFile_Input(X,Y,W,H,fs); + return (fl_File_Input)w; + } + FL_EXPORT_C(fl_File_Input, Fl_File_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedFile_Input* w = new Fl_DerivedFile_Input(X,Y,W,H,label,fs); + return (fl_File_Input)w; + } + FL_EXPORT_C(fl_File_Input, Fl_OverriddenFile_Input_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedFile_Input* w = new Fl_DerivedFile_Input(X,Y,W,H,fs); + return (fl_File_Input)w; + } + FL_EXPORT_C(fl_File_Input, Fl_OverriddenFile_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedFile_Input* w = new Fl_DerivedFile_Input(X,Y,W,H,label,fs); + return (fl_File_Input)w; + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_File_InputC.h b/c-src/Fl_File_InputC.h index 73bf2e69..0a16826d 100644 --- a/c-src/Fl_File_InputC.h +++ b/c-src/Fl_File_InputC.h @@ -7,10 +7,28 @@ #include "FL/Fl.H" #include "FL/Fl_File_Input.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedFile_Input : public Fl_File_Input { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedFile_Input(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedFile_Input(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedFile_Input(); + }; #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int,Fl_File_Input_handle)(fl_File_Input self, int event); FL_EXPORT_C(fl_Group, Fl_File_Input_parent)(fl_File_Input file_input); FL_EXPORT_C(void, Fl_File_Input_set_parent)(fl_File_Input file_input, fl_Group grp); FL_EXPORT_C(uchar, Fl_File_Input_type)(fl_File_Input file_input); @@ -95,7 +113,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window, Fl_File_Input_as_gl_window)(fl_File_Input file_input); /* Inherited from Fl_Input */ FL_EXPORT_C(int, Fl_File_Input_handle)(fl_File_Input file_input, int event); - FL_EXPORT_C(void, Fl_File_Input_resize)(fl_File_Input file_input, int X, int Y, int W, int H); FL_EXPORT_C(int, Fl_File_Input_static_value)(fl_File_Input file_input, const char* text); FL_EXPORT_C(int, Fl_File_Input_static_value_with_length)(fl_File_Input file_input, const char* text, int length); FL_EXPORT_C(Fl_Char, Fl_File_Input_index)(fl_File_Input file_input, int i); @@ -148,6 +165,18 @@ EXPORT { FL_EXPORT_C(void, Fl_File_Input_set_errorcolor)(fl_File_Input file_input, Fl_Color color); FL_EXPORT_C(Fl_Boxtype, Fl_File_Input_down_box)(fl_File_Input file_input); FL_EXPORT_C(void, Fl_File_Input_set_down_box)(fl_File_Input file_input, Fl_Boxtype color); + FL_EXPORT_C(fl_File_Input, Fl_OverriddenFile_Input_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_File_Input, Fl_OverriddenFile_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_File_Input_draw)(fl_File_Input o); + FL_EXPORT_C(void, Fl_File_Input_draw_super)(fl_File_Input o); + FL_EXPORT_C(int, Fl_File_Input_handle)(fl_File_Input o, int event); + FL_EXPORT_C(int, Fl_File_Input_handle_super)(fl_File_Input o, int event); + FL_EXPORT_C(void, Fl_File_Input_resize)(fl_File_Input o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_File_Input_resize_super)(fl_File_Input o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_File_Input_show)(fl_File_Input o); + FL_EXPORT_C(void, Fl_File_Input_show_super)(fl_File_Input o); + FL_EXPORT_C(void, Fl_File_Input_hide)(fl_File_Input o); + FL_EXPORT_C(void, Fl_File_Input_hide_super)(fl_File_Input o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_InputC.cpp b/c-src/Fl_InputC.cpp index dcb034f0..f514d938 100644 --- a/c-src/Fl_InputC.cpp +++ b/c-src/Fl_InputC.cpp @@ -2,11 +2,81 @@ #ifdef __cplusplus EXPORT { + Fl_DerivedInput::Fl_DerivedInput(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Input(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedInput::Fl_DerivedInput(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Input(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedInput::~Fl_DerivedInput(){ + free(overriddenFuncs); + } + void Fl_DerivedInput::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Input) this); + } + else { + Fl_Input::draw(); + } + } + + void Fl_DerivedInput::draw_super(){ + Fl_Input::draw(); + } + + int Fl_DerivedInput::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Input) this,event); + } + else { + i = Fl_Input::handle(event); + } + return i; + } + int Fl_DerivedInput::handle_super(int event){ + return Fl_Input::handle(event); + } + + void Fl_DerivedInput::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Input) this,x,y,w,h); + } + else { + Fl_Input::resize(x,y,w,h); + } + } + + void Fl_DerivedInput::resize_super(int x, int y, int w, int h){ + Fl_Input::resize(x,y,w,h); + } + void Fl_DerivedInput::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Input) this); + } + else { + Fl_Input::show(); + } + } + void Fl_DerivedInput::show_super(){ + Fl_Input::show(); + } + + void Fl_DerivedInput::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Input) this); + } + else { + Fl_Input::hide(); + } + } + void Fl_DerivedInput::hide_super(){ + Fl_Input::hide(); + } #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int,Fl_Input_handle)(fl_Input self, int event){ - return (static_cast(self))->handle(event); - } FL_EXPORT_C(fl_Group,Fl_Input_parent)(fl_Input input){ return (fl_Group) (static_cast(input))->parent(); } @@ -268,20 +338,9 @@ EXPORT { return (fl_Gl_Window) (static_cast(input))->as_gl_window(); } /* Fl_Input specific functions */ - FL_EXPORT_C(fl_Input, Fl_Input_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Input* input = new Fl_Input(x,y,w,h,label); - return (static_cast(input)); - } - FL_EXPORT_C(fl_Input, Fl_Input_New)(int x, int y, int w, int h) { - Fl_Input* input = new Fl_Input(x,y,w,h,0); - return (fl_Input)input; - } FL_EXPORT_C(void,Fl_Input_Destroy)(fl_Input input){ delete (static_cast(input)); } - FL_EXPORT_C(void,Fl_Input_resize)(fl_Input input,int X,int Y,int W,int H){ - (static_cast(input))->resize(X,Y,W,H); - } FL_EXPORT_C(int,Fl_Input_set_value)(fl_Input input,const char* text){ return (static_cast(input))->value(text); } @@ -411,6 +470,55 @@ EXPORT { FL_EXPORT_C(int,Fl_Input_set_tab_nav)(fl_Input input){ return (static_cast(input))->tab_nav(); } + FL_EXPORT_C(void, Fl_Input_draw)(fl_Input o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Input_draw_super)(fl_Input o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Input_handle)(fl_Input o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Input_handle_super)(fl_Input o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Input_resize)(fl_Input o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Input_resize_super)(fl_Input o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Input_show)(fl_Input o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Input_show_super)(fl_Input o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Input_hide)(fl_Input o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Input_hide_super)(fl_Input o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Input, Fl_Input_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedInput* w = new Fl_DerivedInput(X,Y,W,H,fs); + return (fl_Input)w; + } + FL_EXPORT_C(fl_Input, Fl_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedInput* w = new Fl_DerivedInput(X,Y,W,H,label,fs); + return (fl_Input)w; + } + FL_EXPORT_C(fl_Input, Fl_OverriddenInput_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedInput* w = new Fl_DerivedInput(X,Y,W,H,fs); + return (fl_Input)w; + } + FL_EXPORT_C(fl_Input, Fl_OverriddenInput_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedInput* w = new Fl_DerivedInput(X,Y,W,H,label,fs); + return (fl_Input)w; + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_InputC.h b/c-src/Fl_InputC.h index 694bbb28..20ac5af5 100644 --- a/c-src/Fl_InputC.h +++ b/c-src/Fl_InputC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Input.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedInput : public Fl_Input { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedInput(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedInput(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedInput(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Input_handle)(fl_Input self, int event); @@ -96,10 +115,10 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window, Fl_Input_as_gl_window)(fl_Input input); /* Fl_Input specific functions */ FL_EXPORT_C(int, Fl_Input_handle)(fl_Input input, int event); - FL_EXPORT_C(fl_Input, Fl_Input_New_WithLabel)(int x, int y, int w, int h, const char* label); - FL_EXPORT_C(fl_Input, Fl_Input_New)(int x, int y, int w, int h); + FL_EXPORT_C(fl_Input, Fl_Input_New_WithLabel)(int x, int y, int w, int h, const char* label); + FL_EXPORT_C(fl_Input, Fl_Input_New)(int x, int y, int w, int h); FL_EXPORT_C(void, Fl_Input_Destroy)(fl_Input input); - + FL_EXPORT_C(void, Fl_Input_resize)(fl_Input input, int X, int Y, int W, int H); FL_EXPORT_C(int, Fl_Input_set_value)(fl_Input input, const char* text); FL_EXPORT_C(int, Fl_Input_set_value_with_length)(fl_Input input, const char* text, int length); @@ -144,6 +163,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Input_set_wrap)(fl_Input input,int b); FL_EXPORT_C(void, Fl_Input_tab_nav)(fl_Input input,int val); FL_EXPORT_C(int, Fl_Input_set_tab_nav)(fl_Input input); + FL_EXPORT_C(fl_Input, Fl_OverriddenInput_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Input, Fl_OverriddenInput_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Input_draw)(fl_Input o); + FL_EXPORT_C(void, Fl_Input_draw_super)(fl_Input o); + FL_EXPORT_C(int, Fl_Input_handle)(fl_Input o, int event); + FL_EXPORT_C(int, Fl_Input_handle_super)(fl_Input o, int event); + FL_EXPORT_C(void, Fl_Input_resize)(fl_Input o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Input_resize_super)(fl_Input o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Input_show)(fl_Input o); + FL_EXPORT_C(void, Fl_Input_show_super)(fl_Input o); + FL_EXPORT_C(void, Fl_Input_hide)(fl_Input o); + FL_EXPORT_C(void, Fl_Input_hide_super)(fl_Input o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Light_ButtonC.cpp b/c-src/Fl_Light_ButtonC.cpp index 29690769..28f7d20e 100644 --- a/c-src/Fl_Light_ButtonC.cpp +++ b/c-src/Fl_Light_ButtonC.cpp @@ -2,10 +2,82 @@ #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Light_Button_handle)(fl_Light_Button self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedLight_Button::Fl_DerivedLight_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Light_Button(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedLight_Button::Fl_DerivedLight_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Light_Button(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedLight_Button::~Fl_DerivedLight_Button(){ + free(overriddenFuncs); + } + void Fl_DerivedLight_Button::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Light_Button) this); + } + else { + Fl_Light_Button::draw(); + } + } + + void Fl_DerivedLight_Button::draw_super(){ + Fl_Light_Button::draw(); + } + + int Fl_DerivedLight_Button::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Light_Button) this,event); + } + else { + i = Fl_Light_Button::handle(event); + } + return i; + } + int Fl_DerivedLight_Button::handle_super(int event){ + return Fl_Light_Button::handle(event); + } + + void Fl_DerivedLight_Button::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Light_Button) this,x,y,w,h); + } + else { + Fl_Light_Button::resize(x,y,w,h); + } + } + + void Fl_DerivedLight_Button::resize_super(int x, int y, int w, int h){ + Fl_Light_Button::resize(x,y,w,h); + } + void Fl_DerivedLight_Button::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Light_Button) this); + } + else { + Fl_Light_Button::show(); + } } + void Fl_DerivedLight_Button::show_super(){ + Fl_Light_Button::show(); + } + + void Fl_DerivedLight_Button::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Light_Button) this); + } + else { + Fl_Light_Button::hide(); + } + } + void Fl_DerivedLight_Button::hide_super(){ + Fl_Light_Button::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Light_Button_parent)(fl_Light_Button b){ return (fl_Group) (static_cast(b))->parent(); } @@ -266,14 +338,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Light_Button_as_gl_window)(fl_Light_Button light_button){ return (fl_Gl_Window) (static_cast(light_button))->as_gl_window(); } - FL_EXPORT_C(fl_Light_Button, Fl_Light_Button_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Light_Button* button = new Fl_Light_Button(x,y,w,h,label); - return (static_cast(button)); - } - FL_EXPORT_C(fl_Light_Button, Fl_Light_Button_New)(int x, int y, int w, int h) { - Fl_Light_Button* button = new Fl_Light_Button(x,y,w,h,0); - return (fl_Light_Button)button; - } FL_EXPORT_C(void,Fl_Light_Button_Destroy)(fl_Light_Button button){ delete (static_cast(button)); } @@ -307,6 +371,54 @@ EXPORT { FL_EXPORT_C(void,Fl_Light_Button_set_down_color)(fl_Light_Button b,Fl_Color c){ (static_cast(b))->down_color(c); } + FL_EXPORT_C(fl_Light_Button, Fl_Light_Button_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedLight_Button* w = new Fl_DerivedLight_Button(X,Y,W,H,fs); + return (fl_Light_Button)w; + } + FL_EXPORT_C(fl_Light_Button, Fl_Light_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedLight_Button* w = new Fl_DerivedLight_Button(X,Y,W,H,label,fs); + return (fl_Light_Button)w; + } + FL_EXPORT_C(fl_Light_Button, Fl_OverriddenLight_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedLight_Button* w = new Fl_DerivedLight_Button(X,Y,W,H,fs); + return (fl_Light_Button)w; + } + FL_EXPORT_C(fl_Light_Button, Fl_OverriddenLight_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedLight_Button* w = new Fl_DerivedLight_Button(X,Y,W,H,label,fs); + return (fl_Light_Button)w; + } + FL_EXPORT_C(void, Fl_Light_Button_draw)(fl_Light_Button o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Light_Button_draw_super)(fl_Light_Button o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Light_Button_handle)(fl_Light_Button o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Light_Button_handle_super)(fl_Light_Button o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Light_Button_resize)(fl_Light_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Light_Button_resize_super)(fl_Light_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Light_Button_show)(fl_Light_Button o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Light_Button_show_super)(fl_Light_Button o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Light_Button_hide)(fl_Light_Button o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Light_Button_hide_super)(fl_Light_Button o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Light_ButtonC.h b/c-src/Fl_Light_ButtonC.h index 31093d0f..3896dfe4 100644 --- a/c-src/Fl_Light_ButtonC.h +++ b/c-src/Fl_Light_ButtonC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Light_Button.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedLight_Button : public Fl_Light_Button { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedLight_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedLight_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedLight_Button(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Light_Button_handle)(fl_Light_Button self, int event); @@ -109,6 +128,19 @@ EXPORT { FL_EXPORT_C(void , Fl_Light_Button_set_down_box)(fl_Light_Button b,Fl_Boxtype boxtype); FL_EXPORT_C(Fl_Color , Fl_Light_Button_down_color )(fl_Light_Button b); FL_EXPORT_C(void , Fl_Light_Button_set_down_color)(fl_Light_Button b, Fl_Color c); + FL_EXPORT_C(fl_Light_Button, Fl_OverriddenLight_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Light_Button, Fl_OverriddenLight_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Light_Button_draw)(fl_Light_Button o); + FL_EXPORT_C(void, Fl_Light_Button_draw_super)(fl_Light_Button o); + FL_EXPORT_C(int, Fl_Light_Button_handle)(fl_Light_Button o, int event); + FL_EXPORT_C(int, Fl_Light_Button_handle_super)(fl_Light_Button o, int event); + FL_EXPORT_C(void, Fl_Light_Button_resize)(fl_Light_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Light_Button_resize_super)(fl_Light_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Light_Button_show)(fl_Light_Button o); + FL_EXPORT_C(void, Fl_Light_Button_show_super)(fl_Light_Button o); + FL_EXPORT_C(void, Fl_Light_Button_hide)(fl_Light_Button o); + FL_EXPORT_C(void, Fl_Light_Button_hide_super)(fl_Light_Button o); + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Menu_BarC.cpp b/c-src/Fl_Menu_BarC.cpp index 2b1a06c3..52e24812 100644 --- a/c-src/Fl_Menu_BarC.cpp +++ b/c-src/Fl_Menu_BarC.cpp @@ -2,21 +2,133 @@ #include "UtilsC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Menu_Bar_handle )(fl_Menu_Bar menu_bar, int event){ - return (static_cast(menu_bar))->handle(event); + Fl_DerivedMenu_Bar::Fl_DerivedMenu_Bar(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Menu_Bar(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedMenu_Bar::Fl_DerivedMenu_Bar(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Menu_Bar(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedMenu_Bar::~Fl_DerivedMenu_Bar(){ + free(overriddenFuncs); + } + void Fl_DerivedMenu_Bar::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Menu_Bar) this); + } + else { + Fl_Menu_Bar::draw(); + } + } + + void Fl_DerivedMenu_Bar::draw_super(){ + Fl_Menu_Bar::draw(); + } + + int Fl_DerivedMenu_Bar::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Menu_Bar) this,event); + } + else { + i = Fl_Menu_Bar::handle(event); + } + return i; + } + int Fl_DerivedMenu_Bar::handle_super(int event){ + return Fl_Menu_Bar::handle(event); } - FL_EXPORT_C(fl_Menu_Bar, Fl_Menu_Bar_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Menu_Bar* menu_bar = new Fl_Menu_Bar(x,y,w,h,label); - return (static_cast(menu_bar)); + + void Fl_DerivedMenu_Bar::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Menu_Bar) this,x,y,w,h); + } + else { + Fl_Menu_Bar::resize(x,y,w,h); + } } - FL_EXPORT_C(fl_Menu_Bar, Fl_Menu_Bar_New)(int x, int y, int w, int h) { - Fl_Menu_Bar* menu_bar = new Fl_Menu_Bar(x,y,w,h,0); - return (fl_Menu_Bar)menu_bar; + + void Fl_DerivedMenu_Bar::resize_super(int x, int y, int w, int h){ + Fl_Menu_Bar::resize(x,y,w,h); } + void Fl_DerivedMenu_Bar::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Menu_Bar) this); + } + else { + Fl_Menu_Bar::show(); + } + } + void Fl_DerivedMenu_Bar::show_super(){ + Fl_Menu_Bar::show(); + } + + void Fl_DerivedMenu_Bar::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Menu_Bar) this); + } + else { + Fl_Menu_Bar::hide(); + } + } + void Fl_DerivedMenu_Bar::hide_super(){ + Fl_Menu_Bar::hide(); + } + + +#endif FL_EXPORT_C(void , Fl_Menu_Bar_Destroy)(fl_Menu_Bar menu_bar){ delete (static_cast(menu_bar)); } + FL_EXPORT_C(void, Fl_Menu_Bar_draw)(fl_Menu_Bar o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Menu_Bar_draw_super)(fl_Menu_Bar o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Menu_Bar_handle)(fl_Menu_Bar o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Menu_Bar_handle_super)(fl_Menu_Bar o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Menu_Bar_resize)(fl_Menu_Bar o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Menu_Bar_resize_super)(fl_Menu_Bar o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Menu_Bar_show)(fl_Menu_Bar o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Menu_Bar_show_super)(fl_Menu_Bar o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Menu_Bar_hide)(fl_Menu_Bar o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Menu_Bar_hide_super)(fl_Menu_Bar o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Menu_Bar, Fl_Menu_Bar_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedMenu_Bar* w = new Fl_DerivedMenu_Bar(X,Y,W,H,fs); + return (fl_Menu_Bar)w; + } + FL_EXPORT_C(fl_Menu_Bar, Fl_Menu_Bar_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedMenu_Bar* w = new Fl_DerivedMenu_Bar(X,Y,W,H,label,fs); + return (fl_Menu_Bar)w; + } + FL_EXPORT_C(fl_Menu_Bar, Fl_OverriddenMenu_Bar_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedMenu_Bar* w = new Fl_DerivedMenu_Bar(X,Y,W,H,fs); + return (fl_Menu_Bar)w; + } + FL_EXPORT_C(fl_Menu_Bar, Fl_OverriddenMenu_Bar_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedMenu_Bar* w = new Fl_DerivedMenu_Bar(X,Y,W,H,label,fs); + return (fl_Menu_Bar)w; + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Menu_BarC.h b/c-src/Fl_Menu_BarC.h index 541b1522..9964fc99 100644 --- a/c-src/Fl_Menu_BarC.h +++ b/c-src/Fl_Menu_BarC.h @@ -7,12 +7,43 @@ #include "FL/Fl.H" #include "FL/Fl_Menu_Bar.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedMenu_Bar : public Fl_Menu_Bar { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedMenu_Bar(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedMenu_Bar(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedMenu_Bar(); + }; #endif FL_EXPORT_C(int, Fl_Menu_Bar_handle)(fl_Group self, int event); FL_EXPORT_C(fl_Menu_Bar, Fl_Menu_Bar_New_WithLabel)(int x, int y, int w, int h, const char* label); FL_EXPORT_C(fl_Menu_Bar , Fl_Menu_Bar_New)(int x, int y, int w, int h); FL_EXPORT_C(void , Fl_Menu_Bar_Destroy)(fl_Menu_Bar menu_bar); + FL_EXPORT_C(fl_Menu_Bar, Fl_OverriddenMenu_Bar_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Menu_Bar, Fl_OverriddenMenu_Bar_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Menu_Bar_draw)(fl_Menu_Bar o); + FL_EXPORT_C(void, Fl_Menu_Bar_draw_super)(fl_Menu_Bar o); + FL_EXPORT_C(int, Fl_Menu_Bar_handle)(fl_Menu_Bar o, int event); + FL_EXPORT_C(int, Fl_Menu_Bar_handle_super)(fl_Menu_Bar o, int event); + FL_EXPORT_C(void, Fl_Menu_Bar_resize)(fl_Menu_Bar o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Menu_Bar_resize_super)(fl_Menu_Bar o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Menu_Bar_show)(fl_Menu_Bar o); + FL_EXPORT_C(void, Fl_Menu_Bar_show_super)(fl_Menu_Bar o); + FL_EXPORT_C(void, Fl_Menu_Bar_hide)(fl_Menu_Bar o); + FL_EXPORT_C(void, Fl_Menu_Bar_hide_super)(fl_Menu_Bar o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Menu_ButtonC.cpp b/c-src/Fl_Menu_ButtonC.cpp index da857c5d..240477ab 100644 --- a/c-src/Fl_Menu_ButtonC.cpp +++ b/c-src/Fl_Menu_ButtonC.cpp @@ -2,19 +2,82 @@ #include "UtilsC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Menu_Button_handle )(fl_Menu_Button menu_button, int event){ - return (static_cast(menu_button))->handle(event); + Fl_DerivedMenu_Button::Fl_DerivedMenu_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Menu_Button(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; } - FL_EXPORT_C(void,Fl_Menu_Button_resize )(fl_Menu_Button menu_button,int x, int y, int w, int h){ - (static_cast(menu_button))->resize(x,y,w,h); + Fl_DerivedMenu_Button::Fl_DerivedMenu_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Menu_Button(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; } - FL_EXPORT_C(void,Fl_Menu_Button_show )(fl_Menu_Button menu_button){ - (static_cast(menu_button))->show(); + Fl_DerivedMenu_Button::~Fl_DerivedMenu_Button(){ + free(overriddenFuncs); } - FL_EXPORT_C(void,Fl_Menu_Button_hide )(fl_Menu_Button menu_button){ - (static_cast(menu_button))->hide(); + void Fl_DerivedMenu_Button::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Menu_Button) this); + } + else { + Fl_Menu_Button::draw(); + } } + + void Fl_DerivedMenu_Button::draw_super(){ + Fl_Menu_Button::draw(); + } + + int Fl_DerivedMenu_Button::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Menu_Button) this,event); + } + else { + i = Fl_Menu_Button::handle(event); + } + return i; + } + int Fl_DerivedMenu_Button::handle_super(int event){ + return Fl_Menu_Button::handle(event); + } + + void Fl_DerivedMenu_Button::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Menu_Button) this,x,y,w,h); + } + else { + Fl_Menu_Button::resize(x,y,w,h); + } + } + + void Fl_DerivedMenu_Button::resize_super(int x, int y, int w, int h){ + Fl_Menu_Button::resize(x,y,w,h); + } + void Fl_DerivedMenu_Button::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Menu_Button) this); + } + else { + Fl_Menu_Button::show(); + } + } + void Fl_DerivedMenu_Button::show_super(){ + Fl_Menu_Button::show(); + } + + void Fl_DerivedMenu_Button::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Menu_Button) this); + } + else { + Fl_Menu_Button::hide(); + } + } + void Fl_DerivedMenu_Button::hide_super(){ + Fl_Menu_Button::hide(); + } + + +#endif FL_EXPORT_C(fl_Window,Fl_Menu_Button_as_window )(fl_Menu_Button menu_button){ return (static_cast(menu_button))->as_window(); } @@ -265,14 +328,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Menu_Button_measure_label)(fl_Menu_Button menu_button,int* ww,int* hh){ (static_cast(menu_button))->measure_label(*ww,*hh); } - FL_EXPORT_C(fl_Menu_Button, Fl_Menu_Button_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Menu_Button* menu_button = new Fl_Menu_Button(x,y,w,h,label); - return (static_cast(menu_button)); - } - FL_EXPORT_C(fl_Menu_Button, Fl_Menu_Button_New)(int x, int y, int w, int h) { - Fl_Menu_Button* menu_button = new Fl_Menu_Button(x,y,w,h,0); - return (fl_Menu_Button)menu_button; - } FL_EXPORT_C(void , Fl_Menu_Button_Destroy)(fl_Menu_Button menu_button){ delete (static_cast(menu_button)); } @@ -435,6 +490,54 @@ EXPORT { FL_EXPORT_C(fl_Menu_Item, Fl_Menu_Button_popup)(fl_Menu_Button menu_button) { return (fl_Menu_Item)(static_cast(menu_button))->popup(); } + FL_EXPORT_C(fl_Menu_Button, Fl_Menu_Button_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedMenu_Button* w = new Fl_DerivedMenu_Button(X,Y,W,H,fs); + return (fl_Menu_Button)w; + } + FL_EXPORT_C(fl_Menu_Button, Fl_Menu_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedMenu_Button* w = new Fl_DerivedMenu_Button(X,Y,W,H,label,fs); + return (fl_Menu_Button)w; + } + FL_EXPORT_C(fl_Menu_Button, Fl_OverriddenMenu_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedMenu_Button* w = new Fl_DerivedMenu_Button(X,Y,W,H,fs); + return (fl_Menu_Button)w; + } + FL_EXPORT_C(fl_Menu_Button, Fl_OverriddenMenu_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedMenu_Button* w = new Fl_DerivedMenu_Button(X,Y,W,H,label,fs); + return (fl_Menu_Button)w; + } + FL_EXPORT_C(void, Fl_Menu_Button_draw)(fl_Menu_Button o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Menu_Button_draw_super)(fl_Menu_Button o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Menu_Button_handle)(fl_Menu_Button o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Menu_Button_handle_super)(fl_Menu_Button o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Menu_Button_resize)(fl_Menu_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Menu_Button_resize_super)(fl_Menu_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Menu_Button_show)(fl_Menu_Button o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Menu_Button_show_super)(fl_Menu_Button o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Menu_Button_hide)(fl_Menu_Button o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Menu_Button_hide_super)(fl_Menu_Button o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Menu_ButtonC.h b/c-src/Fl_Menu_ButtonC.h index 3457a2fc..4343c7fe 100644 --- a/c-src/Fl_Menu_ButtonC.h +++ b/c-src/Fl_Menu_ButtonC.h @@ -8,7 +8,26 @@ #include "FL/Fl_Menu_Button.H" #include "Fl_CallbackC.h" #include "Fl_Menu_C.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedMenu_Button : public Fl_Menu_Button { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedMenu_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedMenu_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedMenu_Button(); + }; #endif #ifndef INTERNAL_LINKAGE typedef enum Menu_Button_Type { @@ -171,6 +190,18 @@ EXPORT { FL_EXPORT_C(Fl_Color, Fl_Menu_Button_down_color)(fl_Menu_Button menu_button); FL_EXPORT_C(void, Fl_Menu_Button_set_down_color)(fl_Menu_Button menu_button, unsigned c); FL_EXPORT_C(fl_Menu_Item, Fl_Menu_Button_popup)(fl_Menu_Button menu_button); + FL_EXPORT_C(fl_Menu_Button, Fl_OverriddenMenu_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Menu_Button, Fl_OverriddenMenu_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Menu_Button_draw)(fl_Menu_Button o); + FL_EXPORT_C(void, Fl_Menu_Button_draw_super)(fl_Menu_Button o); + FL_EXPORT_C(int, Fl_Menu_Button_handle)(fl_Menu_Button o, int event); + FL_EXPORT_C(int, Fl_Menu_Button_handle_super)(fl_Menu_Button o, int event); + FL_EXPORT_C(void, Fl_Menu_Button_resize)(fl_Menu_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Menu_Button_resize_super)(fl_Menu_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Menu_Button_show)(fl_Menu_Button o); + FL_EXPORT_C(void, Fl_Menu_Button_show_super)(fl_Menu_Button o); + FL_EXPORT_C(void, Fl_Menu_Button_hide)(fl_Menu_Button o); + FL_EXPORT_C(void, Fl_Menu_Button_hide_super)(fl_Menu_Button o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_OutputC.cpp b/c-src/Fl_OutputC.cpp index 7723b508..2f7435d3 100644 --- a/c-src/Fl_OutputC.cpp +++ b/c-src/Fl_OutputC.cpp @@ -2,11 +2,83 @@ #ifdef __cplusplus EXPORT { + Fl_DerivedOutput::Fl_DerivedOutput(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Output(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedOutput::Fl_DerivedOutput(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Output(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedOutput::~Fl_DerivedOutput(){ + free(overriddenFuncs); + } + void Fl_DerivedOutput::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Output) this); + } + else { + Fl_Output::draw(); + } + } + + void Fl_DerivedOutput::draw_super(){ + Fl_Output::draw(); + } + + int Fl_DerivedOutput::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Output) this,event); + } + else { + i = Fl_Output::handle(event); + } + return i; + } + int Fl_DerivedOutput::handle_super(int event){ + return Fl_Output::handle(event); + } + + void Fl_DerivedOutput::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Output) this,x,y,w,h); + } + else { + Fl_Output::resize(x,y,w,h); + } + } + + void Fl_DerivedOutput::resize_super(int x, int y, int w, int h){ + Fl_Output::resize(x,y,w,h); + } + void Fl_DerivedOutput::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Output) this); + } + else { + Fl_Output::show(); + } + } + void Fl_DerivedOutput::show_super(){ + Fl_Output::show(); + } + + void Fl_DerivedOutput::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Output) this); + } + else { + Fl_Output::hide(); + } + } + void Fl_DerivedOutput::hide_super(){ + Fl_Output::hide(); + } + + #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int,Fl_Output_handle)(fl_Output self, int event){ - return (static_cast(self))->handle(event); - } FL_EXPORT_C(fl_Group,Fl_Output_parent)(fl_Output output){ return (fl_Group) (static_cast(output))->parent(); } @@ -267,21 +339,9 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Output_as_gl_window)(fl_Output output){ return (fl_Gl_Window) (static_cast(output))->as_gl_window(); } - /* Fl_Output specific functions */ - FL_EXPORT_C(fl_Output, Fl_Output_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Output* output = new Fl_Output(x,y,w,h,label); - return (static_cast(output)); - } - FL_EXPORT_C(fl_Output, Fl_Output_New)(int x, int y, int w, int h) { - Fl_Output* output = new Fl_Output(x,y,w,h,0); - return (fl_Output)output; - } FL_EXPORT_C(void,Fl_Output_Destroy)(fl_Output output){ delete (static_cast(output)); } - FL_EXPORT_C(void,Fl_Output_resize)(fl_Output output,int X,int Y,int W,int H){ - (static_cast(output))->resize(X,Y,W,H); - } FL_EXPORT_C(int,Fl_Output_set_value)(fl_Output output,const char* text){ return (static_cast(output))->value(text); } @@ -411,6 +471,55 @@ EXPORT { FL_EXPORT_C(int,Fl_Output_set_tab_nav)(fl_Output output){ return (static_cast(output))->tab_nav(); } + FL_EXPORT_C(fl_Output, Fl_Output_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedOutput* w = new Fl_DerivedOutput(X,Y,W,H,fs); + return (fl_Output)w; + } + FL_EXPORT_C(fl_Output, Fl_Output_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedOutput* w = new Fl_DerivedOutput(X,Y,W,H,label,fs); + return (fl_Output)w; + } + FL_EXPORT_C(fl_Output, Fl_OverriddenOutput_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedOutput* w = new Fl_DerivedOutput(X,Y,W,H,fs); + return (fl_Output)w; + } + FL_EXPORT_C(fl_Output, Fl_OverriddenOutput_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedOutput* w = new Fl_DerivedOutput(X,Y,W,H,label,fs); + return (fl_Output)w; + } + FL_EXPORT_C(void, Fl_Output_draw)(fl_Output o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Output_draw_super)(fl_Output o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Output_handle)(fl_Output o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Output_handle_super)(fl_Output o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Output_resize)(fl_Output o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Output_resize_super)(fl_Output o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Output_show)(fl_Output o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Output_show_super)(fl_Output o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Output_hide)(fl_Output o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Output_hide_super)(fl_Output o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_OutputC.h b/c-src/Fl_OutputC.h index 8f4a12bc..f9d100ac 100644 --- a/c-src/Fl_OutputC.h +++ b/c-src/Fl_OutputC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Output.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedOutput : public Fl_Output { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedOutput(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedOutput(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedOutput(); + }; + #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Output_handle)(fl_Output self, int event); @@ -96,10 +116,10 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window, Fl_Output_as_gl_window)(fl_Output output); /* Fl_Output specific functions */ FL_EXPORT_C(int, Fl_Output_handle)(fl_Output output, int event); - FL_EXPORT_C(fl_Output, Fl_Output_New_WithLabel)(int x, int y, int w, int h, const char* label); - FL_EXPORT_C(fl_Output, Fl_Output_New)(int x, int y, int w, int h); + FL_EXPORT_C(fl_Output, Fl_Output_New_WithLabel)(int x, int y, int w, int h, const char* label); + FL_EXPORT_C(fl_Output, Fl_Output_New)(int x, int y, int w, int h); FL_EXPORT_C(void, Fl_Output_Destroy)(fl_Output output); - + FL_EXPORT_C(void, Fl_Output_resize)(fl_Output output, int X, int Y, int W, int H); FL_EXPORT_C(int, Fl_Output_set_value)(fl_Output output, const char*); FL_EXPORT_C(int, Fl_Output_set_value_with_length)(fl_Output output, const char* text, int length); @@ -144,6 +164,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Output_set_wrap)(fl_Output output,int b); FL_EXPORT_C(void, Fl_Output_tab_nav)(fl_Output output,int val); FL_EXPORT_C(int, Fl_Output_set_tab_nav)(fl_Output output); + FL_EXPORT_C(fl_Output, Fl_OverriddenOutput_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Output, Fl_OverriddenOutput_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Output_draw)(fl_Output o); + FL_EXPORT_C(void, Fl_Output_draw_super)(fl_Output o); + FL_EXPORT_C(int, Fl_Output_handle)(fl_Output o, int event); + FL_EXPORT_C(int, Fl_Output_handle_super)(fl_Output o, int event); + FL_EXPORT_C(void, Fl_Output_resize)(fl_Output o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Output_resize_super)(fl_Output o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Output_show)(fl_Output o); + FL_EXPORT_C(void, Fl_Output_show_super)(fl_Output o); + FL_EXPORT_C(void, Fl_Output_hide)(fl_Output o); + FL_EXPORT_C(void, Fl_Output_hide_super)(fl_Output o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_PackC.cpp b/c-src/Fl_PackC.cpp index c94dee61..5b3e8d33 100644 --- a/c-src/Fl_PackC.cpp +++ b/c-src/Fl_PackC.cpp @@ -1,6 +1,81 @@ #include "Fl_PackC.h" #ifdef __cplusplus EXPORT { + Fl_DerivedPack::Fl_DerivedPack(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Pack(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedPack::Fl_DerivedPack(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Pack(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedPack::~Fl_DerivedPack(){ + free(overriddenFuncs); + } + void Fl_DerivedPack::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Pack) this); + } + else { + Fl_Pack::draw(); + } + } + + void Fl_DerivedPack::draw_super(){ + Fl_Pack::draw(); + } + + int Fl_DerivedPack::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Pack) this,event); + } + else { + i = Fl_Pack::handle(event); + } + return i; + } + int Fl_DerivedPack::handle_super(int event){ + return Fl_Pack::handle(event); + } + + void Fl_DerivedPack::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Pack) this,x,y,w,h); + } + else { + Fl_Pack::resize(x,y,w,h); + } + } + + void Fl_DerivedPack::resize_super(int x, int y, int w, int h){ + Fl_Pack::resize(x,y,w,h); + } + void Fl_DerivedPack::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Pack) this); + } + else { + Fl_Pack::show(); + } + } + void Fl_DerivedPack::show_super(){ + Fl_Pack::show(); + } + + void Fl_DerivedPack::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Pack) this); + } + else { + Fl_Pack::hide(); + } + } + void Fl_DerivedPack::hide_super(){ + Fl_Pack::hide(); + } + + #endif FL_EXPORT_C(void ,Fl_Pack_set_spacing)(fl_Pack self, int pixels){ (static_cast(self))->spacing(pixels); @@ -11,21 +86,60 @@ EXPORT { FL_EXPORT_C(uchar, Fl_Pack_horizontal)(fl_Pack self){ return (static_cast(self))->horizontal(); } - FL_EXPORT_C(fl_Pack, Fl_Pack_New)(int x, int y, int w, int h){ - Fl_Pack* g = new Fl_Pack(x,y,w,h); - return (fl_Pack)g; - } - FL_EXPORT_C(fl_Pack, Fl_Pack_New_WithLabel)(int x, int y, int w, int h, const char* t){ - Fl_Pack* g = new Fl_Pack(x,y,w,h,t); - return (fl_Pack)g; - } FL_EXPORT_C(uchar,Fl_Pack_type)(fl_Pack win){ return (static_cast(win))->type(); } FL_EXPORT_C(void,Fl_Pack_set_type)(fl_Pack win,uchar t){ (static_cast(win))->type(t); } - + FL_EXPORT_C(fl_Pack, Fl_Pack_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedPack* w = new Fl_DerivedPack(X,Y,W,H,fs); + return (fl_Pack)w; + } + FL_EXPORT_C(fl_Pack, Fl_Pack_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedPack* w = new Fl_DerivedPack(X,Y,W,H,label,fs); + return (fl_Pack)w; + } + FL_EXPORT_C(fl_Pack, Fl_OverriddenPack_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedPack* w = new Fl_DerivedPack(X,Y,W,H,fs); + return (fl_Pack)w; + } + FL_EXPORT_C(fl_Pack, Fl_OverriddenPack_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedPack* w = new Fl_DerivedPack(X,Y,W,H,label,fs); + return (fl_Pack)w; + } + FL_EXPORT_C(void, Fl_Pack_draw)(fl_Pack o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Pack_draw_super)(fl_Pack o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Pack_handle)(fl_Pack o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Pack_handle_super)(fl_Pack o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Pack_resize)(fl_Pack o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Pack_resize_super)(fl_Pack o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Pack_show)(fl_Pack o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Pack_show_super)(fl_Pack o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Pack_hide)(fl_Pack o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Pack_hide_super)(fl_Pack o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_PackC.h b/c-src/Fl_PackC.h index c4c87ff5..cd4e24b2 100644 --- a/c-src/Fl_PackC.h +++ b/c-src/Fl_PackC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Pack.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedPack : public Fl_Pack { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedPack(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedPack(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedPack(); + }; #endif FL_EXPORT_C(uchar, Fl_Pack_type)(fl_Pack pack); FL_EXPORT_C(void, Fl_Pack_set_type)(fl_Pack pack, uchar); @@ -16,6 +35,18 @@ EXPORT { FL_EXPORT_C(uchar, Fl_Pack_horizontal)(fl_Pack p); FL_EXPORT_C(fl_Pack, Fl_Pack_New)(int x, int y, int w, int h); FL_EXPORT_C(fl_Pack, Fl_Pack_New_WithLabel)(int x, int y, int w, int h, const char* t); + FL_EXPORT_C(fl_Pack, Fl_OverriddenPack_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Pack, Fl_OverriddenPack_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Pack_draw)(fl_Pack o); + FL_EXPORT_C(void, Fl_Pack_draw_super)(fl_Pack o); + FL_EXPORT_C(int, Fl_Pack_handle)(fl_Pack o, int event); + FL_EXPORT_C(int, Fl_Pack_handle_super)(fl_Pack o, int event); + FL_EXPORT_C(void, Fl_Pack_resize)(fl_Pack o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Pack_resize_super)(fl_Pack o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Pack_show)(fl_Pack o); + FL_EXPORT_C(void, Fl_Pack_show_super)(fl_Pack o); + FL_EXPORT_C(void, Fl_Pack_hide)(fl_Pack o); + FL_EXPORT_C(void, Fl_Pack_hide_super)(fl_Pack o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_PositionerC.cpp b/c-src/Fl_PositionerC.cpp index 388b6d7a..85b09c74 100644 --- a/c-src/Fl_PositionerC.cpp +++ b/c-src/Fl_PositionerC.cpp @@ -1,19 +1,80 @@ #include "Fl_PositionerC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Positioner_handle )(fl_Positioner positioner, int event){ - return (static_cast(positioner))->handle(event); + Fl_DerivedPositioner::Fl_DerivedPositioner(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Positioner(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedPositioner::Fl_DerivedPositioner(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Positioner(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedPositioner::~Fl_DerivedPositioner(){ + free(overriddenFuncs); + } + void Fl_DerivedPositioner::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Positioner) this); + } + else { + Fl_Positioner::draw(); + } + } + + void Fl_DerivedPositioner::draw_super(){ + Fl_Positioner::draw(); + } + + int Fl_DerivedPositioner::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Positioner) this,event); + } + else { + i = Fl_Positioner::handle(event); + } + return i; + } + int Fl_DerivedPositioner::handle_super(int event){ + return Fl_Positioner::handle(event); + } + + void Fl_DerivedPositioner::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Positioner) this,x,y,w,h); + } + else { + Fl_Positioner::resize(x,y,w,h); + } } - FL_EXPORT_C(void,Fl_Positioner_resize )(fl_Positioner positioner,int x, int y, int w, int h){ - (static_cast(positioner))->resize(x,y,w,h); + + void Fl_DerivedPositioner::resize_super(int x, int y, int w, int h){ + Fl_Positioner::resize(x,y,w,h); } - FL_EXPORT_C(void,Fl_Positioner_show )(fl_Positioner positioner){ - (static_cast(positioner))->show(); + void Fl_DerivedPositioner::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Positioner) this); + } + else { + Fl_Positioner::show(); + } } - FL_EXPORT_C(void,Fl_Positioner_hide )(fl_Positioner positioner){ - (static_cast(positioner))->hide(); + void Fl_DerivedPositioner::show_super(){ + Fl_Positioner::show(); } + + void Fl_DerivedPositioner::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Positioner) this); + } + else { + Fl_Positioner::hide(); + } + } + void Fl_DerivedPositioner::hide_super(){ + Fl_Positioner::hide(); + } +#endif FL_EXPORT_C(fl_Window,Fl_Positioner_as_window )(fl_Positioner positioner){ return (static_cast(positioner))->as_window(); } @@ -276,14 +337,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Positioner_as_gl_window)(fl_Positioner positioner){ return (fl_Gl_Window) (static_cast(positioner))->as_gl_window(); } - FL_EXPORT_C(fl_Positioner, Fl_Positioner_New)(int x, int y, int w, int h){ - Fl_Positioner* p = new Fl_Positioner(x,y,w,h); - return (fl_Positioner)p; - } - FL_EXPORT_C(fl_Positioner, Fl_Positioner_New_WithLabel)(int x, int y, int w, int h,const char *l){ - Fl_Positioner* p = new Fl_Positioner(x,y,w,h,l); - return (fl_Positioner)p; - } FL_EXPORT_C(void , Fl_Positioner_Destroy)(fl_Positioner positioner){ delete (static_cast(positioner)); } @@ -335,6 +388,54 @@ EXPORT { FL_EXPORT_C(void,Fl_Positioner_ystep)(fl_Positioner positioner,double x){ (static_cast(positioner))->ystep(x); } + FL_EXPORT_C(fl_Positioner, Fl_Positioner_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedPositioner* w = new Fl_DerivedPositioner(X,Y,W,H,fs); + return (fl_Positioner)w; + } + FL_EXPORT_C(fl_Positioner, Fl_Positioner_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedPositioner* w = new Fl_DerivedPositioner(X,Y,W,H,label,fs); + return (fl_Positioner)w; + } + FL_EXPORT_C(fl_Positioner, Fl_OverriddenPositioner_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedPositioner* w = new Fl_DerivedPositioner(X,Y,W,H,fs); + return (fl_Positioner)w; + } + FL_EXPORT_C(fl_Positioner, Fl_OverriddenPositioner_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedPositioner* w = new Fl_DerivedPositioner(X,Y,W,H,label,fs); + return (fl_Positioner)w; + } + FL_EXPORT_C(void, Fl_Positioner_draw)(fl_Positioner o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Positioner_draw_super)(fl_Positioner o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Positioner_handle)(fl_Positioner o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Positioner_handle_super)(fl_Positioner o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Positioner_resize)(fl_Positioner o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Positioner_resize_super)(fl_Positioner o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Positioner_show)(fl_Positioner o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Positioner_show_super)(fl_Positioner o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Positioner_hide)(fl_Positioner o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Positioner_hide_super)(fl_Positioner o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_PositionerC.h b/c-src/Fl_PositionerC.h index bce1d9a5..c96b68ce 100644 --- a/c-src/Fl_PositionerC.h +++ b/c-src/Fl_PositionerC.h @@ -7,13 +7,28 @@ #include "FL/Fl.H" #include "FL/Fl_Positioner.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedPositioner : public Fl_Positioner { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedPositioner(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedPositioner(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedPositioner(); + }; #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int , Fl_Positioner_handle )(fl_Positioner positioner,int event); - FL_EXPORT_C(void, Fl_Positioner_resize )(fl_Positioner positioner,int x, int y, int w, int h); - FL_EXPORT_C(void, Fl_Positioner_show )(fl_Positioner positioner); - FL_EXPORT_C(void, Fl_Positioner_hide )(fl_Positioner positioner); FL_EXPORT_C(fl_Window, Fl_Positioner_as_window )(fl_Positioner positioner); FL_EXPORT_C(fl_Gl_Window, Fl_Positioner_as_gl_window)(fl_Positioner positioner); FL_EXPORT_C(fl_Group, Fl_Positioner_parent)(fl_Positioner positioner); @@ -119,6 +134,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Positioner_ybounds)(fl_Positioner positioner, double ystart, double yend); FL_EXPORT_C(void, Fl_Positioner_xstep)(fl_Positioner positioner, double xstep); FL_EXPORT_C(void, Fl_Positioner_ystep)(fl_Positioner positioner, double ystep); + FL_EXPORT_C(fl_Positioner, Fl_OverriddenPositioner_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Positioner, Fl_OverriddenPositioner_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Positioner_draw)(fl_Positioner o); + FL_EXPORT_C(void, Fl_Positioner_draw_super)(fl_Positioner o); + FL_EXPORT_C(int, Fl_Positioner_handle)(fl_Positioner o, int event); + FL_EXPORT_C(int, Fl_Positioner_handle_super)(fl_Positioner o, int event); + FL_EXPORT_C(void, Fl_Positioner_resize)(fl_Positioner o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Positioner_resize_super)(fl_Positioner o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Positioner_show)(fl_Positioner o); + FL_EXPORT_C(void, Fl_Positioner_show_super)(fl_Positioner o); + FL_EXPORT_C(void, Fl_Positioner_hide)(fl_Positioner o); + FL_EXPORT_C(void, Fl_Positioner_hide_super)(fl_Positioner o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ProgressC.cpp b/c-src/Fl_ProgressC.cpp index 474129c5..dcebb196 100644 --- a/c-src/Fl_ProgressC.cpp +++ b/c-src/Fl_ProgressC.cpp @@ -1,19 +1,82 @@ #include "Fl_ProgressC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Progress_handle )(fl_Progress progress, int event){ - return (static_cast(progress))->handle(event); + Fl_DerivedProgress::Fl_DerivedProgress(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Progress(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedProgress::Fl_DerivedProgress(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Progress(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedProgress::~Fl_DerivedProgress(){ + free(overriddenFuncs); + } + void Fl_DerivedProgress::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Progress) this); + } + else { + Fl_Progress::draw(); + } + } + + void Fl_DerivedProgress::draw_super(){ + Fl_Progress::draw(); + } + + int Fl_DerivedProgress::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Progress) this,event); + } + else { + i = Fl_Progress::handle(event); + } + return i; + } + int Fl_DerivedProgress::handle_super(int event){ + return Fl_Progress::handle(event); + } + + void Fl_DerivedProgress::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Progress) this,x,y,w,h); + } + else { + Fl_Progress::resize(x,y,w,h); + } + } + + void Fl_DerivedProgress::resize_super(int x, int y, int w, int h){ + Fl_Progress::resize(x,y,w,h); + } + void Fl_DerivedProgress::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Progress) this); + } + else { + Fl_Progress::show(); + } } - FL_EXPORT_C(void,Fl_Progress_resize )(fl_Progress progress,int x, int y, int w, int h){ - (static_cast(progress))->resize(x,y,w,h); + void Fl_DerivedProgress::show_super(){ + Fl_Progress::show(); } - FL_EXPORT_C(void,Fl_Progress_show )(fl_Progress progress){ - (static_cast(progress))->show(); + + void Fl_DerivedProgress::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Progress) this); + } + else { + Fl_Progress::hide(); + } } - FL_EXPORT_C(void,Fl_Progress_hide )(fl_Progress progress){ - (static_cast(progress))->hide(); + void Fl_DerivedProgress::hide_super(){ + Fl_Progress::hide(); } + + +#endif FL_EXPORT_C(fl_Window,Fl_Progress_as_window )(fl_Progress progress){ return (static_cast(progress))->as_window(); } @@ -276,14 +339,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Progress_as_gl_window)(fl_Progress progress){ return (fl_Gl_Window) (static_cast(progress))->as_gl_window(); } - FL_EXPORT_C(fl_Progress, Fl_Progress_New)(int x, int y, int w, int h){ - Fl_Progress* p = new Fl_Progress(x,y,w,h); - return (fl_Progress)p; - } - FL_EXPORT_C(fl_Progress, Fl_Progress_New_WithLabel)(int x, int y, int w, int h,const char *l){ - Fl_Progress* p = new Fl_Progress(x,y,w,h,l); - return (fl_Progress)p; - } FL_EXPORT_C(void , Fl_Progress_Destroy)(fl_Progress progress){ delete (static_cast(progress)); } @@ -305,6 +360,55 @@ EXPORT { FL_EXPORT_C(float,Fl_Progress_value)(fl_Progress progress){ return (static_cast(progress))->value(); } + FL_EXPORT_C(fl_Progress, Fl_Progress_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedProgress* w = new Fl_DerivedProgress(X,Y,W,H,fs); + return (fl_Progress)w; + } + FL_EXPORT_C(fl_Progress, Fl_Progress_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedProgress* w = new Fl_DerivedProgress(X,Y,W,H,label,fs); + return (fl_Progress)w; + } + FL_EXPORT_C(fl_Progress, Fl_OverriddenProgress_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedProgress* w = new Fl_DerivedProgress(X,Y,W,H,fs); + return (fl_Progress)w; + } + FL_EXPORT_C(fl_Progress, Fl_OverriddenProgress_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedProgress* w = new Fl_DerivedProgress(X,Y,W,H,label,fs); + return (fl_Progress)w; + } + FL_EXPORT_C(void, Fl_Progress_draw)(fl_Progress o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Progress_draw_super)(fl_Progress o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Progress_handle)(fl_Progress o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Progress_handle_super)(fl_Progress o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Progress_resize)(fl_Progress o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Progress_resize_super)(fl_Progress o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Progress_show)(fl_Progress o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Progress_show_super)(fl_Progress o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Progress_hide)(fl_Progress o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Progress_hide_super)(fl_Progress o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ProgressC.h b/c-src/Fl_ProgressC.h index d2b761f5..acb7624d 100644 --- a/c-src/Fl_ProgressC.h +++ b/c-src/Fl_ProgressC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Progress.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedProgress : public Fl_Progress { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedProgress(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedProgress(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedProgress(); + }; + #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int , Fl_Progress_handle )(fl_Progress progress,int event); @@ -109,6 +129,18 @@ EXPORT { FL_EXPORT_C(float, Fl_Progress_minimum)(fl_Progress progress); FL_EXPORT_C(void , Fl_Progress_set_value )(fl_Progress progress,float v); FL_EXPORT_C(float, Fl_Progress_value )(fl_Progress progress); + FL_EXPORT_C(fl_Progress, Fl_OverriddenProgress_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Progress, Fl_OverriddenProgress_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Progress_draw)(fl_Progress o); + FL_EXPORT_C(void, Fl_Progress_draw_super)(fl_Progress o); + FL_EXPORT_C(int, Fl_Progress_handle)(fl_Progress o, int event); + FL_EXPORT_C(int, Fl_Progress_handle_super)(fl_Progress o, int event); + FL_EXPORT_C(void, Fl_Progress_resize)(fl_Progress o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Progress_resize_super)(fl_Progress o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Progress_show)(fl_Progress o); + FL_EXPORT_C(void, Fl_Progress_show_super)(fl_Progress o); + FL_EXPORT_C(void, Fl_Progress_hide)(fl_Progress o); + FL_EXPORT_C(void, Fl_Progress_hide_super)(fl_Progress o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Repeat_ButtonC.cpp b/c-src/Fl_Repeat_ButtonC.cpp index 0b24c4b4..adf31e47 100644 --- a/c-src/Fl_Repeat_ButtonC.cpp +++ b/c-src/Fl_Repeat_ButtonC.cpp @@ -2,10 +2,82 @@ #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Repeat_Button_handle)(fl_Repeat_Button self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedRepeat_Button::Fl_DerivedRepeat_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Repeat_Button(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedRepeat_Button::Fl_DerivedRepeat_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Repeat_Button(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedRepeat_Button::~Fl_DerivedRepeat_Button(){ + free(overriddenFuncs); + } + void Fl_DerivedRepeat_Button::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Repeat_Button) this); + } + else { + Fl_Repeat_Button::draw(); + } + } + + void Fl_DerivedRepeat_Button::draw_super(){ + Fl_Repeat_Button::draw(); + } + + int Fl_DerivedRepeat_Button::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Repeat_Button) this,event); + } + else { + i = Fl_Repeat_Button::handle(event); + } + return i; + } + int Fl_DerivedRepeat_Button::handle_super(int event){ + return Fl_Repeat_Button::handle(event); + } + + void Fl_DerivedRepeat_Button::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Repeat_Button) this,x,y,w,h); + } + else { + Fl_Repeat_Button::resize(x,y,w,h); + } + } + + void Fl_DerivedRepeat_Button::resize_super(int x, int y, int w, int h){ + Fl_Repeat_Button::resize(x,y,w,h); + } + void Fl_DerivedRepeat_Button::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Repeat_Button) this); + } + else { + Fl_Repeat_Button::show(); + } } + void Fl_DerivedRepeat_Button::show_super(){ + Fl_Repeat_Button::show(); + } + + void Fl_DerivedRepeat_Button::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Repeat_Button) this); + } + else { + Fl_Repeat_Button::hide(); + } + } + void Fl_DerivedRepeat_Button::hide_super(){ + Fl_Repeat_Button::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Repeat_Button_parent)(fl_Repeat_Button b){ return (fl_Group) (static_cast(b))->parent(); } @@ -266,14 +338,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Repeat_Button_as_gl_window)(fl_Repeat_Button repeat_button){ return (fl_Gl_Window) (static_cast(repeat_button))->as_gl_window(); } - FL_EXPORT_C(fl_Repeat_Button, Fl_Repeat_Button_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Repeat_Button* button = new Fl_Repeat_Button(x,y,w,h,label); - return (static_cast(button)); - } - FL_EXPORT_C(fl_Repeat_Button, Fl_Repeat_Button_New)(int x, int y, int w, int h) { - Fl_Repeat_Button* button = new Fl_Repeat_Button(x,y,w,h,0); - return (fl_Repeat_Button)button; - } FL_EXPORT_C(void,Fl_Repeat_Button_Destroy)(fl_Repeat_Button button){ delete (static_cast(button)); } @@ -307,6 +371,54 @@ EXPORT { FL_EXPORT_C(void,Fl_Repeat_Button_set_down_color)(fl_Repeat_Button b,Fl_Color c){ (static_cast(b))->down_color(c); } + FL_EXPORT_C(fl_Repeat_Button, Fl_Repeat_Button_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedRepeat_Button* w = new Fl_DerivedRepeat_Button(X,Y,W,H,fs); + return (fl_Repeat_Button)w; + } + FL_EXPORT_C(fl_Repeat_Button, Fl_Repeat_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedRepeat_Button* w = new Fl_DerivedRepeat_Button(X,Y,W,H,label,fs); + return (fl_Repeat_Button)w; + } + FL_EXPORT_C(fl_Repeat_Button, Fl_OverriddenRepeat_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedRepeat_Button* w = new Fl_DerivedRepeat_Button(X,Y,W,H,fs); + return (fl_Repeat_Button)w; + } + FL_EXPORT_C(fl_Repeat_Button, Fl_OverriddenRepeat_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedRepeat_Button* w = new Fl_DerivedRepeat_Button(X,Y,W,H,label,fs); + return (fl_Repeat_Button)w; + } + FL_EXPORT_C(void, Fl_Repeat_Button_draw)(fl_Repeat_Button o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Repeat_Button_draw_super)(fl_Repeat_Button o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Repeat_Button_handle)(fl_Repeat_Button o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Repeat_Button_handle_super)(fl_Repeat_Button o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Repeat_Button_resize)(fl_Repeat_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Repeat_Button_resize_super)(fl_Repeat_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Repeat_Button_show)(fl_Repeat_Button o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Repeat_Button_show_super)(fl_Repeat_Button o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Repeat_Button_hide)(fl_Repeat_Button o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Repeat_Button_hide_super)(fl_Repeat_Button o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Repeat_ButtonC.h b/c-src/Fl_Repeat_ButtonC.h index d51b71a0..6423edbd 100644 --- a/c-src/Fl_Repeat_ButtonC.h +++ b/c-src/Fl_Repeat_ButtonC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Repeat_Button.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedRepeat_Button : public Fl_Repeat_Button { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedRepeat_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedRepeat_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedRepeat_Button(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Repeat_Button_handle)(fl_Repeat_Button self, int event); @@ -109,6 +128,18 @@ EXPORT { FL_EXPORT_C(void , Fl_Repeat_Button_set_down_box)(fl_Repeat_Button b,Fl_Boxtype boxtype); FL_EXPORT_C(Fl_Color , Fl_Repeat_Button_down_color )(fl_Repeat_Button b); FL_EXPORT_C(void , Fl_Repeat_Button_set_down_color)(fl_Repeat_Button b, Fl_Color c); + FL_EXPORT_C(fl_Repeat_Button, Fl_OverriddenRepeat_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Repeat_Button, Fl_OverriddenRepeat_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Repeat_Button_draw)(fl_Repeat_Button o); + FL_EXPORT_C(void, Fl_Repeat_Button_draw_super)(fl_Repeat_Button o); + FL_EXPORT_C(int, Fl_Repeat_Button_handle)(fl_Repeat_Button o, int event); + FL_EXPORT_C(int, Fl_Repeat_Button_handle_super)(fl_Repeat_Button o, int event); + FL_EXPORT_C(void, Fl_Repeat_Button_resize)(fl_Repeat_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Repeat_Button_resize_super)(fl_Repeat_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Repeat_Button_show)(fl_Repeat_Button o); + FL_EXPORT_C(void, Fl_Repeat_Button_show_super)(fl_Repeat_Button o); + FL_EXPORT_C(void, Fl_Repeat_Button_hide)(fl_Repeat_Button o); + FL_EXPORT_C(void, Fl_Repeat_Button_hide_super)(fl_Repeat_Button o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Return_ButtonC.cpp b/c-src/Fl_Return_ButtonC.cpp index 1dc165d2..5630e093 100644 --- a/c-src/Fl_Return_ButtonC.cpp +++ b/c-src/Fl_Return_ButtonC.cpp @@ -2,10 +2,82 @@ #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Return_Button_handle)(fl_Return_Button self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedReturn_Button::Fl_DerivedReturn_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Return_Button(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedReturn_Button::Fl_DerivedReturn_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Return_Button(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedReturn_Button::~Fl_DerivedReturn_Button(){ + free(overriddenFuncs); + } + void Fl_DerivedReturn_Button::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Return_Button) this); + } + else { + Fl_Return_Button::draw(); + } + } + + void Fl_DerivedReturn_Button::draw_super(){ + Fl_Return_Button::draw(); + } + + int Fl_DerivedReturn_Button::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Return_Button) this,event); + } + else { + i = Fl_Return_Button::handle(event); + } + return i; + } + int Fl_DerivedReturn_Button::handle_super(int event){ + return Fl_Return_Button::handle(event); + } + + void Fl_DerivedReturn_Button::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Return_Button) this,x,y,w,h); + } + else { + Fl_Return_Button::resize(x,y,w,h); + } + } + + void Fl_DerivedReturn_Button::resize_super(int x, int y, int w, int h){ + Fl_Return_Button::resize(x,y,w,h); + } + void Fl_DerivedReturn_Button::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Return_Button) this); + } + else { + Fl_Return_Button::show(); + } + } + void Fl_DerivedReturn_Button::show_super(){ + Fl_Return_Button::show(); } + + void Fl_DerivedReturn_Button::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Return_Button) this); + } + else { + Fl_Return_Button::hide(); + } + } + void Fl_DerivedReturn_Button::hide_super(){ + Fl_Return_Button::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Return_Button_parent)(fl_Return_Button b){ return (fl_Group) (static_cast(b))->parent(); } @@ -266,14 +338,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Return_Button_as_gl_window)(fl_Return_Button return_button){ return (fl_Gl_Window) (static_cast(return_button))->as_gl_window(); } - FL_EXPORT_C(fl_Return_Button, Fl_Return_Button_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Return_Button* button = new Fl_Return_Button(x,y,w,h,label); - return (static_cast(button)); - } - FL_EXPORT_C(fl_Return_Button, Fl_Return_Button_New)(int x, int y, int w, int h) { - Fl_Return_Button* button = new Fl_Return_Button(x,y,w,h,0); - return (fl_Return_Button)button; - } FL_EXPORT_C(void,Fl_Return_Button_Destroy)(fl_Return_Button button){ delete (static_cast(button)); } @@ -307,6 +371,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Return_Button_set_down_color)(fl_Return_Button b,Fl_Color c){ (static_cast(b))->down_color(c); } + FL_EXPORT_C(void, Fl_Return_Button_draw)(fl_Return_Button o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Return_Button_draw_super)(fl_Return_Button o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Return_Button_handle)(fl_Return_Button o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Return_Button_handle_super)(fl_Return_Button o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Return_Button_resize)(fl_Return_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Return_Button_resize_super)(fl_Return_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Return_Button_show)(fl_Return_Button o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Return_Button_show_super)(fl_Return_Button o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Return_Button_hide)(fl_Return_Button o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Return_Button_hide_super)(fl_Return_Button o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Return_Button, Fl_Return_Button_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedReturn_Button* w = new Fl_DerivedReturn_Button(X,Y,W,H,fs); + return (fl_Return_Button)w; + } + FL_EXPORT_C(fl_Return_Button, Fl_Return_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedReturn_Button* w = new Fl_DerivedReturn_Button(X,Y,W,H,label,fs); + return (fl_Return_Button)w; + } + FL_EXPORT_C(fl_Return_Button, Fl_OverriddenReturn_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedReturn_Button* w = new Fl_DerivedReturn_Button(X,Y,W,H,fs); + return (fl_Return_Button)w; + } + FL_EXPORT_C(fl_Return_Button, Fl_OverriddenReturn_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedReturn_Button* w = new Fl_DerivedReturn_Button(X,Y,W,H,label,fs); + return (fl_Return_Button)w; + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Return_ButtonC.h b/c-src/Fl_Return_ButtonC.h index c83d1071..7972b0ce 100644 --- a/c-src/Fl_Return_ButtonC.h +++ b/c-src/Fl_Return_ButtonC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Return_Button.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedReturn_Button : public Fl_Return_Button { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedReturn_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedReturn_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedReturn_Button(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Return_Button_handle)(fl_Return_Button self, int event); @@ -109,6 +128,18 @@ EXPORT { FL_EXPORT_C(void , Fl_Return_Button_set_down_box)(fl_Return_Button b,Fl_Boxtype boxtype); FL_EXPORT_C(Fl_Color , Fl_Return_Button_down_color )(fl_Return_Button b); FL_EXPORT_C(void , Fl_Return_Button_set_down_color)(fl_Return_Button b, Fl_Color c); + FL_EXPORT_C(fl_Return_Button, Fl_OverriddenReturn_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Return_Button, Fl_OverriddenReturn_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Return_Button_draw)(fl_Return_Button o); + FL_EXPORT_C(void, Fl_Return_Button_draw_super)(fl_Return_Button o); + FL_EXPORT_C(int, Fl_Return_Button_handle)(fl_Return_Button o, int event); + FL_EXPORT_C(int, Fl_Return_Button_handle_super)(fl_Return_Button o, int event); + FL_EXPORT_C(void, Fl_Return_Button_resize)(fl_Return_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Return_Button_resize_super)(fl_Return_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Return_Button_show)(fl_Return_Button o); + FL_EXPORT_C(void, Fl_Return_Button_show_super)(fl_Return_Button o); + FL_EXPORT_C(void, Fl_Return_Button_hide)(fl_Return_Button o); + FL_EXPORT_C(void, Fl_Return_Button_hide_super)(fl_Return_Button o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_RollerC.cpp b/c-src/Fl_RollerC.cpp index e88dc809..f82a7bcd 100644 --- a/c-src/Fl_RollerC.cpp +++ b/c-src/Fl_RollerC.cpp @@ -1,7 +1,82 @@ #include "Fl_RollerC.h" #ifdef __cplusplus EXPORT { -#endif + Fl_DerivedRoller::Fl_DerivedRoller(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Roller(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedRoller::Fl_DerivedRoller(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Roller(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedRoller::~Fl_DerivedRoller(){ + free(overriddenFuncs); + } + void Fl_DerivedRoller::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Roller) this); + } + else { + Fl_Roller::draw(); + } + } + + void Fl_DerivedRoller::draw_super(){ + Fl_Roller::draw(); + } + + int Fl_DerivedRoller::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Roller) this,event); + } + else { + i = Fl_Roller::handle(event); + } + return i; + } + int Fl_DerivedRoller::handle_super(int event){ + return Fl_Roller::handle(event); + } + + void Fl_DerivedRoller::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Roller) this,x,y,w,h); + } + else { + Fl_Roller::resize(x,y,w,h); + } + } + + void Fl_DerivedRoller::resize_super(int x, int y, int w, int h){ + Fl_Roller::resize(x,y,w,h); + } + void Fl_DerivedRoller::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Roller) this); + } + else { + Fl_Roller::show(); + } + } + void Fl_DerivedRoller::show_super(){ + Fl_Roller::show(); + } + + void Fl_DerivedRoller::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Roller) this); + } + else { + Fl_Roller::hide(); + } + } + void Fl_DerivedRoller::hide_super(){ + Fl_Roller::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Roller_parent)(fl_Roller roller){ return (static_cast(roller))->parent(); } @@ -152,12 +227,6 @@ EXPORT { FL_EXPORT_C(int,Fl_Roller_visible_r)(fl_Roller roller){ return (static_cast(roller))->visible_r(); } - FL_EXPORT_C(void,Fl_Roller_show)(fl_Roller roller){ - (static_cast(roller))->show(); - } - FL_EXPORT_C(void,Fl_Roller_hide)(fl_Roller roller){ - (static_cast(roller))->hide(); - } FL_EXPORT_C(void,Fl_Roller_set_visible)(fl_Roller roller){ (static_cast(roller))->visible(); } @@ -254,9 +323,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Roller_as_gl_window)(fl_Roller roller){ return (static_cast(roller))->as_gl_window(); } - FL_EXPORT_C(void,Fl_Roller_resize)(fl_Roller roller,int X,int Y,int W,int H){ - (static_cast(roller))->resize(X,Y,W,H); - } FL_EXPORT_C(void,Fl_Roller_bounds)(fl_Roller roller,double a,double b){ (static_cast(roller))->bounds(a,b); } @@ -308,20 +374,58 @@ EXPORT { FL_EXPORT_C(double,Fl_Roller_increment)(fl_Roller roller,double v,int n){ return (static_cast(roller))->increment(v,n); } - FL_EXPORT_C(fl_Roller,Fl_Roller_New_WithLabel)(int x,int y,int w,int h,const char* label){ - Fl_Roller* roller = new Fl_Roller(x,y,w,h,label); - return (fl_Roller) roller; - } - FL_EXPORT_C(fl_Roller,Fl_Roller_New)(int x,int y,int w,int h){ - Fl_Roller* roller = new Fl_Roller(x,y,w,h); - return (fl_Roller) roller; - } FL_EXPORT_C(void,Fl_Roller_Destroy)(fl_Roller roller){ delete (static_cast(roller)); } - FL_EXPORT_C(int,Fl_Roller_handle)(fl_Roller roller,int event){ - return (static_cast(roller))->handle(event); + FL_EXPORT_C(fl_Roller, Fl_Roller_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedRoller* w = new Fl_DerivedRoller(X,Y,W,H,fs); + return (fl_Roller)w; + } + FL_EXPORT_C(fl_Roller, Fl_Roller_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedRoller* w = new Fl_DerivedRoller(X,Y,W,H,label,fs); + return (fl_Roller)w; + } + FL_EXPORT_C(fl_Roller, Fl_OverriddenRoller_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedRoller* w = new Fl_DerivedRoller(X,Y,W,H,fs); + return (fl_Roller)w; + } + FL_EXPORT_C(fl_Roller, Fl_OverriddenRoller_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedRoller* w = new Fl_DerivedRoller(X,Y,W,H,label,fs); + return (fl_Roller)w; + } + FL_EXPORT_C(void, Fl_Roller_draw)(fl_Roller o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Roller_draw_super)(fl_Roller o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Roller_handle)(fl_Roller o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Roller_handle_super)(fl_Roller o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Roller_resize)(fl_Roller o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Roller_resize_super)(fl_Roller o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Roller_show)(fl_Roller o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Roller_show_super)(fl_Roller o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Roller_hide)(fl_Roller o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Roller_hide_super)(fl_Roller o){ + (static_cast(o))->hide_super(); } + #ifdef __cplusplus } -#endif +#endif diff --git a/c-src/Fl_RollerC.h b/c-src/Fl_RollerC.h index 130e710e..a852132a 100644 --- a/c-src/Fl_RollerC.h +++ b/c-src/Fl_RollerC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Roller.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedRoller : public Fl_Roller { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedRoller(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedRoller(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedRoller(); + }; + #endif FL_EXPORT_C(fl_Group, Fl_Roller_parent)(fl_Roller roller); FL_EXPORT_C(void, Fl_Roller_set_parent)(fl_Roller roller, fl_Group grp); @@ -117,6 +137,18 @@ EXPORT { FL_EXPORT_C(fl_Roller , Fl_Roller_New)(int x, int y, int w, int h); FL_EXPORT_C(void, Fl_Roller_Destroy)(fl_Roller roller); FL_EXPORT_C(int, Fl_Roller_handle)(fl_Roller roller, int event); + FL_EXPORT_C(fl_Roller, Fl_OverriddenRoller_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Roller, Fl_OverriddenRoller_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Roller_draw)(fl_Roller o); + FL_EXPORT_C(void, Fl_Roller_draw_super)(fl_Roller o); + FL_EXPORT_C(int, Fl_Roller_handle)(fl_Roller o, int event); + FL_EXPORT_C(int, Fl_Roller_handle_super)(fl_Roller o, int event); + FL_EXPORT_C(void, Fl_Roller_resize)(fl_Roller o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Roller_resize_super)(fl_Roller o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Roller_show)(fl_Roller o); + FL_EXPORT_C(void, Fl_Roller_show_super)(fl_Roller o); + FL_EXPORT_C(void, Fl_Roller_hide)(fl_Roller o); + FL_EXPORT_C(void, Fl_Roller_hide_super)(fl_Roller o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Round_ButtonC.cpp b/c-src/Fl_Round_ButtonC.cpp index b68377f9..2bba6efa 100644 --- a/c-src/Fl_Round_ButtonC.cpp +++ b/c-src/Fl_Round_ButtonC.cpp @@ -2,10 +2,82 @@ #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Round_Button_handle)(fl_Round_Button self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedRound_Button::Fl_DerivedRound_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Round_Button(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedRound_Button::Fl_DerivedRound_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Round_Button(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedRound_Button::~Fl_DerivedRound_Button(){ + free(overriddenFuncs); + } + void Fl_DerivedRound_Button::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Round_Button) this); + } + else { + Fl_Round_Button::draw(); + } + } + + void Fl_DerivedRound_Button::draw_super(){ + Fl_Round_Button::draw(); + } + + int Fl_DerivedRound_Button::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Round_Button) this,event); + } + else { + i = Fl_Round_Button::handle(event); + } + return i; + } + int Fl_DerivedRound_Button::handle_super(int event){ + return Fl_Round_Button::handle(event); + } + + void Fl_DerivedRound_Button::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Round_Button) this,x,y,w,h); + } + else { + Fl_Round_Button::resize(x,y,w,h); + } + } + + void Fl_DerivedRound_Button::resize_super(int x, int y, int w, int h){ + Fl_Round_Button::resize(x,y,w,h); + } + void Fl_DerivedRound_Button::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Round_Button) this); + } + else { + Fl_Round_Button::show(); + } + } + void Fl_DerivedRound_Button::show_super(){ + Fl_Round_Button::show(); } + + void Fl_DerivedRound_Button::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Round_Button) this); + } + else { + Fl_Round_Button::hide(); + } + } + void Fl_DerivedRound_Button::hide_super(){ + Fl_Round_Button::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Round_Button_parent)(fl_Round_Button b){ return (fl_Group) (static_cast(b))->parent(); } @@ -266,14 +338,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Round_Button_as_gl_window)(fl_Round_Button round_button){ return (fl_Gl_Window) (static_cast(round_button))->as_gl_window(); } - FL_EXPORT_C(fl_Round_Button, Fl_Round_Button_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Round_Button* button = new Fl_Round_Button(x,y,w,h,label); - return (static_cast(button)); - } - FL_EXPORT_C(fl_Round_Button, Fl_Round_Button_New)(int x, int y, int w, int h) { - Fl_Round_Button* button = new Fl_Round_Button(x,y,w,h,0); - return (fl_Round_Button)button; - } FL_EXPORT_C(void,Fl_Round_Button_Destroy)(fl_Round_Button button){ delete (static_cast(button)); } @@ -307,6 +371,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Round_Button_set_down_color)(fl_Round_Button b,Fl_Color c){ (static_cast(b))->down_color(c); } + FL_EXPORT_C(fl_Round_Button, Fl_Round_Button_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedRound_Button* w = new Fl_DerivedRound_Button(X,Y,W,H,fs); + return (fl_Round_Button)w; + } + FL_EXPORT_C(fl_Round_Button, Fl_Round_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedRound_Button* w = new Fl_DerivedRound_Button(X,Y,W,H,label,fs); + return (fl_Round_Button)w; + } + FL_EXPORT_C(fl_Round_Button, Fl_OverriddenRound_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedRound_Button* w = new Fl_DerivedRound_Button(X,Y,W,H,fs); + return (fl_Round_Button)w; + } + FL_EXPORT_C(fl_Round_Button, Fl_OverriddenRound_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedRound_Button* w = new Fl_DerivedRound_Button(X,Y,W,H,label,fs); + return (fl_Round_Button)w; + } + FL_EXPORT_C(void, Fl_Round_Button_draw)(fl_Round_Button o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Round_Button_draw_super)(fl_Round_Button o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Round_Button_handle)(fl_Round_Button o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Round_Button_handle_super)(fl_Round_Button o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Round_Button_resize)(fl_Round_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Round_Button_resize_super)(fl_Round_Button o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Round_Button_show)(fl_Round_Button o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Round_Button_show_super)(fl_Round_Button o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Round_Button_hide)(fl_Round_Button o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Round_Button_hide_super)(fl_Round_Button o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Round_ButtonC.h b/c-src/Fl_Round_ButtonC.h index 8f0dde6d..fad572c2 100644 --- a/c-src/Fl_Round_ButtonC.h +++ b/c-src/Fl_Round_ButtonC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Round_Button.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedRound_Button : public Fl_Round_Button { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedRound_Button(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedRound_Button(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedRound_Button(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Round_Button_handle)(fl_Round_Button self, int event); @@ -109,6 +128,18 @@ EXPORT { FL_EXPORT_C(void , Fl_Round_Button_set_down_box)(fl_Round_Button b,Fl_Boxtype boxtype); FL_EXPORT_C(Fl_Color , Fl_Round_Button_down_color )(fl_Round_Button b); FL_EXPORT_C(void , Fl_Round_Button_set_down_color)(fl_Round_Button b, Fl_Color c); + FL_EXPORT_C(fl_Round_Button, Fl_OverriddenRound_Button_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Round_Button, Fl_OverriddenRound_Button_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Round_Button_draw)(fl_Round_Button o); + FL_EXPORT_C(void, Fl_Round_Button_draw_super)(fl_Round_Button o); + FL_EXPORT_C(int, Fl_Round_Button_handle)(fl_Round_Button o, int event); + FL_EXPORT_C(int, Fl_Round_Button_handle_super)(fl_Round_Button o, int event); + FL_EXPORT_C(void, Fl_Round_Button_resize)(fl_Round_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Round_Button_resize_super)(fl_Round_Button o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Round_Button_show)(fl_Round_Button o); + FL_EXPORT_C(void, Fl_Round_Button_show_super)(fl_Round_Button o); + FL_EXPORT_C(void, Fl_Round_Button_hide)(fl_Round_Button o); + FL_EXPORT_C(void, Fl_Round_Button_hide_super)(fl_Round_Button o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ScrollC.cpp b/c-src/Fl_ScrollC.cpp index 41f6983b..40a1584d 100644 --- a/c-src/Fl_ScrollC.cpp +++ b/c-src/Fl_ScrollC.cpp @@ -1,6 +1,79 @@ #include "Fl_ScrollC.h" #ifdef __cplusplus EXPORT { + Fl_DerivedScroll::Fl_DerivedScroll(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Scroll(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedScroll::Fl_DerivedScroll(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Scroll(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedScroll::~Fl_DerivedScroll(){ + free(overriddenFuncs); + } + void Fl_DerivedScroll::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Scroll) this); + } + else { + Fl_Scroll::draw(); + } + } + + void Fl_DerivedScroll::draw_super(){ + Fl_Scroll::draw(); + } + + int Fl_DerivedScroll::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Scroll) this,event); + } + else { + i = Fl_Scroll::handle(event); + } + return i; + } + int Fl_DerivedScroll::handle_super(int event){ + return Fl_Scroll::handle(event); + } + + void Fl_DerivedScroll::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Scroll) this,x,y,w,h); + } + else { + Fl_Scroll::resize(x,y,w,h); + } + } + + void Fl_DerivedScroll::resize_super(int x, int y, int w, int h){ + Fl_Scroll::resize(x,y,w,h); + } + void Fl_DerivedScroll::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Scroll) this); + } + else { + Fl_Scroll::show(); + } + } + void Fl_DerivedScroll::show_super(){ + Fl_Scroll::show(); + } + + void Fl_DerivedScroll::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Scroll) this); + } + else { + Fl_Scroll::hide(); + } + } + void Fl_DerivedScroll::hide_super(){ + Fl_Scroll::hide(); + } #endif FL_EXPORT_C(void,Fl_Scroll_set_scrollbar_size)(fl_Scroll widget,int size){ (static_cast(widget))->scrollbar_size(size); @@ -26,19 +99,53 @@ EXPORT { FL_EXPORT_C(void,Fl_Scroll_set_type)(fl_Scroll widget,uchar t){ (static_cast(widget))->type(t); } - FL_EXPORT_C(void,Fl_Scroll_resize)(fl_Scroll scroll,int X,int Y,int W,int H){ - (static_cast(scroll))->resize(X,Y,W,H); + FL_EXPORT_C(fl_Scroll, Fl_Scroll_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedScroll* w = new Fl_DerivedScroll(X,Y,W,H,fs); + return (fl_Scroll)w; + } + FL_EXPORT_C(fl_Scroll, Fl_Scroll_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedScroll* w = new Fl_DerivedScroll(X,Y,W,H,label,fs); + return (fl_Scroll)w; + } + FL_EXPORT_C(fl_Scroll, Fl_OverriddenScroll_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedScroll* w = new Fl_DerivedScroll(X,Y,W,H,fs); + return (fl_Scroll)w; + } + FL_EXPORT_C(fl_Scroll, Fl_OverriddenScroll_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedScroll* w = new Fl_DerivedScroll(X,Y,W,H,label,fs); + return (fl_Scroll)w; + } + FL_EXPORT_C(void, Fl_Scroll_draw)(fl_Scroll o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Scroll_draw_super)(fl_Scroll o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Scroll_handle)(fl_Scroll o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Scroll_handle_super)(fl_Scroll o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Scroll_resize)(fl_Scroll o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Scroll_resize_super)(fl_Scroll o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Scroll_show)(fl_Scroll o){ + (static_cast(o))->show(); } - FL_EXPORT_C(int,Fl_Scroll_handle)(fl_Scroll self,int event){ - return (static_cast(self))->handle(event); + FL_EXPORT_C(void, Fl_Scroll_show_super)(fl_Scroll o){ + (static_cast(o))->show_super(); } - FL_EXPORT_C(fl_Scroll,Fl_Scroll_New_WithLabel)(int x,int y,int w,int h,const char* label){ - Fl_Scroll* scroll = new Fl_Scroll(x,y,w,h,label); - return (static_cast(scroll)); + FL_EXPORT_C(void, Fl_Scroll_hide)(fl_Scroll o){ + (static_cast(o))->hide(); } - FL_EXPORT_C(fl_Scroll,Fl_Scroll_New)(int x,int y,int w,int h){ - Fl_Scroll* scroll = new Fl_Scroll(x,y,w,h); - return (static_cast(scroll)); + FL_EXPORT_C(void, Fl_Scroll_hide_super)(fl_Scroll o){ + (static_cast(o))->hide_super(); } #ifdef __cplusplus } diff --git a/c-src/Fl_ScrollC.h b/c-src/Fl_ScrollC.h index a2190607..2ae1dac5 100644 --- a/c-src/Fl_ScrollC.h +++ b/c-src/Fl_ScrollC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Scroll.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedScroll : public Fl_Scroll { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedScroll(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedScroll(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedScroll(); + }; #endif FL_EXPORT_C(void, Fl_Scroll_set_scrollbar_size)(fl_Scroll widget, int size); FL_EXPORT_C(int, Fl_Scroll_get_scrollbar_size)(fl_Scroll widget); @@ -21,6 +40,18 @@ EXPORT { FL_EXPORT_C(int,Fl_Scroll_handle)(fl_Scroll scroll, int event); FL_EXPORT_C(fl_Scroll, Fl_Scroll_New_WithLabel)(int x, int y, int w, int h, const char* label); FL_EXPORT_C(fl_Scroll, Fl_Scroll_New)(int x, int y, int w, int h); + FL_EXPORT_C(fl_Scroll, Fl_OverriddenScroll_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Scroll, Fl_OverriddenScroll_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Scroll_draw)(fl_Scroll o); + FL_EXPORT_C(void, Fl_Scroll_draw_super)(fl_Scroll o); + FL_EXPORT_C(int, Fl_Scroll_handle)(fl_Scroll o, int event); + FL_EXPORT_C(int, Fl_Scroll_handle_super)(fl_Scroll o, int event); + FL_EXPORT_C(void, Fl_Scroll_resize)(fl_Scroll o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Scroll_resize_super)(fl_Scroll o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Scroll_show)(fl_Scroll o); + FL_EXPORT_C(void, Fl_Scroll_show_super)(fl_Scroll o); + FL_EXPORT_C(void, Fl_Scroll_hide)(fl_Scroll o); + FL_EXPORT_C(void, Fl_Scroll_hide_super)(fl_Scroll o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ScrollbarC.cpp b/c-src/Fl_ScrollbarC.cpp index abfb1408..0aae45ad 100644 --- a/c-src/Fl_ScrollbarC.cpp +++ b/c-src/Fl_ScrollbarC.cpp @@ -1,19 +1,80 @@ #include "Fl_ScrollbarC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Scrollbar_handle )(fl_Scrollbar slider, int event){ - return (static_cast(slider))->handle(event); + Fl_DerivedScrollbar::Fl_DerivedScrollbar(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Scrollbar(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedScrollbar::Fl_DerivedScrollbar(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Scrollbar(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedScrollbar::~Fl_DerivedScrollbar(){ + free(overriddenFuncs); + } + void Fl_DerivedScrollbar::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Scrollbar) this); + } + else { + Fl_Scrollbar::draw(); + } + } + + void Fl_DerivedScrollbar::draw_super(){ + Fl_Scrollbar::draw(); + } + + int Fl_DerivedScrollbar::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Scrollbar) this,event); + } + else { + i = Fl_Scrollbar::handle(event); + } + return i; + } + int Fl_DerivedScrollbar::handle_super(int event){ + return Fl_Scrollbar::handle(event); + } + + void Fl_DerivedScrollbar::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Scrollbar) this,x,y,w,h); + } + else { + Fl_Scrollbar::resize(x,y,w,h); + } } - FL_EXPORT_C(void,Fl_Scrollbar_resize )(fl_Scrollbar slider,int x, int y, int w, int h){ - (static_cast(slider))->resize(x,y,w,h); + + void Fl_DerivedScrollbar::resize_super(int x, int y, int w, int h){ + Fl_Scrollbar::resize(x,y,w,h); } - FL_EXPORT_C(void,Fl_Scrollbar_show )(fl_Scrollbar slider){ - (static_cast(slider))->show(); + void Fl_DerivedScrollbar::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Scrollbar) this); + } + else { + Fl_Scrollbar::show(); + } } - FL_EXPORT_C(void,Fl_Scrollbar_hide )(fl_Scrollbar slider){ - (static_cast(slider))->hide(); + void Fl_DerivedScrollbar::show_super(){ + Fl_Scrollbar::show(); } + + void Fl_DerivedScrollbar::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Scrollbar) this); + } + else { + Fl_Scrollbar::hide(); + } + } + void Fl_DerivedScrollbar::hide_super(){ + Fl_Scrollbar::hide(); + } +#endif FL_EXPORT_C(fl_Window,Fl_Scrollbar_as_window )(fl_Scrollbar slider){ return (static_cast(slider))->as_window(); } @@ -327,14 +388,6 @@ EXPORT { FL_EXPORT_C(double,Fl_Scrollbar_increment)(fl_Scrollbar slider,double v,int n){ return (static_cast(slider))->increment(v,n); } - FL_EXPORT_C(fl_Scrollbar, Fl_Scrollbar_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Scrollbar* slider = new Fl_Scrollbar(x,y,w,h,label); - return (static_cast(slider)); - } - FL_EXPORT_C(fl_Scrollbar, Fl_Scrollbar_New)(int x, int y, int w, int h) { - Fl_Scrollbar* slider = new Fl_Scrollbar(x,y,w,h,0); - return (fl_Scrollbar)slider; - } FL_EXPORT_C(void, Fl_Scrollbar_Destroy)(fl_Scrollbar slider){ delete (static_cast(slider)); } @@ -359,6 +412,54 @@ EXPORT { FL_EXPORT_C(int , Fl_Scrollbar_linesize)(fl_Scrollbar slider){ return (static_cast(slider))->linesize(); } + FL_EXPORT_C(void, Fl_Scrollbar_draw)(fl_Scrollbar o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Scrollbar_draw_super)(fl_Scrollbar o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Scrollbar_handle)(fl_Scrollbar o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Scrollbar_handle_super)(fl_Scrollbar o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Scrollbar_resize)(fl_Scrollbar o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Scrollbar_resize_super)(fl_Scrollbar o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Scrollbar_show)(fl_Scrollbar o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Scrollbar_show_super)(fl_Scrollbar o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Scrollbar_hide)(fl_Scrollbar o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Scrollbar_hide_super)(fl_Scrollbar o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Scrollbar, Fl_Scrollbar_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedScrollbar* w = new Fl_DerivedScrollbar(X,Y,W,H,fs); + return (fl_Scrollbar)w; + } + FL_EXPORT_C(fl_Scrollbar, Fl_Scrollbar_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedScrollbar* w = new Fl_DerivedScrollbar(X,Y,W,H,label,fs); + return (fl_Scrollbar)w; + } + FL_EXPORT_C(fl_Scrollbar, Fl_OverriddenScrollbar_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedScrollbar* w = new Fl_DerivedScrollbar(X,Y,W,H,fs); + return (fl_Scrollbar)w; + } + FL_EXPORT_C(fl_Scrollbar, Fl_OverriddenScrollbar_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedScrollbar* w = new Fl_DerivedScrollbar(X,Y,W,H,label,fs); + return (fl_Scrollbar)w; + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_ScrollbarC.h b/c-src/Fl_ScrollbarC.h index 097c5404..2f8606d2 100644 --- a/c-src/Fl_ScrollbarC.h +++ b/c-src/Fl_ScrollbarC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Scrollbar.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedScrollbar : public Fl_Scrollbar { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedScrollbar(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedScrollbar(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedScrollbar(); + }; #endif FL_EXPORT_C(int,Fl_Scrollbar_handle)(fl_Widget self, int event); FL_EXPORT_C(fl_Group, Fl_Scrollbar_parent)(fl_Scrollbar slider); @@ -124,6 +143,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Scrollbar_set_slider)(fl_Scrollbar slider, Fl_Boxtype c); FL_EXPORT_C(void, Fl_Scrollbar_set_linesize)(fl_Scrollbar slider, int i); FL_EXPORT_C(int , Fl_Scrollbar_linesize)(fl_Scrollbar slider); + FL_EXPORT_C(fl_Scrollbar, Fl_OverriddenScrollbar_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Scrollbar, Fl_OverriddenScrollbar_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Scrollbar_draw)(fl_Scrollbar o); + FL_EXPORT_C(void, Fl_Scrollbar_draw_super)(fl_Scrollbar o); + FL_EXPORT_C(int, Fl_Scrollbar_handle)(fl_Scrollbar o, int event); + FL_EXPORT_C(int, Fl_Scrollbar_handle_super)(fl_Scrollbar o, int event); + FL_EXPORT_C(void, Fl_Scrollbar_resize)(fl_Scrollbar o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Scrollbar_resize_super)(fl_Scrollbar o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Scrollbar_show)(fl_Scrollbar o); + FL_EXPORT_C(void, Fl_Scrollbar_show_super)(fl_Scrollbar o); + FL_EXPORT_C(void, Fl_Scrollbar_hide)(fl_Scrollbar o); + FL_EXPORT_C(void, Fl_Scrollbar_hide_super)(fl_Scrollbar o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_SliderC.cpp b/c-src/Fl_SliderC.cpp index e51f8844..f9189431 100644 --- a/c-src/Fl_SliderC.cpp +++ b/c-src/Fl_SliderC.cpp @@ -1,31 +1,80 @@ #include "Fl_SliderC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Slider_handle_super)(fl_Slider slider,int event){ - return (static_cast(slider))->Fl_Slider::handle(event); + Fl_DerivedSlider::Fl_DerivedSlider(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Slider(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedSlider::Fl_DerivedSlider(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Slider(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedSlider::~Fl_DerivedSlider(){ + free(overriddenFuncs); + } + void Fl_DerivedSlider::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Slider) this); + } + else { + Fl_Slider::draw(); + } + } + + void Fl_DerivedSlider::draw_super(){ + Fl_Slider::draw(); + } + + int Fl_DerivedSlider::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Slider) this,event); + } + else { + i = Fl_Slider::handle(event); + } + return i; } - FL_EXPORT_C(int,Fl_Slider_handle )(fl_Slider slider, int event){ - return (static_cast(slider))->handle(event); + int Fl_DerivedSlider::handle_super(int event){ + return Fl_Slider::handle(event); } - FL_EXPORT_C(void,Fl_Slider_resize_super )(fl_Slider slider,int x, int y, int w, int h){ - (static_cast(slider))->Fl_Slider::resize(x,y,w,h); + + void Fl_DerivedSlider::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Slider) this,x,y,w,h); + } + else { + Fl_Slider::resize(x,y,w,h); + } } - FL_EXPORT_C(void,Fl_Slider_resize )(fl_Slider slider,int x, int y, int w, int h){ - (static_cast(slider))->resize(x,y,w,h); + + void Fl_DerivedSlider::resize_super(int x, int y, int w, int h){ + Fl_Slider::resize(x,y,w,h); } - FL_EXPORT_C(void,Fl_Slider_show_super)(fl_Slider slider){ - (static_cast(slider))->Fl_Slider::show(); + void Fl_DerivedSlider::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Slider) this); + } + else { + Fl_Slider::show(); + } } - FL_EXPORT_C(void,Fl_Slider_show )(fl_Slider slider){ - (static_cast(slider))->show(); + void Fl_DerivedSlider::show_super(){ + Fl_Slider::show(); } - FL_EXPORT_C(void,Fl_Slider_hide_super)(fl_Slider slider){ - (static_cast(slider))->Fl_Slider::hide(); + + void Fl_DerivedSlider::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Slider) this); + } + else { + Fl_Slider::hide(); + } } - FL_EXPORT_C(void,Fl_Slider_hide )(fl_Slider slider){ - (static_cast(slider))->hide(); + void Fl_DerivedSlider::hide_super(){ + Fl_Slider::hide(); } +#endif FL_EXPORT_C(fl_Window,Fl_Slider_as_window_super)(fl_Slider slider){ return (static_cast(slider))->Fl_Slider::as_window(); } @@ -345,14 +394,6 @@ EXPORT { FL_EXPORT_C(double,Fl_Slider_increment)(fl_Slider slider,double v,int n){ return (static_cast(slider))->increment(v,n); } - FL_EXPORT_C(fl_Slider, Fl_Slider_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Slider* slider = new Fl_Slider(x,y,w,h,label); - return (static_cast(slider)); - } - FL_EXPORT_C(fl_Slider, Fl_Slider_New)(int x, int y, int w, int h) { - Fl_Slider* slider = new Fl_Slider(x,y,w,h,0); - return (fl_Slider)slider; - } FL_EXPORT_C(fl_Slider, Fl_Slider_New_WithT)(uchar t, int x, int y, int w, int h, const char* label){ Fl_Slider* slider = new Fl_Slider(t,x,y,w,h,label); return (fl_Slider)slider; @@ -415,6 +456,54 @@ EXPORT { FL_EXPORT_C(void,Fl_Slider_set_slider)(fl_Slider slider,Fl_Boxtype c){ (static_cast(slider))->slider(c); } + FL_EXPORT_C(fl_Slider, Fl_Slider_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedSlider* w = new Fl_DerivedSlider(X,Y,W,H,fs); + return (fl_Slider)w; + } + FL_EXPORT_C(fl_Slider, Fl_Slider_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedSlider* w = new Fl_DerivedSlider(X,Y,W,H,label,fs); + return (fl_Slider)w; + } + FL_EXPORT_C(fl_Slider, Fl_OverriddenSlider_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedSlider* w = new Fl_DerivedSlider(X,Y,W,H,fs); + return (fl_Slider)w; + } + FL_EXPORT_C(fl_Slider, Fl_OverriddenSlider_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedSlider* w = new Fl_DerivedSlider(X,Y,W,H,label,fs); + return (fl_Slider)w; + } + FL_EXPORT_C(void, Fl_Slider_draw)(fl_Slider o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Slider_draw_super)(fl_Slider o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Slider_handle)(fl_Slider o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Slider_handle_super)(fl_Slider o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Slider_resize)(fl_Slider o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Slider_resize_super)(fl_Slider o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Slider_show)(fl_Slider o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Slider_show_super)(fl_Slider o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Slider_hide)(fl_Slider o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Slider_hide_super)(fl_Slider o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_SliderC.h b/c-src/Fl_SliderC.h index ea5d3ac4..500045be 100644 --- a/c-src/Fl_SliderC.h +++ b/c-src/Fl_SliderC.h @@ -12,7 +12,26 @@ #include "FL/Fl_Hor_Nice_Slider.H" #include "FL/Fl_Nice_Slider.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedSlider : public Fl_Slider { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedSlider(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedSlider(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedSlider(); + }; #endif FL_EXPORT_C(int,Fl_Slider_handle)(fl_Widget self, int event); FL_EXPORT_C(int,Fl_Slider_handle_super)(fl_Widget self, int event); @@ -143,6 +162,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Slider_slider_size)(fl_Slider slider, double v); FL_EXPORT_C(Fl_Boxtype, Fl_Slider_slider)(fl_Slider slider); FL_EXPORT_C(void, Fl_Slider_set_slider)(fl_Slider slider, Fl_Boxtype c); + FL_EXPORT_C(fl_Slider, Fl_OverriddenSlider_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Slider, Fl_OverriddenSlider_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Slider_draw)(fl_Slider o); + FL_EXPORT_C(void, Fl_Slider_draw_super)(fl_Slider o); + FL_EXPORT_C(int, Fl_Slider_handle)(fl_Slider o, int event); + FL_EXPORT_C(int, Fl_Slider_handle_super)(fl_Slider o, int event); + FL_EXPORT_C(void, Fl_Slider_resize)(fl_Slider o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Slider_resize_super)(fl_Slider o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Slider_show)(fl_Slider o); + FL_EXPORT_C(void, Fl_Slider_show_super)(fl_Slider o); + FL_EXPORT_C(void, Fl_Slider_hide)(fl_Slider o); + FL_EXPORT_C(void, Fl_Slider_hide_super)(fl_Slider o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_SpinnerC.cpp b/c-src/Fl_SpinnerC.cpp index 3a0c33c4..78af6220 100644 --- a/c-src/Fl_SpinnerC.cpp +++ b/c-src/Fl_SpinnerC.cpp @@ -1,6 +1,79 @@ #include "Fl_SpinnerC.h" #ifdef __cplusplus EXPORT { + Fl_DerivedSpinner::Fl_DerivedSpinner(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Spinner(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedSpinner::Fl_DerivedSpinner(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Spinner(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedSpinner::~Fl_DerivedSpinner(){ + free(overriddenFuncs); + } + void Fl_DerivedSpinner::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Spinner) this); + } + else { + Fl_Spinner::draw(); + } + } + + void Fl_DerivedSpinner::draw_super(){ + Fl_Spinner::draw(); + } + + int Fl_DerivedSpinner::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Spinner) this,event); + } + else { + i = Fl_Spinner::handle(event); + } + return i; + } + int Fl_DerivedSpinner::handle_super(int event){ + return Fl_Spinner::handle(event); + } + + void Fl_DerivedSpinner::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Spinner) this,x,y,w,h); + } + else { + Fl_Spinner::resize(x,y,w,h); + } + } + + void Fl_DerivedSpinner::resize_super(int x, int y, int w, int h){ + Fl_Spinner::resize(x,y,w,h); + } + void Fl_DerivedSpinner::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Spinner) this); + } + else { + Fl_Spinner::show(); + } + } + void Fl_DerivedSpinner::show_super(){ + Fl_Spinner::show(); + } + + void Fl_DerivedSpinner::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Spinner) this); + } + else { + Fl_Spinner::hide(); + } + } + void Fl_DerivedSpinner::hide_super(){ + Fl_Spinner::hide(); + } #endif FL_EXPORT_C(Fl_Color,Fl_Spinner_color)(fl_Spinner spinner){ return (static_cast(spinner))->color(); @@ -20,9 +93,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Spinner_set_type)(fl_Spinner spinner,uchar t){ (static_cast(spinner))->type(t); } - FL_EXPORT_C(void,Fl_Spinner_resize)(fl_Spinner spinner,int X,int Y,int W,int H){ - (static_cast(spinner))->resize(X,Y,W,H); - } FL_EXPORT_C(double,Fl_Spinner_minimum)(fl_Spinner spinner){ return (static_cast(spinner))->minimum(); } @@ -74,16 +144,53 @@ EXPORT { FL_EXPORT_C(Fl_Color,Fl_Spinner_textcolor)(fl_Spinner spinner){ return (static_cast(spinner))->textcolor(); } - FL_EXPORT_C(int,Fl_Spinner_handle)(fl_Spinner spinner,int event){ - return (static_cast(spinner))->handle(event); + FL_EXPORT_C(fl_Spinner, Fl_Spinner_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedSpinner* w = new Fl_DerivedSpinner(X,Y,W,H,fs); + return (fl_Spinner)w; + } + FL_EXPORT_C(fl_Spinner, Fl_Spinner_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedSpinner* w = new Fl_DerivedSpinner(X,Y,W,H,label,fs); + return (fl_Spinner)w; + } + FL_EXPORT_C(fl_Spinner, Fl_OverriddenSpinner_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedSpinner* w = new Fl_DerivedSpinner(X,Y,W,H,fs); + return (fl_Spinner)w; + } + FL_EXPORT_C(fl_Spinner, Fl_OverriddenSpinner_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedSpinner* w = new Fl_DerivedSpinner(X,Y,W,H,label,fs); + return (fl_Spinner)w; + } + FL_EXPORT_C(void, Fl_Spinner_draw)(fl_Spinner o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Spinner_draw_super)(fl_Spinner o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Spinner_handle)(fl_Spinner o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Spinner_handle_super)(fl_Spinner o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Spinner_resize)(fl_Spinner o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Spinner_resize_super)(fl_Spinner o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Spinner_show)(fl_Spinner o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Spinner_show_super)(fl_Spinner o){ + (static_cast(o))->show_super(); } - FL_EXPORT_C(fl_Spinner,Fl_Spinner_New_WithLabel)(int x,int y,int w,int h,const char* label){ - Fl_Spinner* counter = new Fl_Spinner(x,y,w,h,label); - return (fl_Spinner) counter; + FL_EXPORT_C(void, Fl_Spinner_hide)(fl_Spinner o){ + (static_cast(o))->hide(); } - FL_EXPORT_C(fl_Spinner,Fl_Spinner_New)(int x,int y,int w,int h){ - Fl_Spinner* counter = new Fl_Spinner(x,y,w,h); - return (fl_Spinner) counter; + FL_EXPORT_C(void, Fl_Spinner_hide_super)(fl_Spinner o){ + (static_cast(o))->hide_super(); } #ifdef __cplusplus } diff --git a/c-src/Fl_SpinnerC.h b/c-src/Fl_SpinnerC.h index 74b3d021..466539e7 100644 --- a/c-src/Fl_SpinnerC.h +++ b/c-src/Fl_SpinnerC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Spinner.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedSpinner : public Fl_Spinner { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedSpinner(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedSpinner(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedSpinner(); + }; + #endif #ifndef INTERNAL_LINKAGE typedef enum Spinner_Type { @@ -42,6 +62,18 @@ EXPORT { FL_EXPORT_C(Fl_Color, Fl_Spinner_textcolor)(fl_Spinner spinner); FL_EXPORT_C(fl_Spinner, Fl_Spinner_New_WithLabel)(int x, int y, int w, int h, const char* label); FL_EXPORT_C(fl_Spinner , Fl_Spinner_New)(int x, int y, int w, int h); + FL_EXPORT_C(fl_Spinner, Fl_OverriddenSpinner_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Spinner, Fl_OverriddenSpinner_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Spinner_draw)(fl_Spinner o); + FL_EXPORT_C(void, Fl_Spinner_draw_super)(fl_Spinner o); + FL_EXPORT_C(int, Fl_Spinner_handle)(fl_Spinner o, int event); + FL_EXPORT_C(int, Fl_Spinner_handle_super)(fl_Spinner o, int event); + FL_EXPORT_C(void, Fl_Spinner_resize)(fl_Spinner o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Spinner_resize_super)(fl_Spinner o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Spinner_show)(fl_Spinner o); + FL_EXPORT_C(void, Fl_Spinner_show_super)(fl_Spinner o); + FL_EXPORT_C(void, Fl_Spinner_hide)(fl_Spinner o); + FL_EXPORT_C(void, Fl_Spinner_hide_super)(fl_Spinner o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Sys_Menu_BarC.cpp b/c-src/Fl_Sys_Menu_BarC.cpp index b0e61edb..4c75fccf 100644 --- a/c-src/Fl_Sys_Menu_BarC.cpp +++ b/c-src/Fl_Sys_Menu_BarC.cpp @@ -2,19 +2,80 @@ #include "UtilsC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Sys_Menu_Bar_handle )(fl_Sys_Menu_Bar sys_menu_bar, int event){ - return (static_cast(sys_menu_bar))->handle(event); + Fl_DerivedSys_Menu_Bar::Fl_DerivedSys_Menu_Bar(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Sys_Menu_Bar(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedSys_Menu_Bar::Fl_DerivedSys_Menu_Bar(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Sys_Menu_Bar(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedSys_Menu_Bar::~Fl_DerivedSys_Menu_Bar(){ + free(overriddenFuncs); + } + void Fl_DerivedSys_Menu_Bar::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Sys_Menu_Bar) this); + } + else { + Fl_Sys_Menu_Bar::draw(); + } + } + + void Fl_DerivedSys_Menu_Bar::draw_super(){ + Fl_Sys_Menu_Bar::draw(); + } + + int Fl_DerivedSys_Menu_Bar::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Sys_Menu_Bar) this,event); + } + else { + i = Fl_Sys_Menu_Bar::handle(event); + } + return i; + } + int Fl_DerivedSys_Menu_Bar::handle_super(int event){ + return Fl_Sys_Menu_Bar::handle(event); + } + + void Fl_DerivedSys_Menu_Bar::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Sys_Menu_Bar) this,x,y,w,h); + } + else { + Fl_Sys_Menu_Bar::resize(x,y,w,h); + } } - FL_EXPORT_C(void,Fl_Sys_Menu_Bar_resize )(fl_Sys_Menu_Bar sys_menu_bar,int x, int y, int w, int h){ - (static_cast(sys_menu_bar))->resize(x,y,w,h); + + void Fl_DerivedSys_Menu_Bar::resize_super(int x, int y, int w, int h){ + Fl_Sys_Menu_Bar::resize(x,y,w,h); } - FL_EXPORT_C(void,Fl_Sys_Menu_Bar_show )(fl_Sys_Menu_Bar sys_menu_bar){ - (static_cast(sys_menu_bar))->show(); + void Fl_DerivedSys_Menu_Bar::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Sys_Menu_Bar) this); + } + else { + Fl_Sys_Menu_Bar::show(); + } } - FL_EXPORT_C(void,Fl_Sys_Menu_Bar_hide )(fl_Sys_Menu_Bar sys_menu_bar){ - (static_cast(sys_menu_bar))->hide(); + void Fl_DerivedSys_Menu_Bar::show_super(){ + Fl_Sys_Menu_Bar::show(); } + + void Fl_DerivedSys_Menu_Bar::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Sys_Menu_Bar) this); + } + else { + Fl_Sys_Menu_Bar::hide(); + } + } + void Fl_DerivedSys_Menu_Bar::hide_super(){ + Fl_Sys_Menu_Bar::hide(); + } +#endif FL_EXPORT_C(fl_Window,Fl_Sys_Menu_Bar_as_window )(fl_Sys_Menu_Bar sys_menu_bar){ return (static_cast(sys_menu_bar))->as_window(); } @@ -265,14 +326,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Sys_Menu_Bar_measure_label)(fl_Sys_Menu_Bar sys_menu_bar,int* ww,int* hh){ (static_cast(sys_menu_bar))->measure_label(*ww,*hh); } - FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_Sys_Menu_Bar_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Sys_Menu_Bar* sys_menu_bar = new Fl_Sys_Menu_Bar(x,y,w,h,label); - return (static_cast(sys_menu_bar)); - } - FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_Sys_Menu_Bar_New)(int x, int y, int w, int h) { - Fl_Sys_Menu_Bar* sys_menu_bar = new Fl_Sys_Menu_Bar(x,y,w,h,0); - return (fl_Sys_Menu_Bar)sys_menu_bar; - } FL_EXPORT_C(void , Fl_Sys_Menu_Bar_Destroy)(fl_Sys_Menu_Bar sys_menu_bar){ delete (static_cast(sys_menu_bar)); } @@ -439,6 +492,54 @@ EXPORT { FL_EXPORT_C(void,Fl_Sys_Menu_Bar_set_down_color)(fl_Sys_Menu_Bar sys_menu_bar,unsigned c){ (static_cast(sys_menu_bar))->down_color(c); } + FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_Sys_Menu_Bar_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedSys_Menu_Bar* w = new Fl_DerivedSys_Menu_Bar(X,Y,W,H,fs); + return (fl_Sys_Menu_Bar)w; + } + FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_Sys_Menu_Bar_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedSys_Menu_Bar* w = new Fl_DerivedSys_Menu_Bar(X,Y,W,H,label,fs); + return (fl_Sys_Menu_Bar)w; + } + FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_OverriddenSys_Menu_Bar_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedSys_Menu_Bar* w = new Fl_DerivedSys_Menu_Bar(X,Y,W,H,fs); + return (fl_Sys_Menu_Bar)w; + } + FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_OverriddenSys_Menu_Bar_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedSys_Menu_Bar* w = new Fl_DerivedSys_Menu_Bar(X,Y,W,H,label,fs); + return (fl_Sys_Menu_Bar)w; + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_draw)(fl_Sys_Menu_Bar o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_draw_super)(fl_Sys_Menu_Bar o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Sys_Menu_Bar_handle)(fl_Sys_Menu_Bar o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Sys_Menu_Bar_handle_super)(fl_Sys_Menu_Bar o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_resize)(fl_Sys_Menu_Bar o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_resize_super)(fl_Sys_Menu_Bar o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_show)(fl_Sys_Menu_Bar o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_show_super)(fl_Sys_Menu_Bar o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_hide)(fl_Sys_Menu_Bar o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_hide_super)(fl_Sys_Menu_Bar o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Sys_Menu_BarC.h b/c-src/Fl_Sys_Menu_BarC.h index 7e002961..3f6b59ab 100644 --- a/c-src/Fl_Sys_Menu_BarC.h +++ b/c-src/Fl_Sys_Menu_BarC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Sys_Menu_Bar.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedSys_Menu_Bar : public Fl_Sys_Menu_Bar { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedSys_Menu_Bar(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedSys_Menu_Bar(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedSys_Menu_Bar(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int, Fl_Sys_Menu_Bar_handle)(fl_Group self, int event); @@ -157,6 +176,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Sys_Menu_Bar_set_down_box)(fl_Sys_Menu_Bar sys_menu_bar, Fl_Boxtype b); FL_EXPORT_C(Fl_Color, Fl_Sys_Menu_Bar_down_color)(fl_Sys_Menu_Bar sys_menu_bar); FL_EXPORT_C(void, Fl_Sys_Menu_Bar_set_down_color)(fl_Sys_Menu_Bar sys_menu_bar, unsigned c); + FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_OverriddenSys_Menu_Bar_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Sys_Menu_Bar, Fl_OverriddenSys_Menu_Bar_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_draw)(fl_Sys_Menu_Bar o); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_draw_super)(fl_Sys_Menu_Bar o); + FL_EXPORT_C(int, Fl_Sys_Menu_Bar_handle)(fl_Sys_Menu_Bar o, int event); + FL_EXPORT_C(int, Fl_Sys_Menu_Bar_handle_super)(fl_Sys_Menu_Bar o, int event); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_resize)(fl_Sys_Menu_Bar o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_resize_super)(fl_Sys_Menu_Bar o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_show)(fl_Sys_Menu_Bar o); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_show_super)(fl_Sys_Menu_Bar o); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_hide)(fl_Sys_Menu_Bar o); + FL_EXPORT_C(void, Fl_Sys_Menu_Bar_hide_super)(fl_Sys_Menu_Bar o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Table_RowC.cpp b/c-src/Fl_Table_RowC.cpp index a6e76c23..6a4bc981 100644 --- a/c-src/Fl_Table_RowC.cpp +++ b/c-src/Fl_Table_RowC.cpp @@ -1,13 +1,13 @@ #include "Fl_Table_RowC.h" #ifdef __cplusplus Fl_DerivedTable_Row::Fl_DerivedTable_Row(int X, int Y, int W, int H, const char *l, fl_Table_Virtual_Funcs* funcs) : Fl_Table_Row(X,Y,W,H,l){ - overriddenFuncs = funcs; - other_data = (void*)"INIT"; - } + overriddenFuncs = funcs; + other_data = (void*)"INIT"; +} Fl_DerivedTable_Row::Fl_DerivedTable_Row(int X, int Y, int W, int H, fl_Table_Virtual_Funcs* funcs):Fl_Table_Row(X,Y,W,H,0){ - overriddenFuncs = funcs; - other_data = (void*)"INIT"; - } + overriddenFuncs = funcs; + other_data = (void*)"INIT"; +} Fl_DerivedTable_Row::~Fl_DerivedTable_Row(){ destroy_data(); free(overriddenFuncs); @@ -199,28 +199,27 @@ EXPORT { FL_EXPORT_C(void,Fl_Table_Row_set_parent)(fl_Table_Row table_row,fl_Group grp){ (static_cast(table_row))->parent((static_cast(grp))); } - -FL_EXPORT_C(void, Fl_Table_Row_draw_box)(fl_Table_Row Table_Row){ - (static_cast(Table_Row))->draw_box(); -} -FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_tc)(fl_Table_Row Table_Row,Fl_Boxtype t, Fl_Color c){ - (static_cast(Table_Row))->draw_box(t,c); -} -FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_txywhc)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c){ - (static_cast(Table_Row))->draw_box(t,x,y,w,h,c); -} -FL_EXPORT_C(void, Fl_Table_Row_draw_backdrop)(fl_Table_Row Table_Row){ - (static_cast(Table_Row))->draw_backdrop(); -} -FL_EXPORT_C(void, Fl_Table_Row_draw_focus)(fl_Table_Row Table_Row){ - (static_cast(Table_Row))->draw_focus(); -} -FL_EXPORT_C(void, Fl_Table_Row_draw_focus_with_txywh)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h){ - (static_cast(Table_Row))->draw_focus(t,x,y,w,h); -} -FL_EXPORT_C(void, Fl_Table_Row_draw_label)(fl_Table_Row Table_Row){ - (static_cast(Table_Row))->draw_label(); -} + FL_EXPORT_C(void, Fl_Table_Row_draw_box)(fl_Table_Row Table_Row){ + (static_cast(Table_Row))->draw_box(); + } + FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_tc)(fl_Table_Row Table_Row,Fl_Boxtype t, Fl_Color c){ + (static_cast(Table_Row))->draw_box(t,c); + } + FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_txywhc)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c){ + (static_cast(Table_Row))->draw_box(t,x,y,w,h,c); + } + FL_EXPORT_C(void, Fl_Table_Row_draw_backdrop)(fl_Table_Row Table_Row){ + (static_cast(Table_Row))->draw_backdrop(); + } + FL_EXPORT_C(void, Fl_Table_Row_draw_focus)(fl_Table_Row Table_Row){ + (static_cast(Table_Row))->draw_focus(); + } + FL_EXPORT_C(void, Fl_Table_Row_draw_focus_with_txywh)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h){ + (static_cast(Table_Row))->draw_focus(t,x,y,w,h); + } + FL_EXPORT_C(void, Fl_Table_Row_draw_label)(fl_Table_Row Table_Row){ + (static_cast(Table_Row))->draw_label(); + } FL_EXPORT_C(int,Fl_Table_Row_x)(fl_Table_Row table_row){ return (static_cast(table_row))->x(); } diff --git a/c-src/Fl_Table_RowC.h b/c-src/Fl_Table_RowC.h index e44dce60..e37a8a2d 100644 --- a/c-src/Fl_Table_RowC.h +++ b/c-src/Fl_Table_RowC.h @@ -14,14 +14,14 @@ EXPORT { FL_EXPORT_C(int,Fl_Table_Row_handle)(fl_Table_Row self, int event); FL_EXPORT_C(fl_Group, Fl_Table_Row_parent)(fl_Table_Row table); FL_EXPORT_C(void, Fl_Table_Row_set_parent)(fl_Table_Row table, fl_Group grp); + FL_EXPORT_C(void, Fl_Table_Row_draw_box)(fl_Table_Row Table_Row); + FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_tc)(fl_Table_Row Table_Row,Fl_Boxtype t, Fl_Color c); + FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_txywhc)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c); + FL_EXPORT_C(void, Fl_Table_Row_draw_backdrop)(fl_Table_Row Table_Row); + FL_EXPORT_C(void, Fl_Table_Row_draw_focus)(fl_Table_Row Table_Row); + FL_EXPORT_C(void, Fl_Table_Row_draw_focus_with_txywh)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h); + FL_EXPORT_C(void, Fl_Table_Row_draw_label)(fl_Table_Row Table_Row); -FL_EXPORT_C(void, Fl_Table_Row_draw_box)(fl_Table_Row Table_Row); -FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_tc)(fl_Table_Row Table_Row,Fl_Boxtype t, Fl_Color c); -FL_EXPORT_C(void, Fl_Table_Row_draw_box_with_txywhc)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c); -FL_EXPORT_C(void, Fl_Table_Row_draw_backdrop)(fl_Table_Row Table_Row); -FL_EXPORT_C(void, Fl_Table_Row_draw_focus)(fl_Table_Row Table_Row); -FL_EXPORT_C(void, Fl_Table_Row_draw_focus_with_txywh)(fl_Table_Row Table_Row,Fl_Boxtype t, int x,int y,int w,int h); -FL_EXPORT_C(void, Fl_Table_Row_draw_label)(fl_Table_Row Table_Row); FL_EXPORT_C(int, Fl_Table_Row_x)(fl_Table_Row table); FL_EXPORT_C(int, Fl_Table_Row_y)(fl_Table_Row table); FL_EXPORT_C(int, Fl_Table_Row_w)(fl_Table_Row table); @@ -118,6 +118,7 @@ FL_EXPORT_C(void, Fl_Table_Row_draw_label)(fl_Table_Row Table_Row); FL_EXPORT_C(unsigned int, Fl_Table_Row_clip_children)(fl_Table_Row table); FL_EXPORT_C(void, Fl_Table_Row_focus)(fl_Table_Row table,fl_Widget W); FL_EXPORT_C(fl_Widget, Fl_Table_Row__ddfdesign_kludge)(fl_Table_Row table); + FL_EXPORT_C(void,Fl_Table_Row_draw_super)(fl_Table_Row table_row); FL_EXPORT_C(void, Fl_Table_Row_insert_with_before)(fl_Table_Row self, fl_Widget w, fl_Widget before); FL_EXPORT_C(fl_Widget*, Fl_Table_Row_array)(fl_Table_Row self); diff --git a/c-src/Fl_TabsC.cpp b/c-src/Fl_TabsC.cpp index fa8dd6d9..d1ab72b6 100644 --- a/c-src/Fl_TabsC.cpp +++ b/c-src/Fl_TabsC.cpp @@ -1,10 +1,82 @@ #include "Fl_TabsC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Tabs_handle)(fl_Tabs self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedTabs::Fl_DerivedTabs(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Tabs(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTabs::Fl_DerivedTabs(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Tabs(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTabs::~Fl_DerivedTabs(){ + free(overriddenFuncs); + } + void Fl_DerivedTabs::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Tabs) this); + } + else { + Fl_Tabs::draw(); + } + } + + void Fl_DerivedTabs::draw_super(){ + Fl_Tabs::draw(); + } + + int Fl_DerivedTabs::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Tabs) this,event); + } + else { + i = Fl_Tabs::handle(event); + } + return i; + } + int Fl_DerivedTabs::handle_super(int event){ + return Fl_Tabs::handle(event); + } + + void Fl_DerivedTabs::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Tabs) this,x,y,w,h); + } + else { + Fl_Tabs::resize(x,y,w,h); + } + } + + void Fl_DerivedTabs::resize_super(int x, int y, int w, int h){ + Fl_Tabs::resize(x,y,w,h); + } + void Fl_DerivedTabs::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Tabs) this); + } + else { + Fl_Tabs::show(); + } + } + void Fl_DerivedTabs::show_super(){ + Fl_Tabs::show(); } + + void Fl_DerivedTabs::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Tabs) this); + } + else { + Fl_Tabs::hide(); + } + } + void Fl_DerivedTabs::hide_super(){ + Fl_Tabs::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Tabs_parent)(fl_Tabs tabs){ return (fl_Group) (static_cast(tabs))->parent(); } @@ -297,17 +369,6 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Tabs_child)(fl_Tabs self, int n){ return (fl_Widget)(static_cast(self))->child(n); } - // FL_EXPORT_C(void , Fl_Tabs_forms_end)(fl_Tabs self){ - // (static_cast(self))->forms_end(); - // } - FL_EXPORT_C(fl_Tabs, Fl_Tabs_New)(int x, int y, int w, int h){ - Fl_Tabs* t = new Fl_Tabs(x,y,w,h); - return (fl_Tabs)t; - } - FL_EXPORT_C(fl_Tabs, Fl_Tabs_New_WithLabel)(int x, int y, int w, int h, const char* l){ - Fl_Tabs* t = new Fl_Tabs(x,y,w,h,l); - return (fl_Tabs)t; - } FL_EXPORT_C(fl_Widget,Fl_Tabs_value)(fl_Tabs tabs){ return (fl_Widget)(static_cast(tabs))->value(); } @@ -329,6 +390,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Tabs_client_area_with_tabh)(fl_Tabs tabs,int* rx,int* ry,int* rw,int* rh,int tabh){ (static_cast(tabs))->client_area(*rx,*ry,*rw,*rh,tabh); } + FL_EXPORT_C(void, Fl_Tabs_draw)(fl_Tabs o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Tabs_draw_super)(fl_Tabs o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Tabs_handle)(fl_Tabs o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Tabs_handle_super)(fl_Tabs o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Tabs_resize)(fl_Tabs o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Tabs_resize_super)(fl_Tabs o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Tabs_show)(fl_Tabs o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Tabs_show_super)(fl_Tabs o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Tabs_hide)(fl_Tabs o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Tabs_hide_super)(fl_Tabs o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Tabs, Fl_Tabs_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTabs* w = new Fl_DerivedTabs(X,Y,W,H,fs); + return (fl_Tabs)w; + } + FL_EXPORT_C(fl_Tabs, Fl_Tabs_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTabs* w = new Fl_DerivedTabs(X,Y,W,H,label,fs); + return (fl_Tabs)w; + } + FL_EXPORT_C(fl_Tabs, Fl_OverriddenTabs_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTabs* w = new Fl_DerivedTabs(X,Y,W,H,fs); + return (fl_Tabs)w; + } + FL_EXPORT_C(fl_Tabs, Fl_OverriddenTabs_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTabs* w = new Fl_DerivedTabs(X,Y,W,H,label,fs); + return (fl_Tabs)w; + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TabsC.h b/c-src/Fl_TabsC.h index 18f61c26..9fc4de45 100644 --- a/c-src/Fl_TabsC.h +++ b/c-src/Fl_TabsC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Tabs.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedTabs : public Fl_Tabs { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedTabs(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedTabs(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedTabs(); + }; + #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Tabs_handle)(fl_Tabs self, int event); @@ -124,6 +144,18 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Tabs_which)(fl_Tabs tabs, int event_x, int event_y); FL_EXPORT_C(void, Fl_Tabs_client_area)(fl_Tabs tabs, int* rx, int* ry, int* rw, int* rh); FL_EXPORT_C(void, Fl_Tabs_client_area_with_tabh)(fl_Tabs tabs, int* rx, int* ry, int* rw, int* rh, int tabh); + FL_EXPORT_C(fl_Tabs, Fl_OverriddenTabs_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Tabs, Fl_OverriddenTabs_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Tabs_draw)(fl_Tabs o); + FL_EXPORT_C(void, Fl_Tabs_draw_super)(fl_Tabs o); + FL_EXPORT_C(int, Fl_Tabs_handle)(fl_Tabs o, int event); + FL_EXPORT_C(int, Fl_Tabs_handle_super)(fl_Tabs o, int event); + FL_EXPORT_C(void, Fl_Tabs_resize)(fl_Tabs o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Tabs_resize_super)(fl_Tabs o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Tabs_show)(fl_Tabs o); + FL_EXPORT_C(void, Fl_Tabs_show_super)(fl_Tabs o); + FL_EXPORT_C(void, Fl_Tabs_hide)(fl_Tabs o); + FL_EXPORT_C(void, Fl_Tabs_hide_super)(fl_Tabs o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Text_DisplayC.cpp b/c-src/Fl_Text_DisplayC.cpp index 2742c527..1978ab80 100644 --- a/c-src/Fl_Text_DisplayC.cpp +++ b/c-src/Fl_Text_DisplayC.cpp @@ -1,10 +1,82 @@ #include "Fl_Text_DisplayC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Text_Display_handle)(fl_Text_Display self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedText_Display::Fl_DerivedText_Display(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Text_Display(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedText_Display::Fl_DerivedText_Display(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Text_Display(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedText_Display::~Fl_DerivedText_Display(){ + free(overriddenFuncs); + } + void Fl_DerivedText_Display::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Text_Display) this); + } + else { + Fl_Text_Display::draw(); + } + } + + void Fl_DerivedText_Display::draw_super(){ + Fl_Text_Display::draw(); + } + + int Fl_DerivedText_Display::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Text_Display) this,event); + } + else { + i = Fl_Text_Display::handle(event); + } + return i; + } + int Fl_DerivedText_Display::handle_super(int event){ + return Fl_Text_Display::handle(event); + } + + void Fl_DerivedText_Display::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Text_Display) this,x,y,w,h); + } + else { + Fl_Text_Display::resize(x,y,w,h); + } + } + + void Fl_DerivedText_Display::resize_super(int x, int y, int w, int h){ + Fl_Text_Display::resize(x,y,w,h); + } + void Fl_DerivedText_Display::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Text_Display) this); + } + else { + Fl_Text_Display::show(); + } } + void Fl_DerivedText_Display::show_super(){ + Fl_Text_Display::show(); + } + + void Fl_DerivedText_Display::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Text_Display) this); + } + else { + Fl_Text_Display::hide(); + } + } + void Fl_DerivedText_Display::hide_super(){ + Fl_Text_Display::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Text_Display_parent)(fl_Text_Display text_display){ return (fl_Group) (static_cast(text_display))->parent(); } @@ -301,9 +373,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Text_Display_init_sizes)(fl_Text_Display text_display){ (static_cast(text_display))->init_sizes(); } - FL_EXPORT_C(void,Fl_Text_Display_resize)(fl_Text_Display text_display, int X, int Y, int W, int H){ - (static_cast(text_display))->resize(X,Y,W,H); - } FL_EXPORT_C(int,Fl_Text_Display_children)(fl_Text_Display self){ return (static_cast(self))->children(); } @@ -325,14 +394,6 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Text_Display_child)(fl_Text_Display self, int n){ return (fl_Widget)(static_cast(self))->child(n); } - FL_EXPORT_C(fl_Text_Display, Fl_Text_Display_New)(int x, int y, int w, int h){ - Fl_Text_Display* g = new Fl_Text_Display(x,y,w,h); - return (fl_Text_Display)g; - } - FL_EXPORT_C(fl_Text_Display, Fl_Text_Display_New_WithLabel)(int x, int y, int w, int h, const char* t){ - Fl_Text_Display* g = new Fl_Text_Display(x,y,w,h,t); - return (fl_Text_Display)g; - } FL_EXPORT_C(void, Fl_Text_Display_Destroy)(fl_Text_Display text_display){ delete (static_cast(text_display)); } @@ -496,48 +557,97 @@ EXPORT { FL_EXPORT_C(double,Fl_Text_Display_col_to_x)(fl_Text_Display text_display,double col){ return (static_cast(text_display))->col_to_x(col); } - FL_EXPORT_C(void,set_linenumber_width)(fl_Text_Display text_display,int width){ - (static_cast(text_display))->linenumber_width(width); - } - FL_EXPORT_C(int ,linenumber_width)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_width(); - } - FL_EXPORT_C(void ,set_linenumber_font)(fl_Text_Display text_display,Fl_Font val){ - (static_cast(text_display))->linenumber_font(val); - } - FL_EXPORT_C(Fl_Font ,linenumber_font)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_font(); - } - FL_EXPORT_C(void ,set_linenumber_size)(fl_Text_Display text_display,Fl_Fontsize val){ - (static_cast(text_display))->linenumber_size(val); - } - FL_EXPORT_C(Fl_Fontsize ,linenumber_size)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_size(); - } - FL_EXPORT_C(void ,set_linenumber_fgcolor)(fl_Text_Display text_display,Fl_Color val){ - (static_cast(text_display))->linenumber_fgcolor(val); - } - FL_EXPORT_C(Fl_Color ,linenumber_fgcolor)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_fgcolor(); - } - FL_EXPORT_C(void ,set_linenumber_bgcolor)(fl_Text_Display text_display,Fl_Color val){ - (static_cast(text_display))->linenumber_bgcolor(val); - } - FL_EXPORT_C(Fl_Color ,linenumber_bgcolor)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_bgcolor(); - } - FL_EXPORT_C(void ,set_linenumber_align)(fl_Text_Display text_display,Fl_Align val){ - (static_cast(text_display))->linenumber_align(val); - } - FL_EXPORT_C(Fl_Align ,linenumber_align)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_align(); - } - FL_EXPORT_C(void ,set_linenumber_format)(fl_Text_Display text_display,const char* val){ - (static_cast(text_display))->linenumber_format(val); - } - FL_EXPORT_C(const char* ,linenumber_format)(fl_Text_Display text_display){ - return (static_cast(text_display))->linenumber_format(); - } + FL_EXPORT_C(void,set_linenumber_width)(fl_Text_Display text_display,int width){ + (static_cast(text_display))->linenumber_width(width); + } + FL_EXPORT_C(int ,linenumber_width)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_width(); + } + FL_EXPORT_C(void ,set_linenumber_font)(fl_Text_Display text_display,Fl_Font val){ + (static_cast(text_display))->linenumber_font(val); + } + FL_EXPORT_C(Fl_Font ,linenumber_font)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_font(); + } + FL_EXPORT_C(void ,set_linenumber_size)(fl_Text_Display text_display,Fl_Fontsize val){ + (static_cast(text_display))->linenumber_size(val); + } + FL_EXPORT_C(Fl_Fontsize ,linenumber_size)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_size(); + } + FL_EXPORT_C(void ,set_linenumber_fgcolor)(fl_Text_Display text_display,Fl_Color val){ + (static_cast(text_display))->linenumber_fgcolor(val); + } + FL_EXPORT_C(Fl_Color ,linenumber_fgcolor)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_fgcolor(); + } + FL_EXPORT_C(void ,set_linenumber_bgcolor)(fl_Text_Display text_display,Fl_Color val){ + (static_cast(text_display))->linenumber_bgcolor(val); + } + FL_EXPORT_C(Fl_Color ,linenumber_bgcolor)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_bgcolor(); + } + FL_EXPORT_C(void ,set_linenumber_align)(fl_Text_Display text_display,Fl_Align val){ + (static_cast(text_display))->linenumber_align(val); + } + FL_EXPORT_C(Fl_Align ,linenumber_align)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_align(); + } + FL_EXPORT_C(void ,set_linenumber_format)(fl_Text_Display text_display,const char* val){ + (static_cast(text_display))->linenumber_format(val); + } + FL_EXPORT_C(const char* ,linenumber_format)(fl_Text_Display text_display){ + return (static_cast(text_display))->linenumber_format(); + } + FL_EXPORT_C(fl_Text_Display, Fl_Text_Display_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedText_Display* w = new Fl_DerivedText_Display(X,Y,W,H,fs); + return (fl_Text_Display)w; + } + FL_EXPORT_C(fl_Text_Display, Fl_Text_Display_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedText_Display* w = new Fl_DerivedText_Display(X,Y,W,H,label,fs); + return (fl_Text_Display)w; + } + FL_EXPORT_C(fl_Text_Display, Fl_OverriddenText_Display_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedText_Display* w = new Fl_DerivedText_Display(X,Y,W,H,fs); + return (fl_Text_Display)w; + } + FL_EXPORT_C(fl_Text_Display, Fl_OverriddenText_Display_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedText_Display* w = new Fl_DerivedText_Display(X,Y,W,H,label,fs); + return (fl_Text_Display)w; + } + FL_EXPORT_C(void, Fl_Text_Display_draw)(fl_Text_Display o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Text_Display_draw_super)(fl_Text_Display o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Text_Display_handle)(fl_Text_Display o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Text_Display_handle_super)(fl_Text_Display o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Text_Display_resize)(fl_Text_Display o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Text_Display_resize_super)(fl_Text_Display o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Text_Display_show)(fl_Text_Display o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Text_Display_show_super)(fl_Text_Display o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Text_Display_hide)(fl_Text_Display o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Text_Display_hide_super)(fl_Text_Display o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Text_DisplayC.h b/c-src/Fl_Text_DisplayC.h index 854a2de2..b7e21765 100644 --- a/c-src/Fl_Text_DisplayC.h +++ b/c-src/Fl_Text_DisplayC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Text_Display.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedText_Display : public Fl_Text_Display { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedText_Display(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedText_Display(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedText_Display(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int, Fl_Text_Display_handle)(fl_Text_Display self, int event); @@ -193,6 +212,18 @@ EXPORT { FL_EXPORT_C(Fl_Align ,linenumber_align)(fl_Text_Display text_display); FL_EXPORT_C(void ,set_linenumber_format)(fl_Text_Display text_display,const char* val); FL_EXPORT_C(const char* ,linenumber_format)(fl_Text_Display text_display); + FL_EXPORT_C(fl_Text_Display, Fl_OverriddenText_Display_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Text_Display, Fl_OverriddenText_Display_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Text_Display_draw)(fl_Text_Display o); + FL_EXPORT_C(void, Fl_Text_Display_draw_super)(fl_Text_Display o); + FL_EXPORT_C(int, Fl_Text_Display_handle)(fl_Text_Display o, int event); + FL_EXPORT_C(int, Fl_Text_Display_handle_super)(fl_Text_Display o, int event); + FL_EXPORT_C(void, Fl_Text_Display_resize)(fl_Text_Display o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Text_Display_resize_super)(fl_Text_Display o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Text_Display_show)(fl_Text_Display o); + FL_EXPORT_C(void, Fl_Text_Display_show_super)(fl_Text_Display o); + FL_EXPORT_C(void, Fl_Text_Display_hide)(fl_Text_Display o); + FL_EXPORT_C(void, Fl_Text_Display_hide_super)(fl_Text_Display o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Text_EditorC.cpp b/c-src/Fl_Text_EditorC.cpp index 90b8a503..3e2709a8 100644 --- a/c-src/Fl_Text_EditorC.cpp +++ b/c-src/Fl_Text_EditorC.cpp @@ -35,9 +35,6 @@ Key_BindingC* convertKeyBindings(DerivedText_Editor::Key_Binding_With_Callback* } EXPORT { #endif - FL_EXPORT_C(int,Fl_Text_Editor_handle)(fl_Text_Editor self, int event){ - return (static_cast(self))->handle(event); - } FL_EXPORT_C(fl_Group,Fl_Text_Editor_parent)(fl_Text_Editor win){ return (fl_Group) (static_cast(win))->parent(); } @@ -355,14 +352,6 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Text_Editor_child)(fl_Text_Editor self, int n){ return (fl_Widget)(static_cast(self))->child(n); } - FL_EXPORT_C(fl_Text_Editor, Fl_Text_Editor_New)(int x, int y, int w, int h){ - DerivedText_Editor* g = new DerivedText_Editor(x,y,w,h); - return (fl_Text_Editor)g; - } - FL_EXPORT_C(fl_Text_Editor, Fl_Text_Editor_New_WithLabel)(int x, int y, int w, int h, const char* t){ - DerivedText_Editor* g = new DerivedText_Editor(x,y,w,h,t); - return (fl_Text_Editor)g; - } FL_EXPORT_C(void, Fl_Text_Editor_Destroy)(fl_Text_Editor text_editor){ delete (static_cast(text_editor)); } @@ -523,136 +512,184 @@ EXPORT { FL_EXPORT_C(double,Fl_Text_Editor_col_to_x)(fl_Text_Editor text_editor,double col){ return (static_cast(text_editor))->col_to_x(col); } - FL_EXPORT_C(void,Fl_Text_Editor_set_insert_mode)(fl_Text_Editor text_editor,int b){ - (static_cast(text_editor))->insert_mode(b); - } - FL_EXPORT_C(int,Fl_Text_Editor_insert_mode)(fl_Text_Editor text_editor){ - return (static_cast(text_editor))->insert_mode(); - } - FL_EXPORT_C(int, Fl_Text_Editor_num_key_bindings)(Key_BindingC* bindings){ - int count = 0; - Key_BindingC* curr = bindings; - for (;curr;curr = curr->next){ - if (curr) { - count++; - } - } - return count; - } - FL_EXPORT_C(void,Fl_Text_Editor_add_key_binding_with_list)(fl_Text_Editor text_editor,int key,int state,fl_Key_Func f,Key_BindingC* list){ - DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); - DerivedText_Editor* e = (static_cast(text_editor)); - C_to_Fl_Callback* context = new C_to_Fl_Callback(f); - e->add_key_binding(key,state,context,&bs); - } - FL_EXPORT_C(void,Fl_Text_Editor_add_key_binding)(fl_Text_Editor text_editor,int key,int state,fl_Key_Func f){ - C_to_Fl_Callback* context = new C_to_Fl_Callback(f); - (static_cast(text_editor))->add_key_binding(key,state,context); - } - FL_EXPORT_C(void,Fl_Text_Editor_remove_key_binding_with_list)(fl_Text_Editor text_editor,int key,int state,Key_BindingC* list){ - DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); - (static_cast(text_editor))->remove_key_binding(key,state,&bs); - } - FL_EXPORT_C(void,Fl_Text_Editor_remove_key_binding)(fl_Text_Editor text_editor,int key,int state){ - (static_cast(text_editor))->remove_key_binding(key,state); - } - FL_EXPORT_C(void,Fl_Text_Editor_remove_all_key_bindings_with_list)(fl_Text_Editor text_editor,Key_BindingC* list){ - DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); - (static_cast(text_editor))->remove_all_key_bindings(&bs); - } - FL_EXPORT_C(void,Fl_Text_Editor_remove_all_key_bindings)(fl_Text_Editor text_editor){ - (static_cast(text_editor))->remove_all_key_bindings(); - } - FL_EXPORT_C(void,Fl_Text_Editor_replace_key_bindings)(fl_Text_Editor text_editor, Key_BindingC* list){ - DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); - (static_cast(text_editor))->replace_key_bindings(&bs); - } - FL_EXPORT_C(void,Fl_Text_Editor_replace_key_bindings_with_list)(fl_Text_Editor text_editor, Key_BindingC* list1, Key_BindingC* list2){ - DerivedText_Editor::Key_Binding_With_Callback* bs1 = convertKeyBindings(list1); - DerivedText_Editor::Key_Binding_With_Callback* bs2 = convertKeyBindings(list2); - (static_cast(text_editor))->replace_key_bindings(&bs1,&bs2); - } - FL_EXPORT_C(Key_BindingC* ,Fl_Text_Editor_add_default_key_bindings)(fl_Text_Editor text_editor,Key_BindingC* list){ - DerivedText_Editor::Key_Binding_With_Callback* bs_ = new DerivedText_Editor::Key_Binding_With_Callback(); - (static_cast(text_editor))->add_default_key_bindings(&bs_); - list = convertKeyBindings(bs_); - return list; - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_undo)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_undo(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_ignore)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_ignore(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_backspace)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_backspace(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_enter)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_enter(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_move)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_move(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_shift_move)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_shift_move(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_ctrl_move)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_ctrl_move(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_c_s_move)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_c_s_move(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_meta_move)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_meta_move(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_m_s_move)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_m_s_move(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_home)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_home(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_end)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_end(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_left)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_left(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_up)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_up(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_right)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_right(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_down)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_down(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_page_up)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_page_up(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_page_down)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_page_down(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_insert)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_insert(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_delete)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_delete(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_copy)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_copy(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_cut)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_cut(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_paste)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_paste(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_select_all)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_select_all(c,(static_cast(e))); - } - FL_EXPORT_C(int,Fl_Text_Editor_kf_default)(int c,fl_Text_Editor e){ - return Fl_Text_Editor::kf_default(c,(static_cast(e))); - } + FL_EXPORT_C(void,Fl_Text_Editor_set_insert_mode)(fl_Text_Editor text_editor,int b){ + (static_cast(text_editor))->insert_mode(b); + } + FL_EXPORT_C(int,Fl_Text_Editor_insert_mode)(fl_Text_Editor text_editor){ + return (static_cast(text_editor))->insert_mode(); + } + FL_EXPORT_C(int, Fl_Text_Editor_num_key_bindings)(Key_BindingC* bindings){ + int count = 0; + Key_BindingC* curr = bindings; + for (;curr;curr = curr->next){ + if (curr) { + count++; + } + } + return count; + } + FL_EXPORT_C(void,Fl_Text_Editor_add_key_binding_with_list)(fl_Text_Editor text_editor,int key,int state,fl_Key_Func f,Key_BindingC* list){ + DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); + DerivedText_Editor* e = (static_cast(text_editor)); + C_to_Fl_Callback* context = new C_to_Fl_Callback(f); + e->add_key_binding(key,state,context,&bs); + } + FL_EXPORT_C(void,Fl_Text_Editor_add_key_binding)(fl_Text_Editor text_editor,int key,int state,fl_Key_Func f){ + C_to_Fl_Callback* context = new C_to_Fl_Callback(f); + (static_cast(text_editor))->add_key_binding(key,state,context); + } + FL_EXPORT_C(void,Fl_Text_Editor_remove_key_binding_with_list)(fl_Text_Editor text_editor,int key,int state,Key_BindingC* list){ + DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); + (static_cast(text_editor))->remove_key_binding(key,state,&bs); + } + FL_EXPORT_C(void,Fl_Text_Editor_remove_key_binding)(fl_Text_Editor text_editor,int key,int state){ + (static_cast(text_editor))->remove_key_binding(key,state); + } + FL_EXPORT_C(void,Fl_Text_Editor_remove_all_key_bindings_with_list)(fl_Text_Editor text_editor,Key_BindingC* list){ + DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); + (static_cast(text_editor))->remove_all_key_bindings(&bs); + } + FL_EXPORT_C(void,Fl_Text_Editor_remove_all_key_bindings)(fl_Text_Editor text_editor){ + (static_cast(text_editor))->remove_all_key_bindings(); + } + FL_EXPORT_C(void,Fl_Text_Editor_replace_key_bindings)(fl_Text_Editor text_editor, Key_BindingC* list){ + DerivedText_Editor::Key_Binding_With_Callback* bs = convertKeyBindings(list); + (static_cast(text_editor))->replace_key_bindings(&bs); + } + FL_EXPORT_C(void,Fl_Text_Editor_replace_key_bindings_with_list)(fl_Text_Editor text_editor, Key_BindingC* list1, Key_BindingC* list2){ + DerivedText_Editor::Key_Binding_With_Callback* bs1 = convertKeyBindings(list1); + DerivedText_Editor::Key_Binding_With_Callback* bs2 = convertKeyBindings(list2); + (static_cast(text_editor))->replace_key_bindings(&bs1,&bs2); + } + FL_EXPORT_C(Key_BindingC* ,Fl_Text_Editor_add_default_key_bindings)(fl_Text_Editor text_editor,Key_BindingC* list){ + DerivedText_Editor::Key_Binding_With_Callback* bs_ = new DerivedText_Editor::Key_Binding_With_Callback(); + (static_cast(text_editor))->add_default_key_bindings(&bs_); + list = convertKeyBindings(bs_); + return list; + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_undo)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_undo(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_ignore)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_ignore(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_backspace)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_backspace(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_enter)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_enter(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_move)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_move(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_shift_move)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_shift_move(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_ctrl_move)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_ctrl_move(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_c_s_move)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_c_s_move(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_meta_move)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_meta_move(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_m_s_move)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_m_s_move(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_home)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_home(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_end)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_end(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_left)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_left(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_up)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_up(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_right)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_right(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_down)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_down(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_page_up)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_page_up(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_page_down)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_page_down(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_insert)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_insert(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_delete)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_delete(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_copy)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_copy(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_cut)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_cut(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_paste)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_paste(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_select_all)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_select_all(c,(static_cast(e))); + } + FL_EXPORT_C(int,Fl_Text_Editor_kf_default)(int c,fl_Text_Editor e){ + return Fl_Text_Editor::kf_default(c,(static_cast(e))); + } + FL_EXPORT_C(void, Fl_Text_Editor_draw)(fl_Text_Editor o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Text_Editor_draw_super)(fl_Text_Editor o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Text_Editor_handle)(fl_Text_Editor o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Text_Editor_handle_super)(fl_Text_Editor o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Text_Editor_resize)(fl_Text_Editor o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Text_Editor_resize_super)(fl_Text_Editor o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Text_Editor_show)(fl_Text_Editor o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Text_Editor_show_super)(fl_Text_Editor o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Text_Editor_hide)(fl_Text_Editor o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Text_Editor_hide_super)(fl_Text_Editor o){ + (static_cast(o))->hide_super(); + } + FL_EXPORT_C(fl_Text_Editor, Fl_Text_Editor_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + DerivedText_Editor* w = new DerivedText_Editor(X,Y,W,H,fs); + return (fl_Text_Editor)w; + } + FL_EXPORT_C(fl_Text_Editor, Fl_Text_Editor_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + DerivedText_Editor* w = new DerivedText_Editor(X,Y,W,H,label,fs); + return (fl_Text_Editor)w; + } + FL_EXPORT_C(fl_Text_Editor, Fl_OverriddenText_Editor_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + DerivedText_Editor* w = new DerivedText_Editor(X,Y,W,H,fs); + return (fl_Text_Editor)w; + } + FL_EXPORT_C(fl_Text_Editor, Fl_OverriddenText_Editor_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + DerivedText_Editor* w = new DerivedText_Editor(X,Y,W,H,label,fs); + return (fl_Text_Editor)w; + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Text_EditorC.h b/c-src/Fl_Text_EditorC.h index 9798fcb5..83ab9f0f 100644 --- a/c-src/Fl_Text_EditorC.h +++ b/c-src/Fl_Text_EditorC.h @@ -7,6 +7,7 @@ #include "FL/Fl.H" #include "FL/Fl_Text_Editor.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { #endif /* Inherited from Fl_Widget */ @@ -190,7 +191,7 @@ EXPORT { FL_EXPORT_C(void, Fl_Text_Editor_remove_all_key_bindings)(fl_Text_Editor text_editor); FL_EXPORT_C(Key_BindingC*, Fl_Text_Editor_add_default_key_bindings)(fl_Text_Editor text_editor, Key_BindingC* list); - // functions for the built in default bindings + // functions for the built in default bindings FL_EXPORT_C(int, Fl_Text_Editor_kf_default)(int c, fl_Text_Editor e); FL_EXPORT_C(int, Fl_Text_Editor_kf_ignore)(int c, fl_Text_Editor e); FL_EXPORT_C(int, Fl_Text_Editor_kf_backspace)(int c, fl_Text_Editor e); @@ -218,6 +219,18 @@ EXPORT { FL_EXPORT_C(int, Fl_Text_Editor_kf_undo)(int c, fl_Text_Editor e); FL_EXPORT_C(void,Fl_Text_Editor_replace_key_bindings)(fl_Text_Editor text_editor, Key_BindingC* list); FL_EXPORT_C(void,Fl_Text_Editor_replace_key_bindings_with_list)(fl_Text_Editor text_editor, Key_BindingC* list1, Key_BindingC* list2); + FL_EXPORT_C(fl_Text_Editor, Fl_OverriddenText_Editor_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Text_Editor, Fl_OverriddenText_Editor_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Text_Editor_draw)(fl_Text_Editor o); + FL_EXPORT_C(void, Fl_Text_Editor_draw_super)(fl_Text_Editor o); + FL_EXPORT_C(int, Fl_Text_Editor_handle)(fl_Text_Editor o, int event); + FL_EXPORT_C(int, Fl_Text_Editor_handle_super)(fl_Text_Editor o, int event); + FL_EXPORT_C(void, Fl_Text_Editor_resize)(fl_Text_Editor o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Text_Editor_resize_super)(fl_Text_Editor o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Text_Editor_show)(fl_Text_Editor o); + FL_EXPORT_C(void, Fl_Text_Editor_show_super)(fl_Text_Editor o); + FL_EXPORT_C(void, Fl_Text_Editor_hide)(fl_Text_Editor o); + FL_EXPORT_C(void, Fl_Text_Editor_hide_super)(fl_Text_Editor o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TileC.cpp b/c-src/Fl_TileC.cpp index 017cf454..58444053 100644 --- a/c-src/Fl_TileC.cpp +++ b/c-src/Fl_TileC.cpp @@ -1,10 +1,82 @@ #include "Fl_TileC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Tile_handle)(fl_Tile tile, int event){ - return (static_cast(tile))->handle(event); + Fl_DerivedTile::Fl_DerivedTile(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Tile(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTile::Fl_DerivedTile(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Tile(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTile::~Fl_DerivedTile(){ + free(overriddenFuncs); + } + void Fl_DerivedTile::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Tile) this); + } + else { + Fl_Tile::draw(); + } + } + + void Fl_DerivedTile::draw_super(){ + Fl_Tile::draw(); + } + + int Fl_DerivedTile::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Tile) this,event); + } + else { + i = Fl_Tile::handle(event); + } + return i; + } + int Fl_DerivedTile::handle_super(int event){ + return Fl_Tile::handle(event); + } + + void Fl_DerivedTile::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Tile) this,x,y,w,h); + } + else { + Fl_Tile::resize(x,y,w,h); + } + } + + void Fl_DerivedTile::resize_super(int x, int y, int w, int h){ + Fl_Tile::resize(x,y,w,h); + } + void Fl_DerivedTile::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Tile) this); + } + else { + Fl_Tile::show(); + } + } + void Fl_DerivedTile::show_super(){ + Fl_Tile::show(); + } + + void Fl_DerivedTile::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Tile) this); + } + else { + Fl_Tile::hide(); + } } + void Fl_DerivedTile::hide_super(){ + Fl_Tile::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Tile_parent)(fl_Tile tile){ return (fl_Group) (static_cast(tile))->parent(); } @@ -303,9 +375,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Tile_add_resizable)(fl_Tile tile,fl_Widget o){ return (static_cast(tile))->add_resizable(*(static_cast(o))); } - FL_EXPORT_C(void,Fl_Tile_resize)(fl_Tile tile, int x, int y, int w, int h){ - return (static_cast(tile))->resize(x, y, w, h); - } FL_EXPORT_C(void,Fl_Tile_init_sizes)(fl_Tile tile){ (static_cast(tile))->init_sizes(); } @@ -333,14 +402,55 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Tile_child)(fl_Tile tile, int n){ return (fl_Widget)(static_cast(tile))->child(n); } - FL_EXPORT_C(fl_Tile, Fl_Tile_New)(int x, int y, int w, int h){ - Fl_Tile* g = new Fl_Tile(x,y,w,h); - return (fl_Tile)g; + FL_EXPORT_C(fl_Tile, Fl_Tile_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTile* w = new Fl_DerivedTile(X,Y,W,H,fs); + return (fl_Tile)w; + } + FL_EXPORT_C(fl_Tile, Fl_Tile_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTile* w = new Fl_DerivedTile(X,Y,W,H,label,fs); + return (fl_Tile)w; } - FL_EXPORT_C(fl_Tile, Fl_Tile_New_WithLabel)(int x, int y, int w, int h, const char* t){ - Fl_Tile* g = new Fl_Tile(x,y,w,h,t); - return (fl_Tile)g; + FL_EXPORT_C(fl_Tile, Fl_OverriddenTile_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTile* w = new Fl_DerivedTile(X,Y,W,H,fs); + return (fl_Tile)w; } + FL_EXPORT_C(fl_Tile, Fl_OverriddenTile_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTile* w = new Fl_DerivedTile(X,Y,W,H,label,fs); + return (fl_Tile)w; + } + FL_EXPORT_C(void, Fl_Tile_draw)(fl_Tile o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Tile_draw_super)(fl_Tile o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Tile_handle)(fl_Tile o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Tile_handle_super)(fl_Tile o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Tile_resize)(fl_Tile o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Tile_resize_super)(fl_Tile o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Tile_show)(fl_Tile o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Tile_show_super)(fl_Tile o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Tile_hide)(fl_Tile o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Tile_hide_super)(fl_Tile o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TileC.h b/c-src/Fl_TileC.h index 21fe6b0d..0d29640b 100644 --- a/c-src/Fl_TileC.h +++ b/c-src/Fl_TileC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Tile.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedTile : public Fl_Tile { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedTile(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedTile(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedTile(); + }; + #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int, Fl_Tile_handle)(fl_Tile tile, int event); @@ -126,6 +146,18 @@ EXPORT { FL_EXPORT_C(fl_Group, Fl_Tile_New)(int x, int y, int w, int h); FL_EXPORT_C(fl_Group, Fl_Tile_New_WithLabel)(int x, int y, int w, int h, const char* t); FL_EXPORT_C(void, Fl_Tile_position)(fl_Tile tile, int x, int y, int w, int h); + FL_EXPORT_C(fl_Tile, Fl_OverriddenTile_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Tile, Fl_OverriddenTile_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Tile_draw)(fl_Tile o); + FL_EXPORT_C(void, Fl_Tile_draw_super)(fl_Tile o); + FL_EXPORT_C(int, Fl_Tile_handle)(fl_Tile o, int event); + FL_EXPORT_C(int, Fl_Tile_handle_super)(fl_Tile o, int event); + FL_EXPORT_C(void, Fl_Tile_resize)(fl_Tile o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Tile_resize_super)(fl_Tile o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Tile_show)(fl_Tile o); + FL_EXPORT_C(void, Fl_Tile_show_super)(fl_Tile o); + FL_EXPORT_C(void, Fl_Tile_hide)(fl_Tile o); + FL_EXPORT_C(void, Fl_Tile_hide_super)(fl_Tile o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TimerC.cpp b/c-src/Fl_TimerC.cpp index f8c3dc11..61bea784 100644 --- a/c-src/Fl_TimerC.cpp +++ b/c-src/Fl_TimerC.cpp @@ -1,10 +1,76 @@ #include "Fl_TimerC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int , Fl_Timer_handle )(fl_Timer timer,int event) { - return (static_cast(timer))->handle(event); + Fl_DerivedTimer::Fl_DerivedTimer(uchar t,int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Timer(t,X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTimer::~Fl_DerivedTimer(){ + free(overriddenFuncs); + } + void Fl_DerivedTimer::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Timer) this); + } + else { + Fl_Timer::draw(); + } + } + + void Fl_DerivedTimer::draw_super(){ + Fl_Timer::draw(); + } + + int Fl_DerivedTimer::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Timer) this,event); + } + else { + i = Fl_Timer::handle(event); + } + return i; + } + int Fl_DerivedTimer::handle_super(int event){ + return Fl_Timer::handle(event); } + + void Fl_DerivedTimer::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Timer) this,x,y,w,h); + } + else { + Fl_Timer::resize(x,y,w,h); + } + } + + void Fl_DerivedTimer::resize_super(int x, int y, int w, int h){ + Fl_Timer::resize(x,y,w,h); + } + void Fl_DerivedTimer::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Timer) this); + } + else { + Fl_Timer::show(); + } + } + void Fl_DerivedTimer::show_super(){ + Fl_Timer::show(); + } + + void Fl_DerivedTimer::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Timer) this); + } + else { + Fl_Timer::hide(); + } + } + void Fl_DerivedTimer::hide_super(){ + Fl_Timer::hide(); + } +#endif FL_EXPORT_C(fl_Group,Fl_Timer_parent)(fl_Timer adjuster){ return (static_cast(adjuster))->parent(); } @@ -155,12 +221,6 @@ EXPORT { FL_EXPORT_C(int,Fl_Timer_visible_r)(fl_Timer adjuster){ return (static_cast(adjuster))->visible_r(); } - FL_EXPORT_C(void,Fl_Timer_show)(fl_Timer adjuster){ - (static_cast(adjuster))->show(); - } - FL_EXPORT_C(void,Fl_Timer_hide)(fl_Timer adjuster){ - (static_cast(adjuster))->hide(); - } FL_EXPORT_C(void,Fl_Timer_set_visible)(fl_Timer adjuster){ (static_cast(adjuster))->visible(); } @@ -257,13 +317,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Timer_as_gl_window)(fl_Timer adjuster){ return (static_cast(adjuster))->as_gl_window(); } - FL_EXPORT_C(void,Fl_Timer_resize)(fl_Timer adjuster,int X,int Y,int W,int H){ - (static_cast(adjuster))->resize(X,Y,W,H); - } - FL_EXPORT_C(fl_Timer,Fl_Timer_New)(int x,int y,int w,int h,const char* label){ - Fl_Timer* adjuster = new Fl_Timer(FL_NORMAL_TIMER,x,y,w,h,label); - return (fl_Timer) adjuster; - } FL_EXPORT_C(fl_Timer,Fl_Value_Timer_New)(int x,int y,int w,int h,const char* label){ Fl_Timer* adjuster = new Fl_Timer(FL_VALUE_TIMER,x,y,w,h,label); return (fl_Timer) adjuster; @@ -293,6 +346,45 @@ EXPORT { FL_EXPORT_C(void,Fl_Timer_set_suspended)(fl_Timer timer,char s){ (static_cast(timer))->suspended(s); } + FL_EXPORT_C(fl_Timer, Fl_Timer_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTimer* w = new Fl_DerivedTimer(FL_NORMAL_TIMER,X,Y,W,H,label,fs); + return (fl_Timer)w; + } + FL_EXPORT_C(fl_Timer, Fl_OverriddenTimer_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTimer* w = new Fl_DerivedTimer(FL_NORMAL_TIMER,X,Y,W,H,label,fs); + return (fl_Timer)w; + } + FL_EXPORT_C(void, Fl_Timer_draw)(fl_Timer o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Timer_draw_super)(fl_Timer o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Timer_handle)(fl_Timer o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Timer_handle_super)(fl_Timer o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Timer_resize)(fl_Timer o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Timer_resize_super)(fl_Timer o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Timer_show)(fl_Timer o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Timer_show_super)(fl_Timer o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Timer_hide)(fl_Timer o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Timer_hide_super)(fl_Timer o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TimerC.h b/c-src/Fl_TimerC.h index 2a7f5c57..f69587b0 100644 --- a/c-src/Fl_TimerC.h +++ b/c-src/Fl_TimerC.h @@ -7,7 +7,25 @@ #include "FL/Fl.H" #include "FL/Fl_Timer.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedTimer : public Fl_Timer { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedTimer(uchar t, int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedTimer(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int , Fl_Timer_handle )(fl_Timer timer,int event); @@ -111,6 +129,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Timer_set_value)(fl_Timer timer, double value); FL_EXPORT_C(char, Fl_Timer_suspended)(fl_Timer timer); FL_EXPORT_C(void, Fl_Timer_set_suspended)(fl_Timer timer, char s); + FL_EXPORT_C(fl_Timer, Fl_OverriddenTimer_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Timer, Fl_OverriddenTimer_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Timer_draw)(fl_Timer o); + FL_EXPORT_C(void, Fl_Timer_draw_super)(fl_Timer o); + FL_EXPORT_C(int, Fl_Timer_handle)(fl_Timer o, int event); + FL_EXPORT_C(int, Fl_Timer_handle_super)(fl_Timer o, int event); + FL_EXPORT_C(void, Fl_Timer_resize)(fl_Timer o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Timer_resize_super)(fl_Timer o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Timer_show)(fl_Timer o); + FL_EXPORT_C(void, Fl_Timer_show_super)(fl_Timer o); + FL_EXPORT_C(void, Fl_Timer_hide)(fl_Timer o); + FL_EXPORT_C(void, Fl_Timer_hide_super)(fl_Timer o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TreeC.cpp b/c-src/Fl_TreeC.cpp index d065e6b0..e4bcfbd1 100644 --- a/c-src/Fl_TreeC.cpp +++ b/c-src/Fl_TreeC.cpp @@ -1,10 +1,82 @@ #include "Fl_TreeC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Tree_handle)(fl_Tree self, int event){ - return (static_cast(self))->handle(event); + Fl_DerivedTree::Fl_DerivedTree(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Tree(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTree::Fl_DerivedTree(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Tree(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedTree::~Fl_DerivedTree(){ + free(overriddenFuncs); + } + void Fl_DerivedTree::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Tree) this); + } + else { + Fl_Tree::draw(); + } + } + + void Fl_DerivedTree::draw_super(){ + Fl_Tree::draw(); + } + + int Fl_DerivedTree::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Tree) this,event); + } + else { + i = Fl_Tree::handle(event); + } + return i; + } + int Fl_DerivedTree::handle_super(int event){ + return Fl_Tree::handle(event); + } + + void Fl_DerivedTree::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Tree) this,x,y,w,h); + } + else { + Fl_Tree::resize(x,y,w,h); + } + } + + void Fl_DerivedTree::resize_super(int x, int y, int w, int h){ + Fl_Tree::resize(x,y,w,h); + } + void Fl_DerivedTree::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Tree) this); + } + else { + Fl_Tree::show(); + } + } + void Fl_DerivedTree::show_super(){ + Fl_Tree::show(); + } + + void Fl_DerivedTree::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Tree) this); + } + else { + Fl_Tree::hide(); + } } + void Fl_DerivedTree::hide_super(){ + Fl_Tree::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Tree_parent)(fl_Tree tree){ return (fl_Group) (static_cast(tree))->parent(); } @@ -252,10 +324,6 @@ EXPORT { FL_EXPORT_C(fl_Gl_Window,Fl_Tree_as_gl_window)(fl_Tree tree){ return (fl_Gl_Window) (static_cast(tree))->as_gl_window(); } - FL_EXPORT_C(void,Fl_Tree_draw)(fl_Tree tree){ - return (static_cast(tree))->draw(); - } - FL_EXPORT_C(void,Fl_Tree_begin)(fl_Tree tree){ (static_cast(tree))->begin(); } @@ -301,18 +369,6 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Tree_child)(fl_Tree self, int n){ return (fl_Widget)(static_cast(self))->child(n); } - // FL_EXPORT_C(void , Fl_Tree_forms_end)(fl_Tree self){ - // (static_cast(self))->forms_end(); - // } - - FL_EXPORT_C(fl_Tree, Fl_Tree_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Tree* tree = new Fl_Tree(x,y,w,h,label); - return (static_cast(tree)); - } - FL_EXPORT_C(fl_Tree, Fl_Tree_New)(int x, int y, int w, int h) { - Fl_Tree* tree = new Fl_Tree(x,y,w,h,0); - return (fl_Tree)tree; - } FL_EXPORT_C(void,Fl_Tree_Destroy)(fl_Tree tree){ delete (static_cast(tree)); } @@ -479,19 +535,19 @@ EXPORT { return (static_cast(tree))->deselect_all((static_cast(item)),docallback); } FL_EXPORT_C(void,Fl_Tree_select_only)(fl_Tree tree,fl_Tree_Item item){ - (static_cast(tree))->select_only((static_cast(item))); + (static_cast(tree))->select_only((static_cast(item))); } FL_EXPORT_C(void,Fl_Tree_select_only_with_docallback)(fl_Tree tree,fl_Tree_Item item,int docallback){ - (static_cast(tree))->select_only((static_cast(item)),docallback); + (static_cast(tree))->select_only((static_cast(item)),docallback); } FL_EXPORT_C(void,Fl_Tree_select_all)(fl_Tree tree,fl_Tree_Item item){ - (static_cast(tree))->select_all((static_cast(item))); + (static_cast(tree))->select_all((static_cast(item))); } FL_EXPORT_C(void,Fl_Tree_select_all_with_docallback)(fl_Tree tree,fl_Tree_Item item,int docallback){ - (static_cast(tree))->select_all((static_cast(item)),docallback); + (static_cast(tree))->select_all((static_cast(item)),docallback); } FL_EXPORT_C(void,Fl_Tree_set_item_focus)(fl_Tree tree,fl_Tree_Item item){ - (static_cast(tree))->set_item_focus((static_cast(item))); + (static_cast(tree))->set_item_focus((static_cast(item))); } FL_EXPORT_C(fl_Tree_Item,Fl_Tree_get_item_focus)(fl_Tree tree){ return (static_cast(tree))->get_item_focus(); @@ -672,7 +728,7 @@ EXPORT { (static_cast(tree))->show_item((static_cast(item))); } FL_EXPORT_C(void,Fl_Tree_show_item_top)(fl_Tree tree,fl_Tree_Item item){ - (static_cast(tree))->show_item_top((static_cast(item))); + (static_cast(tree))->show_item_top((static_cast(item))); } FL_EXPORT_C(void,Fl_Tree_show_item_middle)(fl_Tree tree,fl_Tree_Item item){ (static_cast(tree))->show_item_middle((static_cast(item))); @@ -716,6 +772,55 @@ EXPORT { FL_EXPORT_C(Fl_Tree_Reason,Fl_Tree_callback_reason)(fl_Tree tree){ return (static_cast(tree))->callback_reason(); } + FL_EXPORT_C(fl_Tree, Fl_Tree_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTree* w = new Fl_DerivedTree(X,Y,W,H,fs); + return (fl_Tree)w; + } + FL_EXPORT_C(fl_Tree, Fl_Tree_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedTree* w = new Fl_DerivedTree(X,Y,W,H,label,fs); + return (fl_Tree)w; + } + FL_EXPORT_C(fl_Tree, Fl_OverriddenTree_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTree* w = new Fl_DerivedTree(X,Y,W,H,fs); + return (fl_Tree)w; + } + FL_EXPORT_C(fl_Tree, Fl_OverriddenTree_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedTree* w = new Fl_DerivedTree(X,Y,W,H,label,fs); + return (fl_Tree)w; + } + FL_EXPORT_C(void, Fl_Tree_draw)(fl_Tree o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Tree_draw_super)(fl_Tree o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Tree_handle)(fl_Tree o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Tree_handle_super)(fl_Tree o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Tree_resize)(fl_Tree o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Tree_resize_super)(fl_Tree o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Tree_show)(fl_Tree o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Tree_show_super)(fl_Tree o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Tree_hide)(fl_Tree o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Tree_hide_super)(fl_Tree o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_TreeC.h b/c-src/Fl_TreeC.h index 2d376f29..41a93b67 100644 --- a/c-src/Fl_TreeC.h +++ b/c-src/Fl_TreeC.h @@ -7,7 +7,26 @@ #include "FL/Fl.H" #include "FL/Fl_Tree.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedTree : public Fl_Tree { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedTree(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedTree(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedTree(); + }; #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int,Fl_Tree_handle)(fl_Tree self, int event); @@ -253,6 +272,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Tree_set_callback_reason)(fl_Tree tree,Fl_Tree_Reason reason); FL_EXPORT_C(Fl_Tree_Reason, Fl_Tree_callback_reason)(fl_Tree tree); FL_EXPORT_C(void, Fl_Tree_load)(fl_Tree tree,fl_Preferences preferences); + FL_EXPORT_C(fl_Tree, Fl_OverriddenTree_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Tree, Fl_OverriddenTree_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Tree_draw)(fl_Tree o); + FL_EXPORT_C(void, Fl_Tree_draw_super)(fl_Tree o); + FL_EXPORT_C(int, Fl_Tree_handle)(fl_Tree o, int event); + FL_EXPORT_C(int, Fl_Tree_handle_super)(fl_Tree o, int event); + FL_EXPORT_C(void, Fl_Tree_resize)(fl_Tree o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Tree_resize_super)(fl_Tree o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Tree_show)(fl_Tree o); + FL_EXPORT_C(void, Fl_Tree_show_super)(fl_Tree o); + FL_EXPORT_C(void, Fl_Tree_hide)(fl_Tree o); + FL_EXPORT_C(void, Fl_Tree_hide_super)(fl_Tree o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Value_InputC.cpp b/c-src/Fl_Value_InputC.cpp index 38c12b09..db8fc405 100644 --- a/c-src/Fl_Value_InputC.cpp +++ b/c-src/Fl_Value_InputC.cpp @@ -2,11 +2,83 @@ #ifdef __cplusplus EXPORT { + Fl_DerivedValue_Input::Fl_DerivedValue_Input(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Value_Input(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedValue_Input::Fl_DerivedValue_Input(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Value_Input(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedValue_Input::~Fl_DerivedValue_Input(){ + free(overriddenFuncs); + } + void Fl_DerivedValue_Input::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Value_Input) this); + } + else { + Fl_Value_Input::draw(); + } + } + + void Fl_DerivedValue_Input::draw_super(){ + Fl_Value_Input::draw(); + } + + int Fl_DerivedValue_Input::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Value_Input) this,event); + } + else { + i = Fl_Value_Input::handle(event); + } + return i; + } + int Fl_DerivedValue_Input::handle_super(int event){ + return Fl_Value_Input::handle(event); + } + + void Fl_DerivedValue_Input::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Value_Input) this,x,y,w,h); + } + else { + Fl_Value_Input::resize(x,y,w,h); + } + } + + void Fl_DerivedValue_Input::resize_super(int x, int y, int w, int h){ + Fl_Value_Input::resize(x,y,w,h); + } + void Fl_DerivedValue_Input::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Value_Input) this); + } + else { + Fl_Value_Input::show(); + } + } + void Fl_DerivedValue_Input::show_super(){ + Fl_Value_Input::show(); + } + + void Fl_DerivedValue_Input::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Value_Input) this); + } + else { + Fl_Value_Input::hide(); + } + } + void Fl_DerivedValue_Input::hide_super(){ + Fl_Value_Input::hide(); + } + + #endif /* Inherited from Fl_Widget */ - FL_EXPORT_C(int,Fl_Value_Input_handle)(fl_Value_Input self, int event){ - return (static_cast(self))->handle(event); - } FL_EXPORT_C(fl_Group,Fl_Value_Input_parent)(fl_Value_Input value_input){ return (fl_Group) (static_cast(value_input))->parent(); } @@ -314,23 +386,12 @@ EXPORT { FL_EXPORT_C(double,Fl_Value_Input_increment)(fl_Value_Input value_input,double v,int n){ return (static_cast(value_input))->increment(v,n); } - FL_EXPORT_C(fl_Value_Input, Fl_Value_Input_New_WithLabel)(int x, int y, int w, int h, const char* label){ - Fl_Value_Input* value_input = new Fl_Value_Input(x,y,w,h,label); - return (static_cast(value_input)); - } - FL_EXPORT_C(fl_Value_Input, Fl_Value_Input_New)(int x, int y, int w, int h){ - Fl_Value_Input* value_input = new Fl_Value_Input(x,y,w,h,0); - return (static_cast(value_input)); - } FL_EXPORT_C(void,Fl_Value_Input_Destroy)(fl_Value_Input value_input){ delete (static_cast(value_input)); } FL_EXPORT_C(char,Fl_Value_Input_soft)(fl_Value_Input value_input){ return (static_cast(value_input))->soft(); } - FL_EXPORT_C(void,Fl_Value_Input_resize)(fl_Value_Input value_input,int X,int Y,int W,int H){ - (static_cast(value_input))->resize(X,Y,W,H); - } FL_EXPORT_C(void,Fl_Value_Input_set_soft)(fl_Value_Input value_input,char s){ (static_cast(value_input))->soft(s); } @@ -358,6 +419,54 @@ EXPORT { FL_EXPORT_C(void,Fl_Value_Input_set_textcolor)(fl_Value_Input value_input,int v){ (static_cast(value_input))->textcolor(v); } + FL_EXPORT_C(fl_Value_Input, Fl_Value_Input_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedValue_Input* w = new Fl_DerivedValue_Input(X,Y,W,H,fs); + return (fl_Value_Input)w; + } + FL_EXPORT_C(fl_Value_Input, Fl_Value_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedValue_Input* w = new Fl_DerivedValue_Input(X,Y,W,H,label,fs); + return (fl_Value_Input)w; + } + FL_EXPORT_C(fl_Value_Input, Fl_OverriddenValue_Input_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedValue_Input* w = new Fl_DerivedValue_Input(X,Y,W,H,fs); + return (fl_Value_Input)w; + } + FL_EXPORT_C(fl_Value_Input, Fl_OverriddenValue_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedValue_Input* w = new Fl_DerivedValue_Input(X,Y,W,H,label,fs); + return (fl_Value_Input)w; + } + FL_EXPORT_C(void, Fl_Value_Input_draw)(fl_Value_Input o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Value_Input_draw_super)(fl_Value_Input o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Value_Input_handle)(fl_Value_Input o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Value_Input_handle_super)(fl_Value_Input o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Value_Input_resize)(fl_Value_Input o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Value_Input_resize_super)(fl_Value_Input o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Value_Input_show)(fl_Value_Input o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Value_Input_show_super)(fl_Value_Input o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Value_Input_hide)(fl_Value_Input o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Value_Input_hide_super)(fl_Value_Input o){ + (static_cast(o))->hide_super(); + } #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Value_InputC.h b/c-src/Fl_Value_InputC.h index 26e02c4c..849e8498 100644 --- a/c-src/Fl_Value_InputC.h +++ b/c-src/Fl_Value_InputC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Value_Input.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedValue_Input : public Fl_Value_Input { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedValue_Input(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedValue_Input(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedValue_Input(); + }; + #endif FL_EXPORT_C(int,Fl_Value_Input_handle)(fl_Value_Input self, int event); FL_EXPORT_C(fl_Group, Fl_Value_Input_parent)(fl_Value_Input value_input); @@ -127,6 +147,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Value_Input_set_textsize)(fl_Value_Input value_input,int v); FL_EXPORT_C(Fl_Color, Fl_Value_Input_textcolor)(fl_Value_Input value_input); FL_EXPORT_C(void, Fl_Value_Input_set_textcolor)(fl_Value_Input value_input,int v); + FL_EXPORT_C(fl_Value_Input, Fl_OverriddenValue_Input_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Value_Input, Fl_OverriddenValue_Input_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Value_Input_draw)(fl_Value_Input o); + FL_EXPORT_C(void, Fl_Value_Input_draw_super)(fl_Value_Input o); + FL_EXPORT_C(int, Fl_Value_Input_handle)(fl_Value_Input o, int event); + FL_EXPORT_C(int, Fl_Value_Input_handle_super)(fl_Value_Input o, int event); + FL_EXPORT_C(void, Fl_Value_Input_resize)(fl_Value_Input o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Value_Input_resize_super)(fl_Value_Input o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Value_Input_show)(fl_Value_Input o); + FL_EXPORT_C(void, Fl_Value_Input_show_super)(fl_Value_Input o); + FL_EXPORT_C(void, Fl_Value_Input_hide)(fl_Value_Input o); + FL_EXPORT_C(void, Fl_Value_Input_hide_super)(fl_Value_Input o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Value_OutputC.cpp b/c-src/Fl_Value_OutputC.cpp index e47442e4..3917abb7 100644 --- a/c-src/Fl_Value_OutputC.cpp +++ b/c-src/Fl_Value_OutputC.cpp @@ -2,14 +2,83 @@ #ifdef __cplusplus EXPORT { -#endif - /* Inherited from Fl_Widget */ - FL_EXPORT_C(void,Fl_Value_Output_resize)(fl_Value_Output value_output,int X,int Y,int W,int H) { - (static_cast(value_output)->resize(X,Y,W,H)); + Fl_DerivedValue_Output::Fl_DerivedValue_Output(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Value_Output(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedValue_Output::Fl_DerivedValue_Output(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Value_Output(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedValue_Output::~Fl_DerivedValue_Output(){ + free(overriddenFuncs); + } + void Fl_DerivedValue_Output::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Value_Output) this); + } + else { + Fl_Value_Output::draw(); + } + } + + void Fl_DerivedValue_Output::draw_super(){ + Fl_Value_Output::draw(); + } + + int Fl_DerivedValue_Output::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Value_Output) this,event); + } + else { + i = Fl_Value_Output::handle(event); + } + return i; + } + int Fl_DerivedValue_Output::handle_super(int event){ + return Fl_Value_Output::handle(event); + } + + void Fl_DerivedValue_Output::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Value_Output) this,x,y,w,h); + } + else { + Fl_Value_Output::resize(x,y,w,h); + } + } + + void Fl_DerivedValue_Output::resize_super(int x, int y, int w, int h){ + Fl_Value_Output::resize(x,y,w,h); + } + void Fl_DerivedValue_Output::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Value_Output) this); + } + else { + Fl_Value_Output::show(); + } } - FL_EXPORT_C(int,Fl_Value_Output_handle)(fl_Value_Output self, int event){ - return (static_cast(self))->handle(event); + void Fl_DerivedValue_Output::show_super(){ + Fl_Value_Output::show(); } + + void Fl_DerivedValue_Output::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Value_Output) this); + } + else { + Fl_Value_Output::hide(); + } + } + void Fl_DerivedValue_Output::hide_super(){ + Fl_Value_Output::hide(); + } + + +#endif + /* Inherited from Fl_Widget */ FL_EXPORT_C(fl_Group,Fl_Value_Output_parent)(fl_Value_Output value_output){ return (fl_Group) (static_cast(value_output))->parent(); } @@ -317,14 +386,6 @@ EXPORT { FL_EXPORT_C(double,Fl_Value_Output_increment)(fl_Value_Output value_output,double v,int n){ return (static_cast(value_output))->increment(v,n); } - FL_EXPORT_C(fl_Value_Output, Fl_Value_Output_New_WithLabel)(int x, int y, int w, int h, const char* label){ - Fl_Value_Output* value_output = new Fl_Value_Output(x,y,w,h,label); - return (static_cast(value_output)); - } - FL_EXPORT_C(fl_Value_Output, Fl_Value_Output_New)(int x, int y, int w, int h){ - Fl_Value_Output* value_output = new Fl_Value_Output(x,y,w,h,0); - return (static_cast(value_output)); - } FL_EXPORT_C(void,Fl_Value_Output_Destroy)(fl_Value_Output value_output){ delete (static_cast(value_output)); } @@ -352,6 +413,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Value_Output_set_textcolor)(fl_Value_Output value_output,int v){ (static_cast(value_output))->textcolor(v); } + FL_EXPORT_C(fl_Value_Output, Fl_Value_Output_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedValue_Output* w = new Fl_DerivedValue_Output(X,Y,W,H,fs); + return (fl_Value_Output)w; + } + FL_EXPORT_C(fl_Value_Output, Fl_Value_Output_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedValue_Output* w = new Fl_DerivedValue_Output(X,Y,W,H,label,fs); + return (fl_Value_Output)w; + } + FL_EXPORT_C(fl_Value_Output, Fl_OverriddenValue_Output_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedValue_Output* w = new Fl_DerivedValue_Output(X,Y,W,H,fs); + return (fl_Value_Output)w; + } + FL_EXPORT_C(fl_Value_Output, Fl_OverriddenValue_Output_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedValue_Output* w = new Fl_DerivedValue_Output(X,Y,W,H,label,fs); + return (fl_Value_Output)w; + } + FL_EXPORT_C(void, Fl_Value_Output_draw)(fl_Value_Output o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Value_Output_draw_super)(fl_Value_Output o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Value_Output_handle)(fl_Value_Output o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Value_Output_handle_super)(fl_Value_Output o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Value_Output_resize)(fl_Value_Output o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Value_Output_resize_super)(fl_Value_Output o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Value_Output_show)(fl_Value_Output o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Value_Output_show_super)(fl_Value_Output o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Value_Output_hide)(fl_Value_Output o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Value_Output_hide_super)(fl_Value_Output o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Value_OutputC.h b/c-src/Fl_Value_OutputC.h index 48ef833a..8f4393b1 100644 --- a/c-src/Fl_Value_OutputC.h +++ b/c-src/Fl_Value_OutputC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Value_Output.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedValue_Output : public Fl_Value_Output { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedValue_Output(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedValue_Output(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedValue_Output(); + }; + #endif FL_EXPORT_C(int,Fl_Value_Output_handle)(fl_Value_Output self, int event); FL_EXPORT_C(fl_Group, Fl_Value_Output_parent)(fl_Value_Output value_output); @@ -125,6 +145,18 @@ EXPORT { FL_EXPORT_C(void, Fl_Value_Output_set_textsize)(fl_Value_Output value_output,int v); FL_EXPORT_C(Fl_Color, Fl_Value_Output_textcolor)(fl_Value_Output value_output); FL_EXPORT_C(void, Fl_Value_Output_set_textcolor)(fl_Value_Output value_output,int v); + FL_EXPORT_C(fl_Value_Output, Fl_OverriddenValue_Output_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Value_Output, Fl_OverriddenValue_Output_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Value_Output_draw)(fl_Value_Output o); + FL_EXPORT_C(void, Fl_Value_Output_draw_super)(fl_Value_Output o); + FL_EXPORT_C(int, Fl_Value_Output_handle)(fl_Value_Output o, int event); + FL_EXPORT_C(int, Fl_Value_Output_handle_super)(fl_Value_Output o, int event); + FL_EXPORT_C(void, Fl_Value_Output_resize)(fl_Value_Output o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Value_Output_resize_super)(fl_Value_Output o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Value_Output_show)(fl_Value_Output o); + FL_EXPORT_C(void, Fl_Value_Output_show_super)(fl_Value_Output o); + FL_EXPORT_C(void, Fl_Value_Output_hide)(fl_Value_Output o); + FL_EXPORT_C(void, Fl_Value_Output_hide_super)(fl_Value_Output o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Value_SliderC.cpp b/c-src/Fl_Value_SliderC.cpp index cd1e0518..d6a7b372 100644 --- a/c-src/Fl_Value_SliderC.cpp +++ b/c-src/Fl_Value_SliderC.cpp @@ -1,19 +1,82 @@ #include "Fl_Value_SliderC.h" #ifdef __cplusplus EXPORT { -#endif - FL_EXPORT_C(int,Fl_Value_Slider_handle )(fl_Value_Slider value_slider, int event){ - return (static_cast(value_slider))->handle(event); + Fl_DerivedValue_Slider::Fl_DerivedValue_Slider(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Value_Slider(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedValue_Slider::Fl_DerivedValue_Slider(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Value_Slider(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedValue_Slider::~Fl_DerivedValue_Slider(){ + free(overriddenFuncs); + } + void Fl_DerivedValue_Slider::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Value_Slider) this); + } + else { + Fl_Value_Slider::draw(); + } + } + + void Fl_DerivedValue_Slider::draw_super(){ + Fl_Value_Slider::draw(); + } + + int Fl_DerivedValue_Slider::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Value_Slider) this,event); + } + else { + i = Fl_Value_Slider::handle(event); + } + return i; + } + int Fl_DerivedValue_Slider::handle_super(int event){ + return Fl_Value_Slider::handle(event); + } + + void Fl_DerivedValue_Slider::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Value_Slider) this,x,y,w,h); + } + else { + Fl_Value_Slider::resize(x,y,w,h); + } + } + + void Fl_DerivedValue_Slider::resize_super(int x, int y, int w, int h){ + Fl_Value_Slider::resize(x,y,w,h); + } + void Fl_DerivedValue_Slider::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Value_Slider) this); + } + else { + Fl_Value_Slider::show(); + } } - FL_EXPORT_C(void,Fl_Value_Slider_resize )(fl_Value_Slider value_slider,int x, int y, int w, int h){ - (static_cast(value_slider))->resize(x,y,w,h); + void Fl_DerivedValue_Slider::show_super(){ + Fl_Value_Slider::show(); } - FL_EXPORT_C(void,Fl_Value_Slider_show )(fl_Value_Slider value_slider){ - (static_cast(value_slider))->show(); + + void Fl_DerivedValue_Slider::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Value_Slider) this); + } + else { + Fl_Value_Slider::hide(); + } } - FL_EXPORT_C(void,Fl_Value_Slider_hide )(fl_Value_Slider value_slider){ - (static_cast(value_slider))->hide(); + void Fl_DerivedValue_Slider::hide_super(){ + Fl_Value_Slider::hide(); } + + +#endif FL_EXPORT_C(fl_Window,Fl_Value_Slider_as_window )(fl_Value_Slider value_slider){ return (static_cast(value_slider))->as_window(); } @@ -330,14 +393,6 @@ EXPORT { FL_EXPORT_C(void,Fl_Value_Slider_set_value_slider)(fl_Value_Slider value_slider,Fl_Boxtype c){ (static_cast(value_slider))->slider(c); } - FL_EXPORT_C(fl_Value_Slider, Fl_Value_Slider_New_WithLabel)(int x, int y, int w, int h, const char* label) { - Fl_Value_Slider* value_slider = new Fl_Value_Slider(x,y,w,h,label); - return (static_cast(value_slider)); - } - FL_EXPORT_C(fl_Value_Slider, Fl_Value_Slider_New)(int x, int y, int w, int h) { - Fl_Value_Slider* value_slider = new Fl_Value_Slider(x,y,w,h,0); - return (fl_Value_Slider)value_slider; - } FL_EXPORT_C(fl_Hor_Value_Slider, Fl_Hor_Value_Slider_New_WithLabel)(int x, int y, int w, int h, const char* label) { Fl_Hor_Value_Slider* hor_value_slider = new Fl_Hor_Value_Slider(x,y,w,h,label); return (static_cast(hor_value_slider)); @@ -367,6 +422,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Value_Slider_set_textcolor)(fl_Value_Slider value_slider,Fl_Color s){ return (static_cast(value_slider))->textcolor(s); } + FL_EXPORT_C(fl_Value_Slider, Fl_Value_Slider_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedValue_Slider* w = new Fl_DerivedValue_Slider(X,Y,W,H,fs); + return (fl_Value_Slider)w; + } + FL_EXPORT_C(fl_Value_Slider, Fl_Value_Slider_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedValue_Slider* w = new Fl_DerivedValue_Slider(X,Y,W,H,label,fs); + return (fl_Value_Slider)w; + } + FL_EXPORT_C(fl_Value_Slider, Fl_OverriddenValue_Slider_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedValue_Slider* w = new Fl_DerivedValue_Slider(X,Y,W,H,fs); + return (fl_Value_Slider)w; + } + FL_EXPORT_C(fl_Value_Slider, Fl_OverriddenValue_Slider_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedValue_Slider* w = new Fl_DerivedValue_Slider(X,Y,W,H,label,fs); + return (fl_Value_Slider)w; + } + FL_EXPORT_C(void, Fl_Value_Slider_draw)(fl_Value_Slider o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Value_Slider_draw_super)(fl_Value_Slider o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Value_Slider_handle)(fl_Value_Slider o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Value_Slider_handle_super)(fl_Value_Slider o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Value_Slider_resize)(fl_Value_Slider o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Value_Slider_resize_super)(fl_Value_Slider o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Value_Slider_show)(fl_Value_Slider o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Value_Slider_show_super)(fl_Value_Slider o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Value_Slider_hide)(fl_Value_Slider o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Value_Slider_hide_super)(fl_Value_Slider o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_Value_SliderC.h b/c-src/Fl_Value_SliderC.h index 92f2c0d8..a5bc5300 100644 --- a/c-src/Fl_Value_SliderC.h +++ b/c-src/Fl_Value_SliderC.h @@ -8,7 +8,27 @@ #include "FL/Fl_Value_Slider.H" #include "FL/Fl_Hor_Value_Slider.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedValue_Slider : public Fl_Value_Slider { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedValue_Slider(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedValue_Slider(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedValue_Slider(); + }; + #endif FL_EXPORT_C(fl_Group, Fl_Value_Slider_parent)(fl_Value_Slider value_slider); FL_EXPORT_C(void, Fl_Value_Slider_set_parent)(fl_Value_Slider value_slider, fl_Group grp); @@ -119,7 +139,7 @@ EXPORT { FL_EXPORT_C(void, Fl_Value_Slider_value_slider_size)(fl_Value_Slider value_slider, double v); FL_EXPORT_C(Fl_Boxtype, Fl_Value_Slider_value_slider)(fl_Value_Slider value_slider); FL_EXPORT_C(void, Fl_Value_Slider_set_value_slider)(fl_Value_Slider value_slider, Fl_Boxtype c); - + /* Fl_Value_Slider specific */ FL_EXPORT_C(fl_Value_Slider, Fl_Value_Slider_New_WithLabel)(int x, int y, int w, int h, const char* label); @@ -134,6 +154,18 @@ EXPORT { FL_EXPORT_C(Fl_Color, Fl_Value_Slider_textcolor)(fl_Value_Slider value_slider); FL_EXPORT_C(void, Fl_Value_Slider_set_textcolor)(fl_Value_Slider value_slider, Fl_Color s); FL_EXPORT_C(int,Fl_Value_Slider_handle)(fl_Widget self, int event); + FL_EXPORT_C(fl_Value_Slider, Fl_OverriddenValue_Slider_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Value_Slider, Fl_OverriddenValue_Slider_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Value_Slider_draw)(fl_Value_Slider o); + FL_EXPORT_C(void, Fl_Value_Slider_draw_super)(fl_Value_Slider o); + FL_EXPORT_C(int, Fl_Value_Slider_handle)(fl_Value_Slider o, int event); + FL_EXPORT_C(int, Fl_Value_Slider_handle_super)(fl_Value_Slider o, int event); + FL_EXPORT_C(void, Fl_Value_Slider_resize)(fl_Value_Slider o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Value_Slider_resize_super)(fl_Value_Slider o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Value_Slider_show)(fl_Value_Slider o); + FL_EXPORT_C(void, Fl_Value_Slider_show_super)(fl_Value_Slider o); + FL_EXPORT_C(void, Fl_Value_Slider_hide)(fl_Value_Slider o); + FL_EXPORT_C(void, Fl_Value_Slider_hide_super)(fl_Value_Slider o); #ifdef __cplusplus } #endif diff --git a/c-src/Fl_WizardC.cpp b/c-src/Fl_WizardC.cpp index a53f6abe..876be2f9 100644 --- a/c-src/Fl_WizardC.cpp +++ b/c-src/Fl_WizardC.cpp @@ -1,10 +1,103 @@ #include "Fl_WizardC.h" #ifdef __cplusplus +#include +#include +#include EXPORT { -#endif - FL_EXPORT_C(int,Fl_Wizard_handle)(fl_Wizard wizard, int event){ - return (static_cast(wizard))->handle(event); + Fl_DerivedWizard::Fl_DerivedWizard(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs) : Fl_Wizard(X,Y,W,H,l){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedWizard::Fl_DerivedWizard(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs):Fl_Wizard(X,Y,W,H){ + overriddenFuncs = funcs; + other_data = (void*)0; + } + Fl_DerivedWizard::~Fl_DerivedWizard(){ + free(overriddenFuncs); + } + void Fl_DerivedWizard::draw(){ + if (this->overriddenFuncs->draw != NULL) { + this->overriddenFuncs->draw((fl_Wizard) this); + } + else { + draw_super(); + } } + + void Fl_DerivedWizard::draw_super(){ + Fl_Widget *kid; // Visible child + + + kid = value(); + + if (damage() & FL_DAMAGE_ALL) + { + // Redraw everything... + if (kid) + { + draw_box(box(), x(), y(), w(), h(), kid->color()); + draw_child(*kid); + } + else + draw_box(box(), x(), y(), w(), h(), color()); + + } + else if (kid) + update_child(*kid); + } + + int Fl_DerivedWizard::handle(int event){ + int i; + if (this->overriddenFuncs->handle != NULL) { + i = this->overriddenFuncs->handle((fl_Wizard) this,event); + } + else { + i = Fl_Wizard::handle(event); + } + return i; + } + int Fl_DerivedWizard::handle_super(int event){ + return Fl_Wizard::handle(event); + } + + void Fl_DerivedWizard::resize(int x, int y, int w, int h){ + if (this->overriddenFuncs->resize != NULL) { + this->overriddenFuncs->resize((fl_Wizard) this,x,y,w,h); + } + else { + Fl_Wizard::resize(x,y,w,h); + } + } + + void Fl_DerivedWizard::resize_super(int x, int y, int w, int h){ + Fl_Wizard::resize(x,y,w,h); + } + void Fl_DerivedWizard::show(){ + if (this->overriddenFuncs->show != NULL) { + this->overriddenFuncs->show((fl_Wizard) this); + } + else { + Fl_Wizard::show(); + } + } + void Fl_DerivedWizard::show_super(){ + Fl_Wizard::show(); + } + + void Fl_DerivedWizard::hide(){ + if (this->overriddenFuncs->hide != NULL) { + this->overriddenFuncs->hide((fl_Wizard) this); + } + else { + Fl_Wizard::hide(); + } + } + void Fl_DerivedWizard::hide_super(){ + Fl_Wizard::hide(); + } + + +#endif FL_EXPORT_C(fl_Group,Fl_Wizard_parent)(fl_Wizard wizard){ return (fl_Group) (fl_Group)(static_cast(wizard))->parent(); } @@ -328,14 +421,6 @@ EXPORT { FL_EXPORT_C(fl_Widget, Fl_Wizard_child)(fl_Wizard wizard, int n){ return (fl_Widget)(static_cast(wizard))->child(n); } - FL_EXPORT_C(fl_Group, Fl_Wizard_New)(int x, int y, int w, int h){ - Fl_Wizard* wizard = new Fl_Wizard(x,y,w,h); - return (fl_Wizard)wizard; - } - FL_EXPORT_C(fl_Wizard, Fl_Wizard_New_WithLabel)(int x, int y, int w, int h, const char* t){ - Fl_Wizard* wizard = new Fl_Wizard(x,y,w,h,t); - return (fl_Wizard)wizard; - } FL_EXPORT_C(void, Fl_Wizard_Destroy)(fl_Wizard wizard){ delete (static_cast(wizard)); } @@ -351,6 +436,55 @@ EXPORT { FL_EXPORT_C(void,Fl_Wizard_set_value)(fl_Wizard wizard,fl_Widget w){ (static_cast(wizard))->value((static_cast(w))); } + FL_EXPORT_C(fl_Wizard, Fl_Wizard_New)(int X, int Y, int W, int H){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedWizard* w = new Fl_DerivedWizard(X,Y,W,H,fs); + return (fl_Wizard)w; + } + FL_EXPORT_C(fl_Wizard, Fl_Wizard_New_WithLabel)(int X, int Y, int W, int H, const char* label){ + fl_Widget_Virtual_Funcs* fs = Fl_Widget_default_virtual_funcs(); + Fl_DerivedWizard* w = new Fl_DerivedWizard(X,Y,W,H,label,fs); + return (fl_Wizard)w; + } + FL_EXPORT_C(fl_Wizard, Fl_OverriddenWizard_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedWizard* w = new Fl_DerivedWizard(X,Y,W,H,fs); + return (fl_Wizard)w; + } + FL_EXPORT_C(fl_Wizard, Fl_OverriddenWizard_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs){ + Fl_DerivedWizard* w = new Fl_DerivedWizard(X,Y,W,H,label,fs); + return (fl_Wizard)w; + } + FL_EXPORT_C(void, Fl_Wizard_draw)(fl_Wizard o){ + (static_cast(o))->draw(); + } + FL_EXPORT_C(void, Fl_Wizard_draw_super)(fl_Wizard o){ + (static_cast(o))->draw_super(); + } + FL_EXPORT_C(int, Fl_Wizard_handle)(fl_Wizard o, int event){ + return (static_cast(o))->handle(event); + } + FL_EXPORT_C(int, Fl_Wizard_handle_super)(fl_Wizard o, int event){ + return (static_cast(o))->handle_super(event); + } + FL_EXPORT_C(void, Fl_Wizard_resize)(fl_Wizard o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Wizard_resize_super)(fl_Wizard o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); + } + FL_EXPORT_C(void, Fl_Wizard_show)(fl_Wizard o){ + (static_cast(o))->show(); + } + FL_EXPORT_C(void, Fl_Wizard_show_super)(fl_Wizard o){ + (static_cast(o))->show_super(); + } + FL_EXPORT_C(void, Fl_Wizard_hide)(fl_Wizard o){ + (static_cast(o))->hide(); + } + FL_EXPORT_C(void, Fl_Wizard_hide_super)(fl_Wizard o){ + (static_cast(o))->hide_super(); + } + #ifdef __cplusplus } #endif diff --git a/c-src/Fl_WizardC.h b/c-src/Fl_WizardC.h index 4a630293..5faae637 100644 --- a/c-src/Fl_WizardC.h +++ b/c-src/Fl_WizardC.h @@ -7,7 +7,27 @@ #include "FL/Fl.H" #include "FL/Fl_Wizard.H" #include "Fl_CallbackC.h" +#include "Fl_WidgetC.h" EXPORT { + class Fl_DerivedWizard : public Fl_Wizard { + fl_Widget_Virtual_Funcs* overriddenFuncs; + void* other_data; + public: + virtual void draw(); + void draw_super(); + virtual int handle(int event); + int handle_super(int event); + virtual void resize(int x, int y, int w, int h); + void resize_super(int x, int y, int w, int h); + virtual void show(); + void show_super(); + virtual void hide(); + void hide_super(); + Fl_DerivedWizard(int X, int Y, int W, int H, const char *l, fl_Widget_Virtual_Funcs* funcs); + Fl_DerivedWizard(int X, int Y, int W, int H, fl_Widget_Virtual_Funcs* funcs); + ~Fl_DerivedWizard(); + }; + #endif /* Inherited from Fl_Widget */ FL_EXPORT_C(int, Fl_Wizard_handle)(fl_Wizard wizard, int event); @@ -133,6 +153,19 @@ EXPORT { FL_EXPORT_C(fl_Wizard, Fl_Wizard_New)(int x, int y, int w, int h); FL_EXPORT_C(fl_Wizard, Fl_Wizard_New_WithLabel)(int x, int y, int w, int h, const char* t); FL_EXPORT_C(void, Fl_Wizard_Destroy)(fl_Wizard wizard); + FL_EXPORT_C(fl_Wizard, Fl_OverriddenWizard_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(fl_Wizard, Fl_OverriddenWizard_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs); + FL_EXPORT_C(void, Fl_Wizard_draw)(fl_Wizard o); + FL_EXPORT_C(void, Fl_Wizard_draw_super)(fl_Wizard o); + FL_EXPORT_C(int, Fl_Wizard_handle)(fl_Wizard o, int event); + FL_EXPORT_C(int, Fl_Wizard_handle_super)(fl_Wizard o, int event); + FL_EXPORT_C(void, Fl_Wizard_resize)(fl_Wizard o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Wizard_resize_super)(fl_Wizard o, int x, int y, int w, int h); + FL_EXPORT_C(void, Fl_Wizard_show)(fl_Wizard o); + FL_EXPORT_C(void, Fl_Wizard_show_super)(fl_Wizard o); + FL_EXPORT_C(void, Fl_Wizard_hide)(fl_Wizard o); + FL_EXPORT_C(void, Fl_Wizard_hide_super)(fl_Wizard o); + #ifdef __cplusplus } #endif diff --git a/c-src/Makefile.in b/c-src/Makefile.in index fb187bcc..bfc89c91 100644 --- a/c-src/Makefile.in +++ b/c-src/Makefile.in @@ -20,6 +20,7 @@ CPPFILES= \ fl_utf8C.cpp \ glC.cpp \ glutC.cpp \ + Fl_CallbackC.cpp \ DerivedText_Editor.cpp \ DerivedShared_Image.cpp \ filenameC.cpp \ @@ -28,7 +29,6 @@ CPPFILES= \ Fl_BoxC.cpp \ Fl_BrowserC.cpp \ Fl_ButtonC.cpp \ - Fl_CallbackC.cpp \ Fl_C.cpp \ Fl_Check_ButtonC.cpp \ Fl_ChoiceC.cpp \ diff --git a/scripts/skeletons.el b/scripts/skeletons.el index 943ee00f..2ad16029 100644 --- a/scripts/skeletons.el +++ b/scripts/skeletons.el @@ -290,44 +290,44 @@ "" nil '(setq v1 (skeleton-read "class:")) - > (format "FL_EXPORT_C(void, Fl_%s_draw)(fl_%s w){ - (static_cast(w))->draw(); + > (format "FL_EXPORT_C(void, Fl_%s_draw)(fl_%s o){ + (static_cast(o))->draw(); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_draw_super)(fl_%s w){ - (static_cast(w))->draw(); + > (format "FL_EXPORT_C(void, Fl_%s_draw_super)(fl_%s o){ + (static_cast(o))->draw_super(); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(int, Fl_%s_handle)(fl_%s w, int event){ - return (static_cast(w))->handle(event); + > (format "FL_EXPORT_C(int, Fl_%s_handle)(fl_%s o, int event){ + return (static_cast(o))->handle(event); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(int, Fl_%s_handle_super)(fl_%s w, int event){ - return (static_cast(w))->handle(event); + > (format "FL_EXPORT_C(int, Fl_%s_handle_super)(fl_%s o, int event){ + return (static_cast(o))->handle_super(event); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_resize)(fl_%s w, int x, int y, int w, int h){ - (static_cast(w))->resize(x,y,w,h); + > (format "FL_EXPORT_C(void, Fl_%s_resize)(fl_%s o, int x, int y, int w, int h){ + (static_cast(o))->resize(x,y,w,h); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_resize_super)(fl_%s w, int x, int y, int w, int h){ - (static_cast(w))->resize(x,y,w,h); + > (format "FL_EXPORT_C(void, Fl_%s_resize_super)(fl_%s o, int x, int y, int w, int h){ + (static_cast(o))->resize_super(x,y,w,h); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_show)(fl_%s w){ - (static_cast(w))->show(); + > (format "FL_EXPORT_C(void, Fl_%s_show)(fl_%s o){ + (static_cast(o))->show(); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_show_super)(fl_%s w){ - (static_cast(w))->show(); + > (format "FL_EXPORT_C(void, Fl_%s_show_super)(fl_%s o){ + (static_cast(o))->show_super(); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_hide)(fl_%s w){ - (static_cast(w))->hide(); + > (format "FL_EXPORT_C(void, Fl_%s_hide)(fl_%s o){ + (static_cast(o))->hide(); }" v1 v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_hide_super)(fl_%s w){ - (static_cast(w))->hide(); + > (format "FL_EXPORT_C(void, Fl_%s_hide_super)(fl_%s o){ + (static_cast(o))->hide_super(); }" v1 v1 v1) ?\n ) @@ -336,24 +336,123 @@ "" nil '(setq v1 (skeleton-read "class:")) - > (format "FL_EXPORT_C(void, Fl_%s_draw)(fl_%s w);" v1 v1) + > (format "FL_EXPORT_C(fl_%s, Fl_Overridden%s_New)(int X, int Y, int W, int H,fl_Widget_Virtual_Funcs* fs);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_draw_super)(fl_%s w);" v1 v1) + > (format "FL_EXPORT_C(fl_%s, Fl_Overridden%s_New_WithLabel)(int X, int Y, int W, int H, const char* label, fl_Widget_Virtual_Funcs* fs);" v1 v1) ?\n - > (format "FL_EXPORT_C(int, Fl_%s_handle)(fl_%s w, int event);" v1 v1) + > (format "FL_EXPORT_C(void, Fl_%s_draw)(fl_%s o);" v1 v1) ?\n - > (format "FL_EXPORT_C(int, Fl_%s_handle_super)(fl_%s w, int event);" v1 v1) + > (format "FL_EXPORT_C(void, Fl_%s_draw_super)(fl_%s o);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_resize)(fl_%s w, int x, int y, int w, int h);" v1 v1) + > (format "FL_EXPORT_C(int, Fl_%s_handle)(fl_%s o, int event);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_resize_super)(fl_%s w, int x, int y, int w, int h);" v1 v1) + > (format "FL_EXPORT_C(int, Fl_%s_handle_super)(fl_%s o, int event);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_show)(fl_%s w);" v1 v1) + > (format "FL_EXPORT_C(void, Fl_%s_resize)(fl_%s o, int x, int y, int w, int h);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_show_super)(fl_%s w);" v1 v1) + > (format "FL_EXPORT_C(void, Fl_%s_resize_super)(fl_%s o, int x, int y, int w, int h);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_hide)(fl_%s w);" v1 v1) + > (format "FL_EXPORT_C(void, Fl_%s_show)(fl_%s o);" v1 v1) ?\n - > (format "FL_EXPORT_C(void, Fl_%s_hide_super)(fl_%s w);" v1 v1) + > (format "FL_EXPORT_C(void, Fl_%s_show_super)(fl_%s o);" v1 v1) ?\n + > (format "FL_EXPORT_C(void, Fl_%s_hide)(fl_%s o);" v1 v1) + ?\n + > (format "FL_EXPORT_C(void, Fl_%s_hide_super)(fl_%s o);" v1 v1) + ?\n + ) + +(define-skeleton haskell-custom + "" + nil + '(setq v1 (skeleton-read "class:")) + > (format "{# fun Fl_Overridden%s_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #}" (capitalize v1)) + ?\n + > (format "{# fun Fl_Overridden%s_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #}" (capitalize v1)) + ?\n + > (format "%sCustom :: + Rectangle -- ^ The bounds of this %s + -> Maybe T.Text -- ^ The %s label + -> Maybe (Ref %s -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs %s) -- ^ Optional custom widget functions + -> IO (Ref %s) +%sCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' +" (s-lower-camel-case v1) (s-upper-camel-case v1) (s-upper-camel-case v1) (s-upper-camel-case v1) (s-upper-camel-case v1) (s-upper-camel-case v1) (s-lower-camel-case v1)) + ?\n + ) + + +(defun custom-instances-list (class) + (let ( + (draw (format "{# fun Fl_%s_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) %s orig impl where + runOp _ _ %s = withRef %s $ \\%sPtr -> draw'' %sPtr" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (draw-super (format "{# fun Fl_%s_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) %s orig impl where + runOp _ _ %s = withRef %s $ \\%sPtr -> drawSuper' %sPtr" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (handle (format "{#fun Fl_%s_handle as %sHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) %s orig impl where + runOp _ _ %s event = withRef %s (\\p -> %sHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent" class (s-lower-camel-case class) (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (handle-super (format "{# fun Fl_%s_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) %s orig impl where + runOp _ _ %s event = withRef %s $ \\%sPtr -> handleSuper' %sPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (resize (format "{# fun Fl_%s_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) %s orig impl where + runOp _ _ %s rectangle = withRef %s $ \\%sPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' %sPtr x_pos y_pos w_pos h_pos" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (resize-super (format "{# fun Fl_%s_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) %s orig impl where + runOp _ _ %s rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef %s $ \\%sPtr -> resizeSuper' %sPtr x_pos y_pos width height" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (hide (format "{# fun Fl_%s_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) %s orig impl where + runOp _ _ %s = withRef %s $ \\%sPtr -> hide' %sPtr" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (hide-super (format "{# fun Fl_%s_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) %s orig impl where + runOp _ _ %s = withRef %s $ \\%sPtr -> hideSuper' %sPtr" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (show (format "{# fun Fl_%s_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) %s orig impl where + runOp _ _ %s = withRef %s $ \\%sPtr -> show' %sPtr" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + (show-super (format "{# fun Fl_%s_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) %s orig impl where + runOp _ _ %s = withRef %s $ \\%sPtr -> showSuper' %sPtr" class (s-upper-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class) (s-lower-camel-case class))) + ) + (list draw draw-super handle handle-super resize resize-super hide hide-super show show-super)) ) + +(define-skeleton custom-instances + "" + nil + '(setq v1 (skeleton-read "class:")) + '(setq v2 (custom-instances-list v1)) + > (format "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" (nth 0 v2) (nth 1 v2) (nth 2 v2) (nth 3 v2) (nth 4 v2) (nth 5 v2) (nth 6 v2) (nth 7 v2) (nth 8 v2) (nth 9 v2)) + ) + +(define-skeleton custom-datatype + "" + nil + > (format "%s" "(Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper") + ) + +(define-skeleton imports + "" + nil + > (format "%s" "import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget +")) diff --git a/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs b/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs index 833bc21f..6f3c67fd 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Adjuster.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Adjuster ( -- * Constructor adjusterNew, + adjusterCustom, -- * Hierarchy -- -- $hierarchy @@ -22,6 +23,26 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenAdjuster_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenAdjuster_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +adjusterCustom :: + Rectangle -- ^ The bounds of this Adjuster + -> Maybe T.Text -- ^ The Adjuster label + -> Maybe (Ref Adjuster -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Adjuster) -- ^ Optional custom widget functions + -> IO (Ref Adjuster) +adjusterCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Adjuster_New as adjusterNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Adjuster_New_WithLabel as adjusterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -48,6 +69,41 @@ instance (impl ~ ( IO (Int))) => Op (GetSoft ()) Adjuster orig impl where instance (impl ~ (Int -> IO ())) => Op (SetSoft ()) Adjuster orig impl where runOp _ _ adjuster soft = withRef adjuster $ \adjusterPtr -> setSoft' adjusterPtr soft +{# fun Fl_Adjuster_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Adjuster orig impl where + runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> draw'' adjusterPtr +{# fun Fl_Adjuster_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Adjuster orig impl where + runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> drawSuper' adjusterPtr +{#fun Fl_Adjuster_handle as adjusterHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Adjuster orig impl where + runOp _ _ adjuster event = withRef adjuster (\p -> adjusterHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Adjuster_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Adjuster orig impl where + runOp _ _ adjuster event = withRef adjuster $ \adjusterPtr -> handleSuper' adjusterPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Adjuster_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Adjuster orig impl where + runOp _ _ adjuster rectangle = withRef adjuster $ \adjusterPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' adjusterPtr x_pos y_pos w_pos h_pos +{# fun Fl_Adjuster_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Adjuster orig impl where + runOp _ _ adjuster rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef adjuster $ \adjusterPtr -> resizeSuper' adjusterPtr x_pos y_pos width height +{# fun Fl_Adjuster_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Adjuster orig impl where + runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> hide' adjusterPtr +{# fun Fl_Adjuster_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Adjuster orig impl where + runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> hideSuper' adjusterPtr +{# fun Fl_Adjuster_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Adjuster orig impl where + runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> show' adjusterPtr +{# fun Fl_Adjuster_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Adjuster orig impl where + runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> showSuper' adjusterPtr + -- $hierarchy -- @ -- "Graphics.UI.FLTK.LowLevel.Widget" @@ -64,7 +120,27 @@ instance (impl ~ (Int -> IO ())) => Op (SetSoft ()) Adjuster orig impl where -- @ -- destroy :: 'Ref' 'Adjuster' -> 'IO' () -- --- getSoft :: 'Ref' 'Adjuster' -> 'IO' 'Int' +-- draw :: 'Ref' 'Adjuster' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Adjuster' -> 'IO' () +-- +-- getSoft :: 'Ref' 'Adjuster' -> 'IO' ('Int') +-- +-- handle :: 'Ref' 'Adjuster' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Adjuster' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Adjuster' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Adjuster' -> 'IO' () +-- +-- resize :: 'Ref' 'Adjuster' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Adjuster' -> 'Rectangle' -> 'IO' () -- -- setSoft :: 'Ref' 'Adjuster' -> 'Int' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Adjuster' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Adjuster' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs b/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs index 7e6d933c..f36abcba 100644 --- a/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs +++ b/src/Graphics/UI/FLTK/LowLevel/CheckButton.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.CheckButton ( - checkButtonNew + checkButtonNew, + checkButtonCustom, -- * Hierarchy -- -- $hierarchy @@ -21,6 +22,26 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenCheck_Button_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenCheck_Button_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +checkButtonCustom :: + Rectangle -- ^ The bounds of this CheckButton + -> Maybe T.Text -- ^ The CheckButton label + -> Maybe (Ref CheckButton -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs CheckButton) -- ^ Optional custom widget functions + -> IO (Ref CheckButton) +checkButtonCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Check_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Check_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -37,11 +58,66 @@ instance (impl ~ ( IO ())) => Op (Destroy ()) CheckButton orig impl where \buttonPtr -> widgetDestroy' buttonPtr >> return nullPtr +{# fun Fl_Check_Button_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) CheckButton orig impl where + runOp _ _ checkButton = withRef checkButton $ \checkButtonPtr -> draw'' checkButtonPtr +{# fun Fl_Check_Button_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) CheckButton orig impl where + runOp _ _ checkButton = withRef checkButton $ \checkButtonPtr -> drawSuper' checkButtonPtr +{#fun Fl_Check_Button_handle as checkButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) CheckButton orig impl where + runOp _ _ checkButton event = withRef checkButton (\p -> checkButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Check_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) CheckButton orig impl where + runOp _ _ checkButton event = withRef checkButton $ \checkButtonPtr -> handleSuper' checkButtonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Check_Button_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) CheckButton orig impl where + runOp _ _ checkButton rectangle = withRef checkButton $ \checkButtonPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' checkButtonPtr x_pos y_pos w_pos h_pos +{# fun Fl_Check_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) CheckButton orig impl where + runOp _ _ checkButton rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef checkButton $ \checkButtonPtr -> resizeSuper' checkButtonPtr x_pos y_pos width height +{# fun Fl_Check_Button_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) CheckButton orig impl where + runOp _ _ checkButton = withRef checkButton $ \checkButtonPtr -> hide' checkButtonPtr +{# fun Fl_Check_Button_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) CheckButton orig impl where + runOp _ _ checkButton = withRef checkButton $ \checkButtonPtr -> hideSuper' checkButtonPtr +{# fun Fl_Check_Button_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) CheckButton orig impl where + runOp _ _ checkButton = withRef checkButton $ \checkButtonPtr -> show' checkButtonPtr +{# fun Fl_Check_Button_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) CheckButton orig impl where + runOp _ _ checkButton = withRef checkButton $ \checkButtonPtr -> showSuper' checkButtonPtr -- $CheckButtonfunctions -- -- @ -- destroy :: 'Ref' 'CheckButton' -> 'IO' () +-- +-- draw :: 'Ref' 'CheckButton' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'CheckButton' -> 'IO' () +-- +-- handle :: 'Ref' 'CheckButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'CheckButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'CheckButton' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'CheckButton' -> 'IO' () +-- +-- resize :: 'Ref' 'CheckButton' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'CheckButton' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'CheckButton' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'CheckButton' -> 'IO' () +-- @ -- $hierarchy -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Choice.chs b/src/Graphics/UI/FLTK/LowLevel/Choice.chs index a6075ae7..1943d0df 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Choice.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Choice.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.Choice ( -- * Constructor - choiceNew + choiceNew, + choiceCustom -- * Hierarchy -- -- $hierarchy @@ -25,6 +26,25 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Graphics.UI.FLTK.LowLevel.Hierarchy +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenChoice_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenChoice_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +choiceCustom :: + Rectangle -- ^ The bounds of this Choice + -> Maybe T.Text -- ^ The Choice label + -> Maybe (Ref Choice -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Choice) -- ^ Optional custom widget functions + -> IO (Ref Choice) +choiceCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Choice_New as choiceNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Choice_New_WithLabel as choiceNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -58,17 +78,66 @@ instance (impl ~ (MenuItemReference -> IO (Int))) => Op (SetValue ()) Choice ori {#fun Fl_Choice_handle as menu_Handle' { id `Ptr ()', id `CInt' } -> `Int' #} instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Choice orig impl where runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Choice_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Choice orig impl where + runOp _ _ choice = withRef choice $ \choicePtr -> draw'' choicePtr +{# fun Fl_Choice_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Choice orig impl where + runOp _ _ choice = withRef choice $ \choicePtr -> drawSuper' choicePtr +{# fun Fl_Choice_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Choice orig impl where + runOp _ _ choice event = withRef choice $ \choicePtr -> handleSuper' choicePtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Choice_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Choice orig impl where + runOp _ _ choice rectangle = withRef choice $ \choicePtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' choicePtr x_pos y_pos w_pos h_pos +{# fun Fl_Choice_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Choice orig impl where + runOp _ _ choice rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef choice $ \choicePtr -> resizeSuper' choicePtr x_pos y_pos width height +{# fun Fl_Choice_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Choice orig impl where + runOp _ _ choice = withRef choice $ \choicePtr -> hide' choicePtr +{# fun Fl_Choice_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Choice orig impl where + runOp _ _ choice = withRef choice $ \choicePtr -> hideSuper' choicePtr +{# fun Fl_Choice_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Choice orig impl where + runOp _ _ choice = withRef choice $ \choicePtr -> show' choicePtr +{# fun Fl_Choice_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Choice orig impl where + runOp _ _ choice = withRef choice $ \choicePtr -> showSuper' choicePtr -- $Choicefunctions -- -- @ -- destroy :: 'Ref' 'Choice' -> 'IO' () -- +-- draw :: 'Ref' 'Choice' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Choice' -> 'IO' () +-- -- getValue :: 'Ref' 'Choice' -> 'IO' ('MenuItemIndex') -- -- handle :: 'Ref' 'Choice' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- +-- handleSuper :: 'Ref' 'Choice' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Choice' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Choice' -> 'IO' () +-- +-- resize :: 'Ref' 'Choice' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Choice' -> 'Rectangle' -> 'IO' () +-- -- setValue :: 'Ref' 'Choice' -> 'MenuItemReference' -> 'IO' ('Int') +-- +-- showWidget :: 'Ref' 'Choice' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Choice' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Clock.chs b/src/Graphics/UI/FLTK/LowLevel/Clock.chs index 64887727..38b2b05c 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Clock.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Clock.chs @@ -5,6 +5,7 @@ module Graphics.UI.FLTK.LowLevel.Clock ClockType(..), clockNew, clockNewWithType, + clockCustom, Hour(..), Minute(..), Second(..), @@ -31,6 +32,8 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Data.Char +import Graphics.UI.FLTK.LowLevel.Widget + #c enum ClockType { SquareClock = FL_SQUARE_CLOCK, @@ -46,6 +49,26 @@ newtype Second = Second Int data ClockByTime = ClockByTime Hour Minute Second data ClockSinceEpoch = ClockSinceEpoch Second data ClockSetTimeType = ClockSetByTime ClockByTime | ClockSetSinceEpoch ClockSinceEpoch + +{# fun Fl_OverriddenClock_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenClock_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +clockCustom :: + Rectangle -- ^ The bounds of this Clock + -> Maybe T.Text -- ^ The Clock label + -> Maybe (Ref Clock -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Clock) -- ^ Optional custom widget functions + -> IO (Ref Clock) +clockCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + + {# fun Fl_Clock_New as clockNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Clock_New_WithLabel as clockNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} {# fun Fl_Clock_New_WithClockType as clockNewWithClockType' { id `CUChar', `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -86,10 +109,6 @@ instance (impl ~ (IO ClockByTime)) => Op (GetValue ()) Clock orig impl where second' <- clockSecond' clockPtr return $ ClockByTime (Hour hour') (Minute minute') (Second second') -{#fun Fl_Clock_handle as menu_Handle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Clock orig impl where - runOp _ _ menu_ event = withRef menu_ (\p -> menu_Handle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent - {# fun Fl_Clock_set_type as setType' { id `Ptr ()',`Word8' } -> `()' #} instance (impl ~ (ClockType -> IO ())) => Op (SetType ()) Clock orig impl where runOp _ _ clock type'' = withRef clock $ \clockPtr -> setType' clockPtr (fromIntegral (fromEnum type'')) @@ -97,6 +116,40 @@ instance (impl ~ (ClockType -> IO ())) => Op (SetType ()) Clock orig impl where {# fun Fl_Clock_type as type' { id `Ptr ()' } -> `Word8' #} instance (impl ~ ( IO (ClockType))) => Op (GetType_ ()) Clock orig impl where runOp _ _ clock = withRef clock $ \clockPtr -> type' clockPtr >>= return . toEnum . fromIntegral +{# fun Fl_Clock_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Clock orig impl where + runOp _ _ clock = withRef clock $ \clockPtr -> draw'' clockPtr +{# fun Fl_Clock_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Clock orig impl where + runOp _ _ clock = withRef clock $ \clockPtr -> drawSuper' clockPtr +{#fun Fl_Clock_handle as clockHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Clock orig impl where + runOp _ _ clock event = withRef clock (\p -> clockHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Clock_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Clock orig impl where + runOp _ _ clock event = withRef clock $ \clockPtr -> handleSuper' clockPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Clock_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Clock orig impl where + runOp _ _ clock rectangle = withRef clock $ \clockPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' clockPtr x_pos y_pos w_pos h_pos +{# fun Fl_Clock_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Clock orig impl where + runOp _ _ clock rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef clock $ \clockPtr -> resizeSuper' clockPtr x_pos y_pos width height +{# fun Fl_Clock_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Clock orig impl where + runOp _ _ clock = withRef clock $ \clockPtr -> hide' clockPtr +{# fun Fl_Clock_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Clock orig impl where + runOp _ _ clock = withRef clock $ \clockPtr -> hideSuper' clockPtr +{# fun Fl_Clock_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Clock orig impl where + runOp _ _ clock = withRef clock $ \clockPtr -> show' clockPtr +{# fun Fl_Clock_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Clock orig impl where + runOp _ _ clock = withRef clock $ \clockPtr -> showSuper' clockPtr -- $Clockfunctions -- @@ -109,6 +162,26 @@ instance (impl ~ ( IO (ClockType))) => Op (GetType_ ()) Clock orig impl where -- handle :: 'Ref' 'Clock' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) -- -- setValue :: 'Ref' 'Clock' -> 'ClockSetTimeType' -> 'IO' () +-- +-- draw :: 'Ref' 'Clock' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Clock' -> 'IO' () +-- +-- handle :: 'Ref' 'Clock' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Clock' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Clock' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Clock' -> 'IO' () +-- +-- resize :: 'Ref' 'Clock' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Clock' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Clock' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Clock' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs b/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs index 27b1a040..86b7bf3c 100644 --- a/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs +++ b/src/Graphics/UI/FLTK/LowLevel/ColorChooser.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.ColorChooser ( -- * Constructor colorChooserNew, + colorChooserCustom, rgb2Hsv, hsv2Rgb, flcColorChooser @@ -20,6 +21,7 @@ where #include "Fl_Types.h" #include "Fl_Color_ChooserC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -27,6 +29,25 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Data.List +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations + +{# fun Fl_OverriddenColor_Chooser_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenColor_Chooser_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +colorChooserCustom :: + Rectangle -- ^ The bounds of this ColorChooser + -> Maybe T.Text -- ^ The ColorChooser label + -> Maybe (Ref ColorChooser -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs ColorChooser) -- ^ Optional custom widget functions + -> IO (Ref ColorChooser) +colorChooserCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Color_Chooser_New as colorchooserNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Color_Chooser_New_WithLabel as colorchooserNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -110,6 +131,42 @@ instance (impl ~ ((Between0And1, Between0And1, Between0And1) -> IO (Either NoCh ret <- rgb' color_chooserPtr r'' g'' b'' if (ret == 0) then return (Left NoChange) else return (Right ()) +{# fun Fl_Color_Chooser_draw as draw' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) ColorChooser orig impl where + runOp _ _ colorChooser = withRef colorChooser $ \colorChooserPtr -> draw' colorChooserPtr +{# fun Fl_Color_Chooser_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) ColorChooser orig impl where + runOp _ _ colorChooser = withRef colorChooser $ \colorChooserPtr -> drawSuper' colorChooserPtr +{#fun Fl_Color_Chooser_handle as colorChooserHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ColorChooser orig impl where + runOp _ _ colorChooser event = withRef colorChooser (\p -> colorChooserHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Color_Chooser_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) ColorChooser orig impl where + runOp _ _ colorChooser event = withRef colorChooser $ \colorChooserPtr -> handleSuper' colorChooserPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Color_Chooser_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ColorChooser orig impl where + runOp _ _ colorChooser rectangle = withRef colorChooser $ \colorChooserPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' colorChooserPtr x_pos y_pos w_pos h_pos +{# fun Fl_Color_Chooser_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) ColorChooser orig impl where + runOp _ _ colorChooser rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef colorChooser $ \colorChooserPtr -> resizeSuper' colorChooserPtr x_pos y_pos width height +{# fun Fl_Color_Chooser_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) ColorChooser orig impl where + runOp _ _ colorChooser = withRef colorChooser $ \colorChooserPtr -> hide' colorChooserPtr +{# fun Fl_Color_Chooser_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) ColorChooser orig impl where + runOp _ _ colorChooser = withRef colorChooser $ \colorChooserPtr -> hideSuper' colorChooserPtr +{# fun Fl_Color_Chooser_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) ColorChooser orig impl where + runOp _ _ colorChooser = withRef colorChooser $ \colorChooserPtr -> show' colorChooserPtr +{# fun Fl_Color_Chooser_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) ColorChooser orig impl where + runOp _ _ colorChooser = withRef colorChooser $ \colorChooserPtr -> showSuper' colorChooserPtr + + {# fun Fl_Color_Chooser_hsv2rgb as hsv2rgb' {`Double',`Double',`Double', id `Ptr CDouble', id `Ptr CDouble',id `Ptr CDouble' } -> `()' #} hsv2Rgb :: (Between0And6, Between0And1, Between0And1) -> IO (Maybe (Between0And1, Between0And1, Between0And1)) hsv2Rgb (Between0And6 h'', Between0And1 s'', Between0And1 v'') = @@ -195,6 +252,10 @@ flcColorChooser name (Words (r,g,b)) mode = -- $functions -- @ +-- draw :: 'Ref' 'ColorChooser' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'ColorChooser' -> 'IO' () +-- -- getB :: 'Ref' 'ColorChooser' -> 'IO' ('Either' 'OutOfRange' 'Between0And1') -- -- getG :: 'Ref' 'ColorChooser' -> 'IO' ('Either' 'OutOfRange' 'Between0And1') @@ -209,10 +270,26 @@ flcColorChooser name (Words (r,g,b)) mode = -- -- getValue :: 'Ref' 'ColorChooser' -> 'IO' ('Either' 'OutOfRange' 'Between0And1') -- +-- handle :: 'Ref' 'ColorChooser' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'ColorChooser' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'ColorChooser' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'ColorChooser' -> 'IO' () +-- +-- resize :: 'Ref' 'ColorChooser' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'ColorChooser' -> 'Rectangle' -> 'IO' () +-- -- setHsv :: 'Ref' 'ColorChooser' -> ('Between0And6', 'Between0And1', 'Between0And1') -> 'IO' ('Either' 'NoChange' ()) -- -- setMode :: 'Ref' 'ColorChooser' -> 'ColorChooserMode' -> 'IO' () -- -- setRgb :: 'Ref' 'ColorChooser' -> ('Between0And1', 'Between0And1', 'Between0And1') -> 'IO' ('Either' 'NoChange' ()) --- @ -- +-- showWidget :: 'Ref' 'ColorChooser' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'ColorChooser' -> 'IO' () +-- +-- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Counter.chs b/src/Graphics/UI/FLTK/LowLevel/Counter.chs index b6da86db..a03e50dc 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Counter.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Counter.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Counter ( -- * Constructor counterNew, + counterCustom, CounterType(..) -- * Hierarchy -- @@ -26,6 +27,8 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget + #c enum CounterType { NormalCounterType = FL_NORMAL_COUNTERC, @@ -33,6 +36,25 @@ enum CounterType { }; #endc {#enum CounterType {} deriving (Show, Eq) #} + +{# fun Fl_OverriddenCounter_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenCounter_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +counterCustom :: + Rectangle -- ^ The bounds of this Counter + -> Maybe T.Text -- ^ The Counter label + -> Maybe (Ref Counter -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Counter) -- ^ Optional custom widget functions + -> IO (Ref Counter) +counterCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Counter_New as counterNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Counter_New_WithLabel as counterNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} counterNew :: Rectangle -> Maybe T.Text -> IO (Ref Counter) @@ -50,9 +72,6 @@ instance (impl ~ (IO ())) => Op (Destroy ()) Counter orig impl where counterDestroy' winPtr return nullPtr -{#fun Fl_Counter_handle as counterHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Counter orig impl where - runOp _ _ counter event = withRef counter (\p -> counterHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Counter_lstep as lstep' { id `Ptr ()',`Double' } -> `()' #} instance (impl ~ (Double -> IO ())) => Op (SetLstep ()) Counter orig impl where runOp _ _ counter lstep = withRef counter $ \counterPtr -> lstep' counterPtr lstep @@ -80,19 +99,69 @@ instance (impl ~ (CounterType -> IO ())) => Op (SetType ()) Counter orig impl w {# fun Fl_Widget_type as type' { id `Ptr ()' } -> `Word8' #} instance (impl ~ IO (CounterType)) => Op (GetType_ ()) Counter orig impl where runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger +{# fun Fl_Counter_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Counter orig impl where + runOp _ _ counter = withRef counter $ \counterPtr -> draw'' counterPtr +{# fun Fl_Counter_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Counter orig impl where + runOp _ _ counter = withRef counter $ \counterPtr -> drawSuper' counterPtr +{#fun Fl_Counter_handle as counterHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Counter orig impl where + runOp _ _ counter event = withRef counter (\p -> counterHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Counter_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Counter orig impl where + runOp _ _ counter event = withRef counter $ \counterPtr -> handleSuper' counterPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Counter_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Counter orig impl where + runOp _ _ counter rectangle = withRef counter $ \counterPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' counterPtr x_pos y_pos w_pos h_pos +{# fun Fl_Counter_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Counter orig impl where + runOp _ _ counter rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef counter $ \counterPtr -> resizeSuper' counterPtr x_pos y_pos width height +{# fun Fl_Counter_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Counter orig impl where + runOp _ _ counter = withRef counter $ \counterPtr -> hide' counterPtr +{# fun Fl_Counter_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Counter orig impl where + runOp _ _ counter = withRef counter $ \counterPtr -> hideSuper' counterPtr +{# fun Fl_Counter_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Counter orig impl where + runOp _ _ counter = withRef counter $ \counterPtr -> show' counterPtr +{# fun Fl_Counter_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Counter orig impl where + runOp _ _ counter = withRef counter $ \counterPtr -> showSuper' counterPtr -- $Counterfunctions -- -- @ -- destroy :: 'Ref' 'Counter' -> 'IO' () -- --- getTextcolor :: 'Ref' 'Counter' -> 'IO' 'Color' +-- draw :: 'Ref' 'Counter' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Counter' -> 'IO' () -- --- getTextfont :: 'Ref' 'Counter' -> 'IO' 'Font' +-- getTextcolor :: 'Ref' 'Counter' -> 'IO' ('Color') -- --- getTextsize :: 'Ref' 'Counter' -> 'IO' 'FontSize' +-- getTextfont :: 'Ref' 'Counter' -> 'IO' ('Font') -- --- handle :: 'Ref' 'Counter' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- getTextsize :: 'Ref' 'Counter' -> 'IO' ('FontSize') +-- +-- getType_ :: 'Ref' 'Counter' -> 'IO' ('CounterType') +-- +-- handle :: 'Ref' 'Counter' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Counter' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Counter' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Counter' -> 'IO' () +-- +-- resize :: 'Ref' 'Counter' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Counter' -> 'Rectangle' -> 'IO' () -- -- setLstep :: 'Ref' 'Counter' -> 'Double' -> 'IO' () -- @@ -102,6 +171,12 @@ instance (impl ~ IO (CounterType)) => Op (GetType_ ()) Counter orig impl where -- -- setTextsize :: 'Ref' 'Counter' -> 'FontSize' -> 'IO' () -- +-- setType :: 'Ref' 'Counter' -> 'CounterType' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Counter' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Counter' -> 'IO' () +-- -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Dial.chs b/src/Graphics/UI/FLTK/LowLevel/Dial.chs index 91f593f2..97c839bc 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Dial.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Dial.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Dial ( -- * Constructor dialNew, + dialCustom, DialType(..) -- * Hierarchy -- @@ -25,6 +26,8 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget + #c enum DialType { NormalDialType = FL_NORMAL_DIALC, @@ -33,6 +36,24 @@ enum DialType { }; #endc {#enum DialType {} deriving (Show, Eq) #} + +{# fun Fl_OverriddenDial_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenDial_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +dialCustom :: + Rectangle -- ^ The bounds of this Dial + -> Maybe T.Text -- ^ The Dial label + -> Maybe (Ref Dial -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Dial) -- ^ Optional custom widget functions + -> IO (Ref Dial) +dialCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Dial_New as dialNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Dial_New_WithLabel as dialNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} dialNew :: Rectangle -> Maybe T.Text -> IO (Ref Dial) @@ -62,9 +83,6 @@ instance (impl ~ ( IO (Angle))) => Op (GetAngle1 ()) Dial orig impl where {# fun Fl_Dial_angle2 as angle2' { id `Ptr ()' } -> `CShort' id #} instance (impl ~ ( IO (Angle))) => Op (GetAngle2 ()) Dial orig impl where runOp _ _ dial = withRef dial $ \dialPtr -> angle2' dialPtr >>= return . Angle -{#fun Fl_Dial_handle as dialHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Dial orig impl where - runOp _ _ dial event = withRef dial (\p -> dialHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent instance (impl ~ ( Angle -> Angle -> IO ())) => Op (SetAngles ()) Dial orig impl where runOp _ _ dial a1' a2' = do setAngle1 dial a1' @@ -75,23 +93,79 @@ instance (impl ~ (DialType -> IO ())) => Op (SetType ()) Dial orig impl where {# fun Fl_Widget_type as type' { id `Ptr ()' } -> `Word8' #} instance (impl ~ IO (DialType)) => Op (GetType_ ()) Dial orig impl where runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger +{# fun Fl_Dial_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Dial orig impl where + runOp _ _ dial = withRef dial $ \dialPtr -> draw'' dialPtr +{# fun Fl_Dial_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Dial orig impl where + runOp _ _ dial = withRef dial $ \dialPtr -> drawSuper' dialPtr +{#fun Fl_Dial_handle as dialHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Dial orig impl where + runOp _ _ dial event = withRef dial (\p -> dialHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Dial_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Dial orig impl where + runOp _ _ dial event = withRef dial $ \dialPtr -> handleSuper' dialPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Dial_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Dial orig impl where + runOp _ _ dial rectangle = withRef dial $ \dialPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' dialPtr x_pos y_pos w_pos h_pos +{# fun Fl_Dial_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Dial orig impl where + runOp _ _ dial rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef dial $ \dialPtr -> resizeSuper' dialPtr x_pos y_pos width height +{# fun Fl_Dial_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Dial orig impl where + runOp _ _ dial = withRef dial $ \dialPtr -> hide' dialPtr +{# fun Fl_Dial_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Dial orig impl where + runOp _ _ dial = withRef dial $ \dialPtr -> hideSuper' dialPtr +{# fun Fl_Dial_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Dial orig impl where + runOp _ _ dial = withRef dial $ \dialPtr -> show' dialPtr +{# fun Fl_Dial_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Dial orig impl where + runOp _ _ dial = withRef dial $ \dialPtr -> showSuper' dialPtr -- $Dialfunctions -- -- @ -- destroy :: 'Ref' 'Dial' -> 'IO' () -- --- getAngle1 :: 'Ref' 'Dial' -> 'IO' 'Angle' +-- draw :: 'Ref' 'Dial' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Dial' -> 'IO' () -- --- getAngle2 :: 'Ref' 'Dial' -> 'IO' 'Angle' +-- getAngle1 :: 'Ref' 'Dial' -> 'IO' ('Angle') -- --- handle :: 'Ref' 'Dial' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- getAngle2 :: 'Ref' 'Dial' -> 'IO' ('Angle') +-- +-- getType_ :: 'Ref' 'Dial' -> 'IO' ('DialType') +-- +-- handle :: 'Ref' 'Dial' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Dial' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Dial' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Dial' -> 'IO' () +-- +-- resize :: 'Ref' 'Dial' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Dial' -> 'Rectangle' -> 'IO' () -- -- setAngle1 :: 'Ref' 'Dial' -> 'Angle' -> 'IO' () -- -- setAngle2 :: 'Ref' 'Dial' -> 'Angle' -> 'IO' () -- -- setAngles :: 'Ref' 'Dial' -> 'Angle' -> 'Angle' -> 'IO' () +-- +-- setType :: 'Ref' 'Dial' -> 'DialType' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Dial' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Dial' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs b/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs index 890e4bc6..a7ec6992 100644 --- a/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs +++ b/src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.FileBrowser ( -- * Constructor fileBrowserNew, + fileBrowserCustom, FileBrowserType(..), FileSortF, numericSort, @@ -32,7 +33,28 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget + {# pointer *Fl_File_Sort_F as FileSortF #} + +{# fun Fl_OverriddenFile_Browser_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenFile_Browser_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +fileBrowserCustom :: + Rectangle -- ^ The bounds of this FileBrowser + -> Maybe T.Text -- ^ The FileBrowser label + -> Maybe (Ref FileBrowser -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs FileBrowser) -- ^ Optional custom widget functions + -> IO (Ref FileBrowser) +fileBrowserCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_File_Browser_New as fileBrowserNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_File_Browser_New_WithLabel as fileBrowserNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} fileBrowserNew :: Rectangle -> Maybe T.Text -> IO (Ref FileBrowser) @@ -74,6 +96,42 @@ instance (impl ~ (T.Text -> FileSortF -> IO (Either UnknownError ()))) => Op (Lo status <- load' widgetPtr dir sortF return (if (status == 0) then (Left UnknownError) else (Right ())) +{# fun Fl_File_Browser_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) FileBrowser orig impl where + runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> draw'' fileBrowserPtr +{# fun Fl_File_Browser_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) FileBrowser orig impl where + runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> drawSuper' fileBrowserPtr +{#fun Fl_File_Browser_handle as fileBrowserHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) FileBrowser orig impl where + runOp _ _ fileBrowser event = withRef fileBrowser (\p -> fileBrowserHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_File_Browser_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) FileBrowser orig impl where + runOp _ _ fileBrowser event = withRef fileBrowser $ \fileBrowserPtr -> handleSuper' fileBrowserPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_File_Browser_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) FileBrowser orig impl where + runOp _ _ fileBrowser rectangle = withRef fileBrowser $ \fileBrowserPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' fileBrowserPtr x_pos y_pos w_pos h_pos +{# fun Fl_File_Browser_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) FileBrowser orig impl where + runOp _ _ fileBrowser rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef fileBrowser $ \fileBrowserPtr -> resizeSuper' fileBrowserPtr x_pos y_pos width height +{# fun Fl_File_Browser_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) FileBrowser orig impl where + runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> hide' fileBrowserPtr +{# fun Fl_File_Browser_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) FileBrowser orig impl where + runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> hideSuper' fileBrowserPtr +{# fun Fl_File_Browser_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) FileBrowser orig impl where + runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> show' fileBrowserPtr +{# fun Fl_File_Browser_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) FileBrowser orig impl where + runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> showSuper' fileBrowserPtr + + {# fun fl_numericsort_reference as numericSort {} -> `FileSortF' #} {# fun fl_alphasort_reference as alphaSort {} -> `FileSortF' #} {# fun fl_casealphasort_reference as caseAlphaSort {} -> `FileSortF' #} @@ -95,6 +153,10 @@ instance (impl ~ (T.Text -> FileSortF -> IO (Either UnknownError ()))) => Op (Lo -- $FileBrowserFunctions -- @ +-- draw :: 'Ref' 'FileBrowser' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'FileBrowser' -> 'IO' () +-- -- getFiletype :: 'Ref' 'FileBrowser' -> 'IO' ('FileBrowserType') -- -- getFilter :: 'Ref' 'FileBrowser' -> 'IO' 'T.Text' @@ -103,8 +165,20 @@ instance (impl ~ (T.Text -> FileSortF -> IO (Either UnknownError ()))) => Op (Lo -- -- getTextsize :: 'Ref' 'FileBrowser' -> 'IO' ('FontSize') -- +-- handle :: 'Ref' 'FileBrowser' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'FileBrowser' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'FileBrowser' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'FileBrowser' -> 'IO' () +-- -- load :: 'Ref' 'FileBrowser' -> 'T.Text' -> 'FileSortF' -> 'IO' ('Either' 'UnknownError' ()) -- +-- resize :: 'Ref' 'FileBrowser' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'FileBrowser' -> 'Rectangle' -> 'IO' () +-- -- setFiletype :: 'Ref' 'FileBrowser' -> 'FileBrowserType' -> 'IO' () -- -- setFilter :: 'Ref' 'FileBrowser' -> 'T.Text' -> 'IO' () @@ -112,4 +186,8 @@ instance (impl ~ (T.Text -> FileSortF -> IO (Either UnknownError ()))) => Op (Lo -- setIconsize :: 'Ref' 'FileBrowser' -> 'CUChar' -> 'IO' () -- -- setTextsize :: 'Ref' 'FileBrowser' -> 'FontSize' -> 'IO' () +-- +-- showWidget :: 'Ref' 'FileBrowser' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'FileBrowser' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/FileInput.chs b/src/Graphics/UI/FLTK/LowLevel/FileInput.chs index abf91813..b25bc2ed 100644 --- a/src/Graphics/UI/FLTK/LowLevel/FileInput.chs +++ b/src/Graphics/UI/FLTK/LowLevel/FileInput.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.FileInput ( - fileInputNew + fileInputNew, + fileInputCustom -- * Hierarchy -- -- $hierarchy @@ -22,6 +23,25 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenFile_Input_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenFile_Input_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +fileInputCustom :: + Rectangle -- ^ The bounds of this FileInput + -> Maybe T.Text -- ^ The FileInput label + -> Maybe (Ref FileInput -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs FileInput) -- ^ Optional custom widget functions + -> IO (Ref FileInput) +fileInputCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_File_Input_New as fileInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_File_Input_New_WithLabel as fileInputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -52,7 +72,40 @@ instance (impl ~ (T.Text -> IO ())) => Op (SetValue ()) FileInput orig impl wher {# fun Fl_File_Input_value as getValue' { id `Ptr ()' } -> `T.Text' unsafeFromCString #} instance (impl ~ (IO T.Text)) => Op (GetValue ()) FileInput orig impl where runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> getValue' fileInputPtr - +{# fun Fl_File_Input_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) FileInput orig impl where + runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> draw'' fileInputPtr +{# fun Fl_File_Input_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) FileInput orig impl where + runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> drawSuper' fileInputPtr +{#fun Fl_File_Input_handle as fileInputHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) FileInput orig impl where + runOp _ _ fileInput event = withRef fileInput (\p -> fileInputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_File_Input_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) FileInput orig impl where + runOp _ _ fileInput event = withRef fileInput $ \fileInputPtr -> handleSuper' fileInputPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_File_Input_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) FileInput orig impl where + runOp _ _ fileInput rectangle = withRef fileInput $ \fileInputPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' fileInputPtr x_pos y_pos w_pos h_pos +{# fun Fl_File_Input_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) FileInput orig impl where + runOp _ _ fileInput rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef fileInput $ \fileInputPtr -> resizeSuper' fileInputPtr x_pos y_pos width height +{# fun Fl_File_Input_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) FileInput orig impl where + runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> hide' fileInputPtr +{# fun Fl_File_Input_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) FileInput orig impl where + runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> hideSuper' fileInputPtr +{# fun Fl_File_Input_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) FileInput orig impl where + runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> show' fileInputPtr +{# fun Fl_File_Input_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) FileInput orig impl where + runOp _ _ fileInput = withRef fileInput $ \fileInputPtr -> showSuper' fileInputPtr -- $hierarchy -- @ -- "Graphics.UI.FLTK.LowLevel.Widget" @@ -66,15 +119,35 @@ instance (impl ~ (IO T.Text)) => Op (GetValue ()) FileInput orig impl where -- $functions -- @ +-- draw :: 'Ref' 'FileInput' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'FileInput' -> 'IO' () +-- -- getDownBox :: 'Ref' 'FileInput' -> 'IO' ('Boxtype') -- -- getErrorColor :: 'Ref' 'FileInput' -> 'IO' ('Color') -- -- getValue :: 'Ref' 'FileInput' -> 'IO' 'T.Text' - -- +-- +-- handle :: 'Ref' 'FileInput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'FileInput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'FileInput' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'FileInput' -> 'IO' () +-- +-- resize :: 'Ref' 'FileInput' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'FileInput' -> 'Rectangle' -> 'IO' () +-- -- setDownBox :: 'Ref' 'FileInput' -> 'Boxtype' -> 'IO' () -- -- setErrorColor :: 'Ref' 'FileInput' -> 'Color' -> 'IO' () -- -- setValue :: 'Ref' 'FileInput' -> 'T.Text' -> 'IO' () +-- +-- showWidget :: 'Ref' 'FileInput' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'FileInput' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs b/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs index c5278e93..cee237b7 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs +++ b/src/Graphics/UI/FLTK/LowLevel/Hierarchy.hs @@ -2018,7 +2018,17 @@ MAKE_METHOD(SetDownColor,setDownColor) data CLightButton parent type LightButtonFuncs = - (Destroy ()) + (Destroy + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))) + type LightButton = CLightButton Button type instance Functions LightButton = LightButtonFuncs @@ -2030,7 +2040,15 @@ type instance Functions RadioLightButton = () data CCheckButton parent type CheckButtonFuncs = - (Destroy ()) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + (Destroy ()))))))))) type CheckButton = CCheckButton Button type instance Functions CheckButton = CheckButtonFuncs @@ -2039,14 +2057,31 @@ data CReturnButton parent type ReturnButton = CReturnButton Button type ReturnButtonFuncs = (Destroy - (Handle ())) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))) type instance Functions ReturnButton = ReturnButtonFuncs data CRoundButton parent type RoundButton = CRoundButton Button type RoundButtonFuncs = - (Destroy ()) + (Destroy + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))) type instance Functions RoundButton = RoundButtonFuncs @@ -2054,9 +2089,16 @@ data CRepeatButton parent type RepeatButton = CRepeatButton Button type RepeatButtonFuncs = (Destroy - (Handle (Deactivate - ()))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))) type instance Functions RepeatButton = RepeatButtonFuncs @@ -2117,7 +2159,6 @@ data CSlider parent type Slider = CSlider Valuator type SliderFuncs = (Destroy - (Handle (Bounds (Scrollvalue (SetSliderSize @@ -2125,7 +2166,16 @@ type SliderFuncs = (GetSlider (SetSlider (SetType - (GetType_ ())))))))))) + (GetType_ + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))) type instance Functions Slider = SliderFuncs @@ -2325,8 +2375,15 @@ data CMenuBar parent type MenuBar = CMenuBar MenuPrim type MenuBarFuncs = (Destroy + (Draw + (DrawSuper (Handle - ())) + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))) type instance Functions MenuBar = MenuBarFuncs @@ -2344,11 +2401,18 @@ type SysMenuBarFuncs = (SetMode (GetMode (SetShortcut - (Handle (Add (AddName (Insert - ()))))))))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))))))))))) type instance Functions SysMenuBar = SysMenuBarFuncs @@ -2359,7 +2423,14 @@ type ChoiceFuncs = (Handle (GetValue (SetValue - ())))) + (Draw + (DrawSuper + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))) type instance Functions Choice = ChoiceFuncs @@ -2368,9 +2439,16 @@ data CMenuButton parent type MenuButton = CMenuButton MenuPrim type MenuButtonFuncs = (Destroy + (Draw + (DrawSuper (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper (Popup - ()))) + ())))))))))) type instance Functions MenuButton = MenuButtonFuncs @@ -2484,7 +2562,15 @@ type AdjusterFuncs = (Destroy (SetSoft (GetSoft - ()))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))) type instance Functions Adjuster = AdjusterFuncs @@ -2496,14 +2582,22 @@ data CDial parent type Dial = CDial Valuator type DialFuncs = (Destroy - (GetAngle1 - (SetAngle1 - (GetAngle2 - (SetAngle2 - (SetAngles - (SetType - (GetType_ - ())))))))) + (GetAngle1 + (SetAngle1 + (GetAngle2 + (SetAngle2 + (SetAngles + (SetType + (GetType_ + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))))) type instance Functions Dial = DialFuncs @@ -2527,8 +2621,15 @@ data CRoller parent type Roller = CRoller Valuator type RollerFuncs = (Destroy + (Draw + (DrawSuper (Handle - ())) + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))) type instance Functions Roller = RollerFuncs @@ -2546,7 +2647,14 @@ type CounterFuncs = (GetTextcolor (SetType (GetType_ - ()))))))))))) + (Draw + (DrawSuper + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))))))) type instance Functions Counter = CounterFuncs @@ -2560,13 +2668,21 @@ type instance Functions SimpleCounter = () data CScrollbar parent type Scrollbar = CScrollbar Slider type ScrollbarFuncs = - (Destroy + (Destroy (SetScrollValue - (Handle (SetLinesize (GetLinesize (SetType - (GetType_ ()))))))) + (GetType_ + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))) type instance Functions Scrollbar = ScrollbarFuncs @@ -2578,14 +2694,21 @@ data CValueSlider parent type ValueSlider = CValueSlider Slider type ValueSliderFuncs = (Destroy - (Handle (GetTextfont (SetTextfont (GetTextsize (SetTextsize (GetTextcolor (SetTextcolor - ())))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))) type instance Functions ValueSlider = ValueSliderFuncs @@ -2598,7 +2721,6 @@ data CInput parent type Input = CInput Widget type InputFuncs = (Destroy - (Handle (SetType (SetValue (StaticValue @@ -2639,7 +2761,15 @@ type InputFuncs = (SetWrap (GetTabNav (SetTabNav - ())))))))))))))))))))))))))))))))))))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))))))))))))))))))))))))))))))))))) type instance Functions Input = InputFuncs @@ -2671,7 +2801,16 @@ MAKE_METHOD(SetTabNav,setTabNav) data COutput parent type Output = COutput Input type OutputFuncs = - (SetType ()) + (SetType + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))) type instance Functions Output = OutputFuncs @@ -2679,7 +2818,6 @@ data CValueInput parent type ValueInput = CValueInput Valuator type ValueInputFuncs = (Destroy - (Handle (GetSoft (SetSoft (GetShortcut @@ -2690,7 +2828,15 @@ type ValueInputFuncs = (GetTextsize (SetTextcolor (GetTextcolor - ())))))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))))) type instance Functions ValueInput = ValueInputFuncs @@ -2698,7 +2844,6 @@ data CValueOutput parent type ValueOutput = CValueOutput Valuator type ValueOutputFuncs = (Destroy - (Handle (GetSoft (SetSoft (SetTextfont @@ -2707,7 +2852,15 @@ type ValueOutputFuncs = (GetTextsize (SetTextcolor (GetTextcolor - ())))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))) type instance Functions ValueOutput = ValueOutputFuncs @@ -2715,14 +2868,21 @@ data CTimer parent type Timer = CTimer Widget type TimerFuncs = (Destroy - (Handle (GetDirection (SetDirection (GetValue (SetValue (GetSuspended (SetSuspended - ())))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))) type instance Functions Timer = TimerFuncs @@ -2751,7 +2911,15 @@ type ProgressFuncs = (GetMinimum (SetValue (GetValue - ()))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))) type instance Functions Progress = ProgressFuncs @@ -2759,7 +2927,6 @@ data CPositioner parent type Positioner = CPositioner Widget type PositionerFuncs = (Destroy - (Handle (SetXvalue (GetXvalue (SetYvalue @@ -2776,7 +2943,15 @@ type PositionerFuncs = (SetYbounds (SetXstep (SetYstep - ())))))))))))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))))))))))) type instance Functions Positioner = PositionerFuncs @@ -2805,7 +2980,15 @@ type WizardFuncs = (Prev (SetValue (GetValue - ()))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))) type instance Functions Wizard = WizardFuncs @@ -3147,7 +3330,14 @@ type ClockFuncs = (SetValue (SetType (GetType_ - ())))))) + (Draw + (DrawSuper + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))) type instance Functions Clock = ClockFuncs @@ -3389,8 +3579,6 @@ data CTree parent type Tree = CTree Group type TreeFuncs = (Destroy - (Handle - (Draw (ShowSelf (RootLabel (Root @@ -3498,7 +3686,15 @@ type TreeFuncs = (GetCallbackItem (SetCallbackReason (GetCallbackReason - ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) type instance Functions Tree = TreeFuncs @@ -3825,7 +4021,15 @@ type TextEditorFuncs = (GetInsertMode (GetDefaultKeyBindings (ReplaceKeyBindings - ()))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))) type instance Functions TextEditor = TextEditorFuncs @@ -3883,9 +4087,16 @@ data CTile parent type Tile = CTile Group type TileFuncs = (SetPosition + (Draw + (DrawSuper (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper (Resize - ()))) + ())))))))))) type instance Functions Tile = TileFuncs @@ -3897,7 +4108,15 @@ type PackFuncs = (SetSpacing (GetSpacing (IsHorizontal - ()))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))) type instance Functions Pack = PackFuncs @@ -3917,7 +4136,15 @@ type ScrolledFuncs = (GetType_ (SetType (Resize - (Handle ())))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))) type instance Functions Scrolled = ScrolledFuncs @@ -3928,14 +4155,20 @@ MAKE_METHOD(Yposition,yposition) data CTabs parent type Tabs = CTabs Group type TabsFuncs = + (Draw + (DrawSuper (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper (GetValue (SetValue (GetPush (SetPush (Which - (ClientArea ()))))))) - + (ClientArea ())))))))))))))) type instance Functions Tabs = TabsFuncs @@ -3947,7 +4180,6 @@ MAKE_METHOD(ClientArea,clientArea) data CSpinner parent type Spinner = CSpinner Group type SpinnerFuncs = - (Handle (GetValue (SetValue (Handle @@ -3968,7 +4200,15 @@ type SpinnerFuncs = (SetStep (GetStep (Resize - ()))))))))))))))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))))))))))))))))) type instance Functions Spinner = SpinnerFuncs @@ -3987,7 +4227,15 @@ type ColorChooserFuncs = (GetB (SetHsv (SetRgb - ())))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))))))) type instance Functions ColorChooser = ColorChooserFuncs @@ -4011,7 +4259,15 @@ type FileBrowserFuncs = (GetFiletype (SetFiletype (Load - ()))))))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ()))))))))))))))))) type instance Functions FileBrowser = FileBrowserFuncs MAKE_METHOD(SetIconsize, setIconsize) @@ -4076,7 +4332,15 @@ type FileInputFuncs = (GetErrorColor (GetValue (SetValue - ())))))) + (Draw + (DrawSuper + (Handle + (HandleSuper + (ShowWidget + (ShowWidgetSuper + (Hide + (HideSuper + ())))))))))))))) type instance Functions FileInput = FileInputFuncs MAKE_METHOD(SetErrorColor, setErrorColor) diff --git a/src/Graphics/UI/FLTK/LowLevel/Input.chs b/src/Graphics/UI/FLTK/LowLevel/Input.chs index f0d621b2..dddd62c4 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Input.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Input.chs @@ -4,7 +4,8 @@ module Graphics.UI.FLTK.LowLevel.Input ( FlInputType(..), -- * Constructor - inputNew + inputNew, + inputCustom -- * Hierarchy -- -- $hierarchy @@ -32,6 +33,8 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget + #c enum FlInputType { FlNormalInput = FL_NORMAL_INPUT, @@ -42,6 +45,23 @@ enum FlInputType { }; #endc {#enum FlInputType {}#} +{# fun Fl_OverriddenInput_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenInput_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +inputCustom :: + Rectangle -- ^ The bounds of this Input + -> Maybe T.Text -- ^ The Input label + -> Maybe (Ref Input -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Input) -- ^ Optional custom widget functions + -> IO (Ref Input) +inputCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Input_New as inputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Input_New_WithLabel as inputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} {# fun Fl_Multiline_Input_New as multilineInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} @@ -225,6 +245,38 @@ instance (impl ~ (Int -> IO ())) => Op (GetTabNav ()) Input orig impl where {# fun Fl_Input_set_tab_nav as setTabNav' { id `Ptr ()' } -> `Int' #} instance (impl ~ ( IO (Int))) => Op (SetTabNav ()) Input orig impl where runOp _ _ input = withRef input $ \inputPtr -> setTabNav' inputPtr +{# fun Fl_Input_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Input orig impl where + runOp _ _ input = withRef input $ \inputPtr -> draw'' inputPtr +{# fun Fl_Input_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Input orig impl where + runOp _ _ input = withRef input $ \inputPtr -> drawSuper' inputPtr +{# fun Fl_Input_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Input orig impl where + runOp _ _ input event = withRef input $ \inputPtr -> handleSuper' inputPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Input_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Input orig impl where + runOp _ _ input rectangle = withRef input $ \inputPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' inputPtr x_pos y_pos w_pos h_pos +{# fun Fl_Input_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Input orig impl where + runOp _ _ input rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef input $ \inputPtr -> resizeSuper' inputPtr x_pos y_pos width height +{# fun Fl_Input_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Input orig impl where + runOp _ _ input = withRef input $ \inputPtr -> hide' inputPtr +{# fun Fl_Input_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Input orig impl where + runOp _ _ input = withRef input $ \inputPtr -> hideSuper' inputPtr +{# fun Fl_Input_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Input orig impl where + runOp _ _ input = withRef input $ \inputPtr -> show' inputPtr +{# fun Fl_Input_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Input orig impl where + runOp _ _ input = withRef input $ \inputPtr -> showSuper' inputPtr + -- $Input -- @ @@ -240,6 +292,10 @@ instance (impl ~ ( IO (Int))) => Op (SetTabNav ()) Input orig impl where -- -- destroy :: 'Ref' 'Input' -> 'IO' () -- +-- draw :: 'Ref' 'Input' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Input' -> 'IO' () +-- -- getCursorColor :: 'Ref' 'Input' -> 'IO' ('Color') -- -- getInputType :: 'Ref' 'Input' -> 'IO' ('Int') @@ -268,7 +324,13 @@ instance (impl ~ ( IO (Int))) => Op (SetTabNav ()) Input orig impl where -- -- getWrap :: 'Ref' 'Input' -> 'IO' ('Int') -- --- handle :: 'Ref' 'Input' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handle :: 'Ref' 'Input' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Input' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Input' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Input' -> 'IO' () -- -- index :: 'Ref' 'Input' -> 'Int' -> 'IO' ('Char') -- @@ -278,6 +340,10 @@ instance (impl ~ ( IO (Int))) => Op (SetTabNav ()) Input orig impl where -- -- replace :: 'Ref' 'Input' -> 'Int' -> 'Int' -> 'T.Text' -> 'IO' ('Either' 'NoChange' ()) -- +-- resize :: 'Ref' 'Input' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Input' -> 'Rectangle' -> 'IO' () +-- -- setCursorColor :: 'Ref' 'Input' -> 'Color' -> 'IO' () -- -- setInputType :: 'Ref' 'Input' -> 'Int' -> 'IO' () @@ -308,6 +374,10 @@ instance (impl ~ ( IO (Int))) => Op (SetTabNav ()) Input orig impl where -- -- setWrap :: 'Ref' 'Input' -> 'Int' -> 'IO' () -- +-- showWidget :: 'Ref' 'Input' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Input' -> 'IO' () +-- -- staticValue :: 'Ref' 'Input' -> 'T.Text' -> 'Maybe' 'Int' -> 'IO' ('Either' 'NoChange' ()) -- -- undo :: 'Ref' 'Input' -> 'IO' ('Either' 'NoChange' ()) diff --git a/src/Graphics/UI/FLTK/LowLevel/LightButton.chs b/src/Graphics/UI/FLTK/LowLevel/LightButton.chs index 22609d22..d482e179 100644 --- a/src/Graphics/UI/FLTK/LowLevel/LightButton.chs +++ b/src/Graphics/UI/FLTK/LowLevel/LightButton.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.LightButton ( - lightButtonNew + lightButtonNew, + lightButtonCustom -- * Hierarchy -- -- $hierarchy @@ -22,6 +23,24 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget +{# fun Fl_OverriddenLight_Button_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenLight_Button_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +lightButtonCustom :: + Rectangle -- ^ The bounds of this LightButton + -> Maybe T.Text -- ^ The LightButton label + -> Maybe (Ref LightButton -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs LightButton) -- ^ Optional custom widget functions + -> IO (Ref LightButton) +lightButtonCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Light_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Light_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -38,10 +57,64 @@ instance (impl ~ (IO ())) => Op (Destroy ()) LightButton orig impl where \buttonPtr -> widgetDestroy' buttonPtr >> return nullPtr +{# fun Fl_Light_Button_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) LightButton orig impl where + runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> draw'' lightButtonPtr +{# fun Fl_Light_Button_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) LightButton orig impl where + runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> drawSuper' lightButtonPtr +{#fun Fl_Light_Button_handle as lightButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) LightButton orig impl where + runOp _ _ lightButton event = withRef lightButton (\p -> lightButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Light_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) LightButton orig impl where + runOp _ _ lightButton event = withRef lightButton $ \lightButtonPtr -> handleSuper' lightButtonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Light_Button_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) LightButton orig impl where + runOp _ _ lightButton rectangle = withRef lightButton $ \lightButtonPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' lightButtonPtr x_pos y_pos w_pos h_pos +{# fun Fl_Light_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) LightButton orig impl where + runOp _ _ lightButton rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef lightButton $ \lightButtonPtr -> resizeSuper' lightButtonPtr x_pos y_pos width height +{# fun Fl_Light_Button_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) LightButton orig impl where + runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> hide' lightButtonPtr +{# fun Fl_Light_Button_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) LightButton orig impl where + runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> hideSuper' lightButtonPtr +{# fun Fl_Light_Button_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) LightButton orig impl where + runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> show' lightButtonPtr +{# fun Fl_Light_Button_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) LightButton orig impl where + runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> showSuper' lightButtonPtr + -- $functions -- @ --- -- destroy :: 'Ref' 'LightButton' -> 'IO' () +-- +-- draw :: 'Ref' 'LightButton' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'LightButton' -> 'IO' () +-- +-- handle :: 'Ref' 'LightButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'LightButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'LightButton' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'LightButton' -> 'IO' () +-- +-- resize :: 'Ref' 'LightButton' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'LightButton' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'LightButton' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'LightButton' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs b/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs index ad0fe225..401e8b9c 100644 --- a/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs +++ b/src/Graphics/UI/FLTK/LowLevel/MenuBar.chs @@ -3,6 +3,7 @@ module Graphics.UI.FLTK.LowLevel.MenuBar ( menuBarNew, + menuBarCustom -- * Hierarchy -- -- $hierarchy @@ -16,13 +17,31 @@ where #include "Fl_Types.h" #include "Fl_Menu_BarC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - -import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Graphics.UI.FLTK.LowLevel.Hierarchy +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenMenu_Bar_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenMenu_Bar_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +menuBarCustom :: + Rectangle -- ^ The bounds of this MenuBar + -> Maybe T.Text -- ^ The MenuBar label + -> Maybe (Ref MenuBar -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs MenuBar) -- ^ Optional custom widget functions + -> IO (Ref MenuBar) +menuBarCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Menu_Bar_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Menu_Bar_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -41,10 +60,40 @@ instance (impl ~ (IO ())) => Op (Destroy ()) MenuBar orig impl where \menuBarPtr -> widgetDestroy' menuBarPtr >> return nullPtr +{# fun Fl_Menu_Bar_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) MenuBar orig impl where + runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> draw'' menuBarPtr +{# fun Fl_Menu_Bar_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) MenuBar orig impl where + runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> drawSuper' menuBarPtr {#fun Fl_Menu_Bar_handle as menuBarHandle' { id `Ptr ()', id `CInt' } -> `Int' #} instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuBar orig impl where runOp _ _ menuBar event = withRef menuBar (\p -> menuBarHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent - +{# fun Fl_Menu_Bar_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) MenuBar orig impl where + runOp _ _ menuBar event = withRef menuBar $ \menuBarPtr -> handleSuper' menuBarPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Menu_Bar_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) MenuBar orig impl where + runOp _ _ menuBar rectangle = withRef menuBar $ \menuBarPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' menuBarPtr x_pos y_pos w_pos h_pos +{# fun Fl_Menu_Bar_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) MenuBar orig impl where + runOp _ _ menuBar rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef menuBar $ \menuBarPtr -> resizeSuper' menuBarPtr x_pos y_pos width height +{# fun Fl_Menu_Bar_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) MenuBar orig impl where + runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> hide' menuBarPtr +{# fun Fl_Menu_Bar_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) MenuBar orig impl where + runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> hideSuper' menuBarPtr +{# fun Fl_Menu_Bar_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) MenuBar orig impl where + runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> show' menuBarPtr +{# fun Fl_Menu_Bar_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) MenuBar orig impl where + runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> showSuper' menuBarPtr -- $functions -- @@ -52,8 +101,25 @@ instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuB -- -- destroy :: 'Ref' 'MenuBar' -> 'IO' () -- --- handle :: 'Ref' 'MenuBar' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- draw :: 'Ref' 'MenuBar' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'MenuBar' -> 'IO' () +-- +-- handle :: 'Ref' 'MenuBar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'MenuBar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'MenuBar' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'MenuBar' -> 'IO' () +-- +-- resize :: 'Ref' 'MenuBar' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'MenuBar' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'MenuBar' -> 'IO' () -- +-- showWidgetSuper :: 'Ref' 'MenuBar' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs b/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs index 97cd7daf..a8750d1f 100644 --- a/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs +++ b/src/Graphics/UI/FLTK/LowLevel/MenuButton.chs @@ -4,7 +4,8 @@ module Graphics.UI.FLTK.LowLevel.MenuButton ( -- * Constructor menuButtonNew, - MenuButtonType(..) + MenuButtonType(..), + menuButtonCustom -- * Hierarchy -- -- $hierarchy @@ -25,6 +26,7 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Graphics.UI.FLTK.LowLevel.Hierarchy +import Graphics.UI.FLTK.LowLevel.Widget #c enum MenuButtonType { @@ -38,6 +40,23 @@ enum MenuButtonType { }; #endc {#enum MenuButtonType {} deriving (Show, Eq) #} +{# fun Fl_OverriddenMenu_Button_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenMenu_Button_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +menuButtonCustom :: + Rectangle -- ^ The bounds of this MenuButton + -> Maybe T.Text -- ^ The MenuButton label + -> Maybe (Ref MenuButton -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs MenuButton) -- ^ Optional custom widget functions + -> IO (Ref MenuButton) +menuButtonCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Menu_Button_New as menuButtonNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Menu_Button_New_WithLabel as menuButtonNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -55,22 +74,70 @@ instance (impl ~ ( IO ())) => Op (Destroy ()) MenuButton orig impl where runOp _ _ win = swapRef win $ \winPtr -> do menuButtonDestroy' winPtr return nullPtr -{#fun Fl_Menu_Button_handle as menuButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuButton orig impl where - runOp _ _ menu_bar event = withRef menu_bar (\p -> menuButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {#fun Fl_Menu_Button_popup as menuButtonPopup' { id `Ptr ()' } -> `Ptr ()' id #} instance (impl ~ ( IO (Maybe (Ref MenuItem)))) => Op (Popup ()) MenuButton orig impl where runOp _ _ menu_bar = withRef menu_bar (\p -> menuButtonPopup' p >>= toMaybeRef) +{# fun Fl_Menu_Button_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) MenuButton orig impl where + runOp _ _ menuButton = withRef menuButton $ \menuButtonPtr -> draw'' menuButtonPtr +{# fun Fl_Menu_Button_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) MenuButton orig impl where + runOp _ _ menuButton = withRef menuButton $ \menuButtonPtr -> drawSuper' menuButtonPtr +{#fun Fl_Menu_Button_handle as menuButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuButton orig impl where + runOp _ _ menuButton event = withRef menuButton (\p -> menuButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Menu_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) MenuButton orig impl where + runOp _ _ menuButton event = withRef menuButton $ \menuButtonPtr -> handleSuper' menuButtonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Menu_Button_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) MenuButton orig impl where + runOp _ _ menuButton rectangle = withRef menuButton $ \menuButtonPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' menuButtonPtr x_pos y_pos w_pos h_pos +{# fun Fl_Menu_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) MenuButton orig impl where + runOp _ _ menuButton rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef menuButton $ \menuButtonPtr -> resizeSuper' menuButtonPtr x_pos y_pos width height +{# fun Fl_Menu_Button_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) MenuButton orig impl where + runOp _ _ menuButton = withRef menuButton $ \menuButtonPtr -> hide' menuButtonPtr +{# fun Fl_Menu_Button_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) MenuButton orig impl where + runOp _ _ menuButton = withRef menuButton $ \menuButtonPtr -> hideSuper' menuButtonPtr +{# fun Fl_Menu_Button_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) MenuButton orig impl where + runOp _ _ menuButton = withRef menuButton $ \menuButtonPtr -> show' menuButtonPtr +{# fun Fl_Menu_Button_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) MenuButton orig impl where + runOp _ _ menuButton = withRef menuButton $ \menuButtonPtr -> showSuper' menuButtonPtr + -- $functions -- @ --- -- destroy :: 'Ref' 'MenuButton' -> 'IO' () -- --- handle :: 'Ref' 'MenuButton' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- draw :: 'Ref' 'MenuButton' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'MenuButton' -> 'IO' () +-- +-- handle :: 'Ref' 'MenuButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'MenuButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'MenuButton' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'MenuButton' -> 'IO' () -- -- popup :: 'Ref' 'MenuButton' -> 'IO' ('Maybe' ('Ref' 'MenuItem')) -- +-- resize :: 'Ref' 'MenuButton' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'MenuButton' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'MenuButton' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'MenuButton' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Output.chs b/src/Graphics/UI/FLTK/LowLevel/Output.chs index c00b9538..ea81efd7 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Output.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Output.chs @@ -4,7 +4,8 @@ module Graphics.UI.FLTK.LowLevel.Output ( FlOutputType(..), -- * Constructor - outputNew + outputNew, + outputCustom -- * Hierarchy -- -- $hierarchy @@ -26,12 +27,33 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations + #c enum FlOutputType { FlNormalOutput = FL_NORMAL_OUTPUT, FlMultilineOutput = FL_MULTILINE_OUTPUT }; #endc +{# fun Fl_OverriddenOutput_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenOutput_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +outputCustom :: + Rectangle -- ^ The bounds of this Output + -> Maybe T.Text -- ^ The Output label + -> Maybe (Ref Output -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Output) -- ^ Optional custom widget functions + -> IO (Ref Output) +outputCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {#enum FlOutputType {}#} {# fun Fl_Output_New as outputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Output_New_WithLabel as outputNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -50,6 +72,40 @@ outputNew rectangle l' flOutputType = {# fun Fl_Widget_set_type as setType' { id `Ptr ()',`Word8' } -> `()' supressWarningAboutRes #} instance (impl ~ (FlOutputType -> IO ())) => Op (SetType ()) Output orig impl where runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (fromInteger $ toInteger $ fromEnum t) +{# fun Fl_Output_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Output orig impl where + runOp _ _ output = withRef output $ \outputPtr -> draw'' outputPtr +{# fun Fl_Output_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Output orig impl where + runOp _ _ output = withRef output $ \outputPtr -> drawSuper' outputPtr +{#fun Fl_Output_handle as outputHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Output orig impl where + runOp _ _ output event = withRef output (\p -> outputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Output_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Output orig impl where + runOp _ _ output event = withRef output $ \outputPtr -> handleSuper' outputPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Output_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Output orig impl where + runOp _ _ output rectangle = withRef output $ \outputPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' outputPtr x_pos y_pos w_pos h_pos +{# fun Fl_Output_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Output orig impl where + runOp _ _ output rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef output $ \outputPtr -> resizeSuper' outputPtr x_pos y_pos width height +{# fun Fl_Output_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Output orig impl where + runOp _ _ output = withRef output $ \outputPtr -> hide' outputPtr +{# fun Fl_Output_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Output orig impl where + runOp _ _ output = withRef output $ \outputPtr -> hideSuper' outputPtr +{# fun Fl_Output_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Output orig impl where + runOp _ _ output = withRef output $ \outputPtr -> show' outputPtr +{# fun Fl_Output_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Output orig impl where + runOp _ _ output = withRef output $ \outputPtr -> showSuper' outputPtr -- $hierarchy -- @ @@ -64,5 +120,25 @@ instance (impl ~ (FlOutputType -> IO ())) => Op (SetType ()) Output orig impl w -- $Input -- @ +-- draw :: 'Ref' 'Output' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Output' -> 'IO' () +-- +-- handle :: 'Ref' 'Output' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Output' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Output' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Output' -> 'IO' () +-- +-- resize :: 'Ref' 'Output' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Output' -> 'Rectangle' -> 'IO' () +-- -- setType :: 'Ref' 'Output' -> 'FlOutputType' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Output' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Output' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Pack.chs b/src/Graphics/UI/FLTK/LowLevel/Pack.chs index 2376b99f..b235eed5 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Pack.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Pack.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Pack ( PackType(..), packNew, + packCustom -- * Hierarchy -- -- $hierarchy @@ -17,12 +18,29 @@ where #include "Fl_Types.h" #include "Fl_PackC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenPack_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenPack_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +packCustom :: + Rectangle -- ^ The bounds of this Pack + -> Maybe T.Text -- ^ The Pack label + -> Maybe (Ref Pack -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Pack) -- ^ Optional custom widget functions + -> IO (Ref Pack) +packCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Pack_New as packNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Pack_New_WithLabel as packNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -54,7 +72,40 @@ instance (impl ~ ( IO (PackType))) => Op (GetType_ ()) Pack orig impl where {# fun Fl_Pack_set_type as setType' { id `Ptr ()',`Word8' } -> `()' #} instance (impl ~ (PackType -> IO ())) => Op (SetType ()) Pack orig impl where runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (cFromEnum t) - +{# fun Fl_Pack_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Pack orig impl where + runOp _ _ pack = withRef pack $ \packPtr -> draw'' packPtr +{# fun Fl_Pack_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Pack orig impl where + runOp _ _ pack = withRef pack $ \packPtr -> drawSuper' packPtr +{#fun Fl_Pack_handle as packHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Pack orig impl where + runOp _ _ pack event = withRef pack (\p -> packHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Pack_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Pack orig impl where + runOp _ _ pack event = withRef pack $ \packPtr -> handleSuper' packPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Pack_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Pack orig impl where + runOp _ _ pack rectangle = withRef pack $ \packPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' packPtr x_pos y_pos w_pos h_pos +{# fun Fl_Pack_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Pack orig impl where + runOp _ _ pack rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef pack $ \packPtr -> resizeSuper' packPtr x_pos y_pos width height +{# fun Fl_Pack_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Pack orig impl where + runOp _ _ pack = withRef pack $ \packPtr -> hide' packPtr +{# fun Fl_Pack_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Pack orig impl where + runOp _ _ pack = withRef pack $ \packPtr -> hideSuper' packPtr +{# fun Fl_Pack_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Pack orig impl where + runOp _ _ pack = withRef pack $ \packPtr -> show' packPtr +{# fun Fl_Pack_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Pack orig impl where + runOp _ _ pack = withRef pack $ \packPtr -> showSuper' packPtr -- $hierarchy -- @ -- "Graphics.UI.FLTK.LowLevel.Widget" @@ -68,13 +119,33 @@ instance (impl ~ (PackType -> IO ())) => Op (SetType ()) Pack orig impl where -- $functions -- @ --- getSpacing :: 'Ref' 'Pack' -> 'IO' 'Int' +-- draw :: 'Ref' 'Pack' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Pack' -> 'IO' () +-- +-- getSpacing :: 'Ref' 'Pack' -> 'IO' ('Int') +-- +-- getType_ :: 'Ref' 'Pack' -> 'IO' ('PackType') +-- +-- handle :: 'Ref' 'Pack' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- getType :: 'Ref' 'Pack' -> 'IO' 'PackType' +-- handleSuper :: 'Ref' 'Pack' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Pack' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Pack' -> 'IO' () -- -- isHorizontal :: 'Ref' 'Pack' -> 'IO' 'Bool' -- +-- resize :: 'Ref' 'Pack' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Pack' -> 'Rectangle' -> 'IO' () +-- -- setSpacing :: 'Ref' 'Pack' -> 'Int' -> 'IO' () -- -- setType :: 'Ref' 'Pack' -> 'PackType' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Pack' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Pack' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Positioner.chs b/src/Graphics/UI/FLTK/LowLevel/Positioner.chs index d90b1591..eecc1611 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Positioner.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Positioner.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.Positioner ( -- * Constructor - positionerNew + positionerNew, + positionerCustom -- * Hierarchy -- -- $hierarchy @@ -17,7 +18,7 @@ where #include "Fl_Types.h" #include "Fl_PositionerC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -25,6 +26,24 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenPositioner_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenPositioner_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +positionerCustom :: + Rectangle -- ^ The bounds of this Positioner + -> Maybe T.Text -- ^ The Positioner label + -> Maybe (Ref Positioner -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Positioner) -- ^ Optional custom widget functions + -> IO (Ref Positioner) +positionerCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Positioner_New as positionerNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Positioner_New_WithLabel as positionerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} positionerNew :: Rectangle -> Maybe T.Text -> IO (Ref Positioner) @@ -42,9 +61,6 @@ instance (impl ~ (IO ())) => Op (Destroy ()) Positioner orig impl where positionerDestroy' winPtr return nullPtr -{#fun Fl_Positioner_handle as positionerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Positioner orig impl where - runOp _ _ positioner event = withRef positioner (\p -> positionerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Positioner_set_xvalue as setXvalue' { id `Ptr ()',`Double' } -> `()' #} instance (impl ~ (Double -> IO ())) => Op (SetXvalue ()) Positioner orig impl where runOp _ _ positioner xvalue = withRef positioner $ \positionerPtr -> setXvalue' positionerPtr xvalue @@ -93,25 +109,72 @@ instance (impl ~ (Double -> IO ())) => Op (SetXstep ()) Positioner orig impl wh {# fun Fl_Positioner_ystep as ystep' { id `Ptr ()',`Double' } -> `()' #} instance (impl ~ (Double -> IO ())) => Op (SetYstep ()) Positioner orig impl where runOp _ _ positioner ystep = withRef positioner $ \positionerPtr -> ystep' positionerPtr ystep +{# fun Fl_Positioner_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Positioner orig impl where + runOp _ _ positioner = withRef positioner $ \positionerPtr -> draw'' positionerPtr +{# fun Fl_Positioner_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Positioner orig impl where + runOp _ _ positioner = withRef positioner $ \positionerPtr -> drawSuper' positionerPtr +{#fun Fl_Positioner_handle as positionerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Positioner orig impl where + runOp _ _ positioner event = withRef positioner (\p -> positionerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Positioner_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Positioner orig impl where + runOp _ _ positioner event = withRef positioner $ \positionerPtr -> handleSuper' positionerPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Positioner_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Positioner orig impl where + runOp _ _ positioner rectangle = withRef positioner $ \positionerPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' positionerPtr x_pos y_pos w_pos h_pos +{# fun Fl_Positioner_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Positioner orig impl where + runOp _ _ positioner rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef positioner $ \positionerPtr -> resizeSuper' positionerPtr x_pos y_pos width height +{# fun Fl_Positioner_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Positioner orig impl where + runOp _ _ positioner = withRef positioner $ \positionerPtr -> hide' positionerPtr +{# fun Fl_Positioner_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Positioner orig impl where + runOp _ _ positioner = withRef positioner $ \positionerPtr -> hideSuper' positionerPtr +{# fun Fl_Positioner_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Positioner orig impl where + runOp _ _ positioner = withRef positioner $ \positionerPtr -> show' positionerPtr +{# fun Fl_Positioner_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Positioner orig impl where + runOp _ _ positioner = withRef positioner $ \positionerPtr -> showSuper' positionerPtr -- $functions -- @ --- -- destroy :: 'Ref' 'Positioner' -> 'IO' () -- --- getXmaximum :: 'Ref' 'Positioner' -> 'IO' 'Double' +-- draw :: 'Ref' 'Positioner' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Positioner' -> 'IO' () +-- +-- getXmaximum :: 'Ref' 'Positioner' -> 'IO' ('Double') +-- +-- getXminimum :: 'Ref' 'Positioner' -> 'IO' ('Double') +-- +-- getXvalue :: 'Ref' 'Positioner' -> 'IO' ('Double') -- --- getXminimum :: 'Ref' 'Positioner' -> 'IO' 'Double' +-- getYmaximum :: 'Ref' 'Positioner' -> 'IO' ('Double') -- --- getXvalue :: 'Ref' 'Positioner' -> 'IO' 'Double' +-- getYminimum :: 'Ref' 'Positioner' -> 'IO' ('Double') -- --- getYmaximum :: 'Ref' 'Positioner' -> 'IO' 'Double' +-- getYvalue :: 'Ref' 'Positioner' -> 'IO' ('Double') -- --- getYminimum :: 'Ref' 'Positioner' -> 'IO' 'Double' +-- handle :: 'Ref' 'Positioner' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- getYvalue :: 'Ref' 'Positioner' -> 'IO' 'Double' +-- handleSuper :: 'Ref' 'Positioner' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- handle :: 'Ref' 'Positioner' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- hide :: 'Ref' 'Positioner' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Positioner' -> 'IO' () +-- +-- resize :: 'Ref' 'Positioner' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Positioner' -> 'Rectangle' -> 'IO' () -- -- setXbounds :: 'Ref' 'Positioner' -> 'Double' -> 'Double' -> 'IO' () -- @@ -132,6 +195,10 @@ instance (impl ~ (Double -> IO ())) => Op (SetYstep ()) Positioner orig impl wh -- setYstep :: 'Ref' 'Positioner' -> 'Double' -> 'IO' () -- -- setYvalue :: 'Ref' 'Positioner' -> 'Double' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Positioner' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Positioner' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Progress.chs b/src/Graphics/UI/FLTK/LowLevel/Progress.chs index af5ffd58..23e796c1 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Progress.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Progress.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.Progress ( -- * Constructor - progressNew + progressNew, + progressCustom -- * Hierarchy -- -- $hierarchy @@ -23,6 +24,26 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenProgress_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenProgress_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +progressCustom :: + Rectangle -- ^ The bounds of this Progress + -> Maybe T.Text -- ^ The Progress label + -> Maybe (Ref Progress -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Progress) -- ^ Optional custom widget functions + -> IO (Ref Progress) +progressCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Progress_New as progressNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Progress_New_WithLabel as progressNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -58,23 +79,77 @@ instance (impl ~ (Float -> IO ())) => Op (SetValue ()) Progress orig impl where {# fun Fl_Progress_value as value' { id `Ptr ()' } -> `Float' #} instance (impl ~ ( IO (Float))) => Op (GetValue ()) Progress orig impl where runOp _ _ progress = withRef progress $ \progressPtr -> value' progressPtr +{# fun Fl_Progress_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Progress orig impl where + runOp _ _ progress = withRef progress $ \progressPtr -> draw'' progressPtr +{# fun Fl_Progress_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Progress orig impl where + runOp _ _ progress = withRef progress $ \progressPtr -> drawSuper' progressPtr +{#fun Fl_Progress_handle as progressHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Progress orig impl where + runOp _ _ progress event = withRef progress (\p -> progressHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Progress_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Progress orig impl where + runOp _ _ progress event = withRef progress $ \progressPtr -> handleSuper' progressPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Progress_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Progress orig impl where + runOp _ _ progress rectangle = withRef progress $ \progressPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' progressPtr x_pos y_pos w_pos h_pos +{# fun Fl_Progress_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Progress orig impl where + runOp _ _ progress rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef progress $ \progressPtr -> resizeSuper' progressPtr x_pos y_pos width height +{# fun Fl_Progress_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Progress orig impl where + runOp _ _ progress = withRef progress $ \progressPtr -> hide' progressPtr +{# fun Fl_Progress_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Progress orig impl where + runOp _ _ progress = withRef progress $ \progressPtr -> hideSuper' progressPtr +{# fun Fl_Progress_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Progress orig impl where + runOp _ _ progress = withRef progress $ \progressPtr -> show' progressPtr +{# fun Fl_Progress_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Progress orig impl where + runOp _ _ progress = withRef progress $ \progressPtr -> showSuper' progressPtr -- $functions -- @ -- -- destroy :: 'Ref' 'Progress' -> 'IO' () -- --- getMaximum :: 'Ref' 'Progress' -> 'IO' 'Float' +-- draw :: 'Ref' 'Progress' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Progress' -> 'IO' () +-- +-- getMaximum :: 'Ref' 'Progress' -> 'IO' ('Float') +-- +-- getMinimum :: 'Ref' 'Progress' -> 'IO' ('Float') +-- +-- getValue :: 'Ref' 'Progress' -> 'IO' ('Float') -- --- getMinimum :: 'Ref' 'Progress' -> 'IO' 'Float' +-- handle :: 'Ref' 'Progress' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- getValue :: 'Ref' 'Progress' -> 'IO' 'Float' +-- handleSuper :: 'Ref' 'Progress' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Progress' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Progress' -> 'IO' () +-- +-- resize :: 'Ref' 'Progress' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Progress' -> 'Rectangle' -> 'IO' () -- -- setMaximum :: 'Ref' 'Progress' -> 'Float' -> 'IO' () -- -- setMinimum :: 'Ref' 'Progress' -> 'Float' -> 'IO' () -- -- setValue :: 'Ref' 'Progress' -> 'Float' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Progress' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Progress' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs b/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs index 6618a8c4..628e9619 100644 --- a/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs +++ b/src/Graphics/UI/FLTK/LowLevel/RepeatButton.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.RepeatButton ( - repeatButtonNew + repeatButtonNew, + repeatButtonCustom -- * Hierarchy -- -- $hierarchy @@ -24,6 +25,25 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenRepeat_Button_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenRepeat_Button_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +repeatButtonCustom :: + Rectangle -- ^ The bounds of this RepeatButton + -> Maybe T.Text -- ^ The RepeatButton label + -> Maybe (Ref RepeatButton -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs RepeatButton) -- ^ Optional custom widget functions + -> IO (Ref RepeatButton) +repeatButtonCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Repeat_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Repeat_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -41,23 +61,69 @@ instance (impl ~ ( IO ())) => Op (Destroy ()) RepeatButton orig impl where widgetDestroy' buttonPtr >> return nullPtr -{#fun Fl_Repeat_Button_handle as handle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ ( Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) RepeatButton orig impl where - runOp _ _ button event = withRef button (\p -> handle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent - {#fun Fl_Repeat_Button_deactivate as deactivate' { id `Ptr ()'} -> `()' supressWarningAboutRes #} instance (impl ~ ( IO ())) => Op (Deactivate ()) RepeatButton orig impl where runOp _ _ button = withRef button (\p -> deactivate' p ) +{# fun Fl_Repeat_Button_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) RepeatButton orig impl where + runOp _ _ repeatButton = withRef repeatButton $ \repeatButtonPtr -> draw'' repeatButtonPtr +{# fun Fl_Repeat_Button_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) RepeatButton orig impl where + runOp _ _ repeatButton = withRef repeatButton $ \repeatButtonPtr -> drawSuper' repeatButtonPtr +{#fun Fl_Repeat_Button_handle as repeatButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) RepeatButton orig impl where + runOp _ _ repeatButton event = withRef repeatButton (\p -> repeatButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Repeat_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) RepeatButton orig impl where + runOp _ _ repeatButton event = withRef repeatButton $ \repeatButtonPtr -> handleSuper' repeatButtonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Repeat_Button_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) RepeatButton orig impl where + runOp _ _ repeatButton rectangle = withRef repeatButton $ \repeatButtonPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' repeatButtonPtr x_pos y_pos w_pos h_pos +{# fun Fl_Repeat_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) RepeatButton orig impl where + runOp _ _ repeatButton rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef repeatButton $ \repeatButtonPtr -> resizeSuper' repeatButtonPtr x_pos y_pos width height +{# fun Fl_Repeat_Button_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) RepeatButton orig impl where + runOp _ _ repeatButton = withRef repeatButton $ \repeatButtonPtr -> hide' repeatButtonPtr +{# fun Fl_Repeat_Button_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) RepeatButton orig impl where + runOp _ _ repeatButton = withRef repeatButton $ \repeatButtonPtr -> hideSuper' repeatButtonPtr +{# fun Fl_Repeat_Button_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) RepeatButton orig impl where + runOp _ _ repeatButton = withRef repeatButton $ \repeatButtonPtr -> show' repeatButtonPtr +{# fun Fl_Repeat_Button_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) RepeatButton orig impl where + runOp _ _ repeatButton = withRef repeatButton $ \repeatButtonPtr -> showSuper' repeatButtonPtr -- $functions -- @ --- -- deactivate :: 'Ref' 'RepeatButton' -> 'IO' () -- -- destroy :: 'Ref' 'RepeatButton' -> 'IO' () -- --- handle :: 'Ref' 'RepeatButton' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- draw :: 'Ref' 'RepeatButton' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'RepeatButton' -> 'IO' () +-- +-- handle :: 'Ref' 'RepeatButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'RepeatButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'RepeatButton' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'RepeatButton' -> 'IO' () +-- +-- resize :: 'Ref' 'RepeatButton' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'RepeatButton' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'RepeatButton' -> 'IO' () -- +-- showWidgetSuper :: 'Ref' 'RepeatButton' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs b/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs index 8e7a01bc..15df242a 100644 --- a/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs +++ b/src/Graphics/UI/FLTK/LowLevel/ReturnButton.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.ReturnButton ( - returnButtonNew + returnButtonNew, + returnButtonCustom -- * Hierarchy -- -- $hierarchy @@ -24,6 +25,24 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenReturn_Button_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenReturn_Button_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +returnButtonCustom :: + Rectangle -- ^ The bounds of this ReturnButton + -> Maybe T.Text -- ^ The ReturnButton label + -> Maybe (Ref ReturnButton -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs ReturnButton) -- ^ Optional custom widget functions + -> IO (Ref ReturnButton) +returnButtonCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Return_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Return_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -41,9 +60,41 @@ instance (impl ~ IO ()) => Op (Destroy ()) ReturnButton orig impl where widgetDestroy' buttonPtr >> return nullPtr -{#fun Fl_Return_Button_handle as handle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ ( Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ReturnButton orig impl where - runOp _ _ button event = withRef button (\p -> handle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Return_Button_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) ReturnButton orig impl where + runOp _ _ returnButton = withRef returnButton $ \returnButtonPtr -> draw'' returnButtonPtr +{# fun Fl_Return_Button_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) ReturnButton orig impl where + runOp _ _ returnButton = withRef returnButton $ \returnButtonPtr -> drawSuper' returnButtonPtr +{#fun Fl_Return_Button_handle as returnButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ReturnButton orig impl where + runOp _ _ returnButton event = withRef returnButton (\p -> returnButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Return_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) ReturnButton orig impl where + runOp _ _ returnButton event = withRef returnButton $ \returnButtonPtr -> handleSuper' returnButtonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Return_Button_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ReturnButton orig impl where + runOp _ _ returnButton rectangle = withRef returnButton $ \returnButtonPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' returnButtonPtr x_pos y_pos w_pos h_pos +{# fun Fl_Return_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) ReturnButton orig impl where + runOp _ _ returnButton rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef returnButton $ \returnButtonPtr -> resizeSuper' returnButtonPtr x_pos y_pos width height +{# fun Fl_Return_Button_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) ReturnButton orig impl where + runOp _ _ returnButton = withRef returnButton $ \returnButtonPtr -> hide' returnButtonPtr +{# fun Fl_Return_Button_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) ReturnButton orig impl where + runOp _ _ returnButton = withRef returnButton $ \returnButtonPtr -> hideSuper' returnButtonPtr +{# fun Fl_Return_Button_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) ReturnButton orig impl where + runOp _ _ returnButton = withRef returnButton $ \returnButtonPtr -> show' returnButtonPtr +{# fun Fl_Return_Button_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) ReturnButton orig impl where + runOp _ _ returnButton = withRef returnButton $ \returnButtonPtr -> showSuper' returnButtonPtr + -- $functions -- @ -- diff --git a/src/Graphics/UI/FLTK/LowLevel/Roller.chs b/src/Graphics/UI/FLTK/LowLevel/Roller.chs index 555bcff2..2c7c8e3c 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Roller.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Roller.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.Roller ( -- * Constructor - rollerNew + rollerNew, + rollerCustom -- * Hierarchy -- -- $hierarchy @@ -17,13 +18,30 @@ where #include "Fl_Types.h" #include "Fl_RollerC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenRoller_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenRoller_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +rollerCustom :: + Rectangle -- ^ The bounds of this Roller + -> Maybe T.Text -- ^ The Roller label + -> Maybe (Ref Roller -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Roller) -- ^ Optional custom widget functions + -> IO (Ref Roller) +rollerCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Roller_New as rollerNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Roller_New_WithLabel as rollerNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -41,11 +59,40 @@ instance (impl ~ (IO ())) => Op (Destroy ()) Roller orig impl where runOp _ _ roller = swapRef roller $ \rollerPtr -> do rollerDestroy' rollerPtr return nullPtr - +{# fun Fl_Roller_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Roller orig impl where + runOp _ _ roller = withRef roller $ \rollerPtr -> draw'' rollerPtr +{# fun Fl_Roller_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Roller orig impl where + runOp _ _ roller = withRef roller $ \rollerPtr -> drawSuper' rollerPtr {#fun Fl_Roller_handle as rollerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Roller orig impl where runOp _ _ roller event = withRef roller (\p -> rollerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent - +{# fun Fl_Roller_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Roller orig impl where + runOp _ _ roller event = withRef roller $ \rollerPtr -> handleSuper' rollerPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Roller_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Roller orig impl where + runOp _ _ roller rectangle = withRef roller $ \rollerPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' rollerPtr x_pos y_pos w_pos h_pos +{# fun Fl_Roller_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Roller orig impl where + runOp _ _ roller rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef roller $ \rollerPtr -> resizeSuper' rollerPtr x_pos y_pos width height +{# fun Fl_Roller_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Roller orig impl where + runOp _ _ roller = withRef roller $ \rollerPtr -> hide' rollerPtr +{# fun Fl_Roller_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Roller orig impl where + runOp _ _ roller = withRef roller $ \rollerPtr -> hideSuper' rollerPtr +{# fun Fl_Roller_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Roller orig impl where + runOp _ _ roller = withRef roller $ \rollerPtr -> show' rollerPtr +{# fun Fl_Roller_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Roller orig impl where + runOp _ _ roller = withRef roller $ \rollerPtr -> showSuper' rollerPtr -- $functions -- @ -- diff --git a/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs b/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs index 29823e69..f3a38246 100644 --- a/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs +++ b/src/Graphics/UI/FLTK/LowLevel/RoundButton.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.RoundButton ( - roundButtonNew + roundButtonNew, + roundButtonCustom -- * Hierarchy -- -- $hierarchy @@ -17,13 +18,29 @@ where #include "Fl_Round_ButtonC.h" #include "Fl_WidgetC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T - +{# fun Fl_OverriddenRound_Button_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenRound_Button_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +roundButtonCustom :: + Rectangle -- ^ The bounds of this RoundButton + -> Maybe T.Text -- ^ The RoundButton label + -> Maybe (Ref RoundButton -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs RoundButton) -- ^ Optional custom widget functions + -> IO (Ref RoundButton) +roundButtonCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Round_Button_New as widgetNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Round_Button_New_WithLabel as widgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} roundButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref RoundButton) @@ -39,11 +56,64 @@ instance (impl ~ IO ()) => Op (Destroy ()) RoundButton orig impl where \buttonPtr -> widgetDestroy' buttonPtr >> return nullPtr +{# fun Fl_Round_Button_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) RoundButton orig impl where + runOp _ _ roundButton = withRef roundButton $ \roundButtonPtr -> draw'' roundButtonPtr +{# fun Fl_Round_Button_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) RoundButton orig impl where + runOp _ _ roundButton = withRef roundButton $ \roundButtonPtr -> drawSuper' roundButtonPtr +{#fun Fl_Round_Button_handle as roundButtonHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) RoundButton orig impl where + runOp _ _ roundButton event = withRef roundButton (\p -> roundButtonHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Round_Button_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) RoundButton orig impl where + runOp _ _ roundButton event = withRef roundButton $ \roundButtonPtr -> handleSuper' roundButtonPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Round_Button_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) RoundButton orig impl where + runOp _ _ roundButton rectangle = withRef roundButton $ \roundButtonPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' roundButtonPtr x_pos y_pos w_pos h_pos +{# fun Fl_Round_Button_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) RoundButton orig impl where + runOp _ _ roundButton rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef roundButton $ \roundButtonPtr -> resizeSuper' roundButtonPtr x_pos y_pos width height +{# fun Fl_Round_Button_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) RoundButton orig impl where + runOp _ _ roundButton = withRef roundButton $ \roundButtonPtr -> hide' roundButtonPtr +{# fun Fl_Round_Button_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) RoundButton orig impl where + runOp _ _ roundButton = withRef roundButton $ \roundButtonPtr -> hideSuper' roundButtonPtr +{# fun Fl_Round_Button_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) RoundButton orig impl where + runOp _ _ roundButton = withRef roundButton $ \roundButtonPtr -> show' roundButtonPtr +{# fun Fl_Round_Button_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) RoundButton orig impl where + runOp _ _ roundButton = withRef roundButton $ \roundButtonPtr -> showSuper' roundButtonPtr -- $functions -- @ --- -- destroy :: 'Ref' 'RoundButton' -> 'IO' () +-- +-- draw :: 'Ref' 'RoundButton' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'RoundButton' -> 'IO' () +-- +-- handle :: 'Ref' 'RoundButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'RoundButton' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'RoundButton' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'RoundButton' -> 'IO' () +-- +-- resize :: 'Ref' 'RoundButton' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'RoundButton' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'RoundButton' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'RoundButton' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs b/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs index 9d2c188c..65285970 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Scrollbar.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Scrollbar ( -- * Constructor scrollbarNew, + scrollbarCustom -- * Hierarchy -- -- $hierarchy @@ -18,7 +19,7 @@ where #include "Fl_ScrollbarC.h" #include "Fl_WidgetC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -26,6 +27,24 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenScrollbar_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenScrollbar_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +scrollbarCustom :: + Rectangle -- ^ The bounds of this Scrollbar + -> Maybe T.Text -- ^ The Scrollbar label + -> Maybe (Ref Scrollbar -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Scrollbar) -- ^ Optional custom widget functions + -> IO (Ref Scrollbar) +scrollbarCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Scrollbar_New as scrollbarNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Scrollbar_New_WithLabel as scrollbarNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} scrollbarNew :: Rectangle -> Maybe T.Text -> IO (Ref Scrollbar) @@ -55,11 +74,6 @@ instance (impl ~ (LineSize -> IO ())) => Op (SetLinesize ()) Scrollbar orig imp instance (impl ~ ( IO LineSize)) => Op (GetLinesize ()) Scrollbar orig impl where runOp _ _ slider = withRef slider $ \sliderPtr -> linesize' sliderPtr >>= return . LineSize -{#fun Fl_Scrollbar_handle as scrollbarHandle' - { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Scrollbar orig impl where - runOp _ _ scrollbar event = withRef scrollbar (\p -> scrollbarHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent - {# fun Fl_Widget_set_type as setType' { id `Ptr ()',`Word8' } -> `()' supressWarningAboutRes #} instance (impl ~ (ScrollbarType -> IO ())) => Op (SetType ()) Scrollbar orig impl where runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (fromInteger $ toInteger $ fromEnum t) @@ -67,21 +81,76 @@ instance (impl ~ (ScrollbarType -> IO ())) => Op (SetType ()) Scrollbar orig im instance (impl ~ IO (ScrollbarType)) => Op (GetType_ ()) Scrollbar orig impl where runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger +{# fun Fl_Scrollbar_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Scrollbar orig impl where + runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> draw'' scrollbarPtr +{# fun Fl_Scrollbar_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Scrollbar orig impl where + runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> drawSuper' scrollbarPtr +{#fun Fl_Scrollbar_handle as scrollbarHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Scrollbar orig impl where + runOp _ _ scrollbar event = withRef scrollbar (\p -> scrollbarHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Scrollbar_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Scrollbar orig impl where + runOp _ _ scrollbar event = withRef scrollbar $ \scrollbarPtr -> handleSuper' scrollbarPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Scrollbar_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Scrollbar orig impl where + runOp _ _ scrollbar rectangle = withRef scrollbar $ \scrollbarPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' scrollbarPtr x_pos y_pos w_pos h_pos +{# fun Fl_Scrollbar_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Scrollbar orig impl where + runOp _ _ scrollbar rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef scrollbar $ \scrollbarPtr -> resizeSuper' scrollbarPtr x_pos y_pos width height +{# fun Fl_Scrollbar_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Scrollbar orig impl where + runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> hide' scrollbarPtr +{# fun Fl_Scrollbar_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Scrollbar orig impl where + runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> hideSuper' scrollbarPtr +{# fun Fl_Scrollbar_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Scrollbar orig impl where + runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> show' scrollbarPtr +{# fun Fl_Scrollbar_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Scrollbar orig impl where + runOp _ _ scrollbar = withRef scrollbar $ \scrollbarPtr -> showSuper' scrollbarPtr + -- $functions -- @ -- destroy :: 'Ref' 'Scrollbar' -> 'IO' () -- +-- draw :: 'Ref' 'Scrollbar' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Scrollbar' -> 'IO' () +-- -- getLinesize :: 'Ref' 'Scrollbar' -> 'IO' 'LineSize' -- -- getType_ :: 'Ref' 'Scrollbar' -> 'IO' ('ScrollbarType') -- --- handle :: 'Ref' 'Scrollbar' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handle :: 'Ref' 'Scrollbar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handle :: 'Ref' 'Scrollbar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Scrollbar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Scrollbar' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Scrollbar' -> 'IO' () +-- +-- resize :: 'Ref' 'Scrollbar' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Scrollbar' -> 'Rectangle' -> 'IO' () -- -- setLinesize :: 'Ref' 'Scrollbar' -> 'LineSize' -> 'IO' () -- -- setScrollValue :: 'Ref' 'Scrollbar' -> 'Int' -> 'Int' -> 'Int' -> 'Int' -> 'IO' ('Int') -- -- setType :: 'Ref' 'Scrollbar' -> 'ScrollbarType' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Scrollbar' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Scrollbar' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs b/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs index 8596e729..dc3f2d29 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Scrolled.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Scrolled ( -- * Constructor scrolledNew, + scrolledCustom -- * Hierarchy -- -- $hierarchy @@ -17,13 +18,30 @@ where #include "Fl_Types.h" #include "Fl_ScrollC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +{# fun Fl_OverriddenScroll_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenScroll_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +scrolledCustom :: + Rectangle -- ^ The bounds of this Scrolled + -> Maybe T.Text -- ^ The Scrolled label + -> Maybe (Ref Scrolled -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Scrolled) -- ^ Optional custom widget functions + -> IO (Ref Scrolled) +scrolledCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Scroll_New as scrollNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Scroll_New_WithLabel as scrollNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -59,12 +77,40 @@ instance (impl ~ ( IO (ScrollbarMode))) => Op (GetType_ ()) Scrolled orig impl w {# fun Fl_Scroll_set_type as setType' { id `Ptr ()',`Word8' } -> `()' #} instance (impl ~ (ScrollbarMode -> IO ())) => Op (SetType ()) Scrolled orig impl where runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (cFromEnum t) -{# fun Fl_Scroll_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' #} -instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Scrolled orig impl where - runOp _ _ widget rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef widget $ \scrollPtr -> resize' scrollPtr x_pos' y_pos' width' height' -{# fun Fl_Scroll_handle as handle' { id `Ptr ()',`Int' } -> `Int' #} -instance (impl ~ (Event -> IO(Either UnknownEvent ()))) => Op (Handle ()) Scrolled orig impl where - runOp _ _ widget event = withRef widget $ \scrollPtr -> handle' scrollPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Scroll_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Scrolled orig impl where + runOp _ _ scrolled = withRef scrolled $ \scrolledPtr -> draw'' scrolledPtr +{# fun Fl_Scroll_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Scrolled orig impl where + runOp _ _ scrolled = withRef scrolled $ \scrolledPtr -> drawSuper' scrolledPtr +{#fun Fl_Scroll_handle as scrolledHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Scrolled orig impl where + runOp _ _ scrolled event = withRef scrolled (\p -> scrolledHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Scroll_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Scrolled orig impl where + runOp _ _ scrolled event = withRef scrolled $ \scrolledPtr -> handleSuper' scrolledPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Scroll_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Scrolled orig impl where + runOp _ _ scrolled rectangle = withRef scrolled $ \scrolledPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' scrolledPtr x_pos y_pos w_pos h_pos +{# fun Fl_Scroll_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Scrolled orig impl where + runOp _ _ scrolled rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef scrolled $ \scrolledPtr -> resizeSuper' scrolledPtr x_pos y_pos width height +{# fun Fl_Scroll_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Scrolled orig impl where + runOp _ _ scrolled = withRef scrolled $ \scrolledPtr -> hide' scrolledPtr +{# fun Fl_Scroll_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Scrolled orig impl where + runOp _ _ scrolled = withRef scrolled $ \scrolledPtr -> hideSuper' scrolledPtr +{# fun Fl_Scroll_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Scrolled orig impl where + runOp _ _ scrolled = withRef scrolled $ \scrolledPtr -> show' scrolledPtr +{# fun Fl_Scroll_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Scrolled orig impl where + runOp _ _ scrolled = withRef scrolled $ \scrolledPtr -> showSuper' scrolledPtr -- $hierarchy -- @ @@ -82,21 +128,39 @@ instance (impl ~ (Event -> IO(Either UnknownEvent ()))) => Op (Handle ()) Scrol -- @ -- clear :: 'Ref' 'Scrolled' -> 'IO' () -- --- getScrollbarSize :: 'Ref' 'Scrolled' -> 'IO' 'Int' +-- draw :: 'Ref' 'Scrolled' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Scrolled' -> 'IO' () +-- +-- getScrollbarSize :: 'Ref' 'Scrolled' -> 'IO' ('Int') +-- +-- getType_ :: 'Ref' 'Scrolled' -> 'IO' ('ScrollbarMode') +-- +-- handle :: 'Ref' 'Scrolled' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- getType :: 'Ref' 'Scrolled' -> 'IO' 'ScrollbarMode' +-- handleSuper :: 'Ref' 'Scrolled' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- handle :: 'Ref' 'Scrolled' -> 'Int' -> 'IO' 'Int' +-- hide :: 'Ref' 'Scrolled' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Scrolled' -> 'IO' () +-- +-- resize :: 'Ref' 'Scrolled' -> 'Rectangle' -> 'IO' () -- -- resize :: 'Ref' 'Scrolled' -> 'Rectangle' -> 'IO' () -- +-- resizeSuper :: 'Ref' 'Scrolled' -> 'Rectangle' -> 'IO' () +-- -- scrollTo :: 'Ref' 'Scrolled' -> 'Position' -> 'IO' () -- -- setScrollbarSize :: 'Ref' 'Scrolled' -> 'Int' -> 'IO' () -- -- setType :: 'Ref' 'Scrolled' -> 'ScrollbarMode' -> 'IO' () -- --- xposition :: 'Ref' 'Scrolled' -> 'IO' 'Int' +-- showWidget :: 'Ref' 'Scrolled' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Scrolled' -> 'IO' () +-- +-- xposition :: 'Ref' 'Scrolled' -> 'IO' ('Int') -- --- yposition :: 'Ref' 'Scrolled' -> 'IO' 'Int' +-- yposition :: 'Ref' 'Scrolled' -> 'IO' ('Int') -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Slider.chs b/src/Graphics/UI/FLTK/LowLevel/Slider.chs index 123b0d2b..63fa1ff8 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Slider.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Slider.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.Slider ( - sliderNew + sliderNew, + sliderCustom -- * Hierarchy -- -- $hierarchy @@ -17,14 +18,29 @@ where #include "Fl_SliderC.h" #include "Fl_WidgetC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T import Graphics.UI.FLTK.LowLevel.Hierarchy - +{# fun Fl_OverriddenSlider_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenSlider_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +sliderCustom :: + Rectangle -- ^ The bounds of this Slider + -> Maybe T.Text -- ^ The Slider label + -> Maybe (Ref Slider -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Slider) -- ^ Optional custom widget functions + -> IO (Ref Slider) +sliderCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Slider_New as sliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Slider_New_WithLabel as sliderNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} sliderNew :: Rectangle -> Maybe T.Text -> IO (Ref Slider) @@ -41,9 +57,6 @@ instance (impl ~ (IO ())) => Op (Destroy ()) Slider orig impl where runOp _ _ win = swapRef win $ \winPtr -> do sliderDestroy' winPtr return nullPtr -{#fun Fl_Slider_handle as sliderHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Slider orig impl where - runOp _ _ slider event = withRef slider (\p -> sliderHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Slider_bounds as bounds' { id `Ptr ()',`Double',`Double' } -> `()' supressWarningAboutRes #} instance (impl ~ (Double -> Double -> IO ())) => Op (Bounds ()) Slider orig impl where runOp _ _ slider a b = withRef slider $ \sliderPtr -> bounds' sliderPtr a b @@ -68,24 +81,81 @@ instance (impl ~ (SliderType -> IO ())) => Op (SetType ()) Slider orig impl whe {# fun Fl_Widget_type as type' { id `Ptr ()' } -> `Word8' #} instance (impl ~ IO (SliderType)) => Op (GetType_ ()) Slider orig impl where runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger + +{# fun Fl_Slider_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Slider orig impl where + runOp _ _ slider = withRef slider $ \sliderPtr -> draw'' sliderPtr +{# fun Fl_Slider_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Slider orig impl where + runOp _ _ slider = withRef slider $ \sliderPtr -> drawSuper' sliderPtr +{#fun Fl_Slider_handle as sliderHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Slider orig impl where + runOp _ _ slider event = withRef slider (\p -> sliderHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Slider_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Slider orig impl where + runOp _ _ slider event = withRef slider $ \sliderPtr -> handleSuper' sliderPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Slider_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Slider orig impl where + runOp _ _ slider rectangle = withRef slider $ \sliderPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' sliderPtr x_pos y_pos w_pos h_pos +{# fun Fl_Slider_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Slider orig impl where + runOp _ _ slider rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef slider $ \sliderPtr -> resizeSuper' sliderPtr x_pos y_pos width height +{# fun Fl_Slider_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Slider orig impl where + runOp _ _ slider = withRef slider $ \sliderPtr -> hide' sliderPtr +{# fun Fl_Slider_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Slider orig impl where + runOp _ _ slider = withRef slider $ \sliderPtr -> hideSuper' sliderPtr +{# fun Fl_Slider_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Slider orig impl where + runOp _ _ slider = withRef slider $ \sliderPtr -> show' sliderPtr +{# fun Fl_Slider_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Slider orig impl where + runOp _ _ slider = withRef slider $ \sliderPtr -> showSuper' sliderPtr + -- $functions -- @ --- -- bounds :: 'Ref' 'Slider' -> 'Double' -> 'Double' -> 'IO' () -- -- destroy :: 'Ref' 'Slider' -> 'IO' () -- --- getSlider :: 'Ref' 'Slider' -> 'IO' 'Boxtype' +-- draw :: 'Ref' 'Slider' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Slider' -> 'IO' () +-- +-- getSlider :: 'Ref' 'Slider' -> 'IO' ('Boxtype') -- -- getSliderSize :: 'Ref' 'Slider' -> 'Double' -> 'IO' () -- --- handle :: 'Ref' 'Slider' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- getType_ :: 'Ref' 'Slider' -> 'IO' ('SliderType') +-- +-- handle :: 'Ref' 'Slider' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Slider' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Slider' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Slider' -> 'IO' () -- --- scrollvalue :: 'Ref' 'Slider' -> 'Int' -> 'Int' -> 'Int' -> 'Int' -> 'IO' 'Int' +-- resize :: 'Ref' 'Slider' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Slider' -> 'Rectangle' -> 'IO' () +-- +-- scrollvalue :: 'Ref' 'Slider' -> 'Int' -> 'Int' -> 'Int' -> 'Int' -> 'IO' ('Int') -- -- setSlider :: 'Ref' 'Slider' -> 'Boxtype' -> 'IO' () -- --- setSliderSize :: 'Ref' 'Slider' -> 'IO' 'Float' +-- setSliderSize :: 'Ref' 'Slider' -> 'IO' ('Float') +-- +-- setType :: 'Ref' 'Slider' -> 'SliderType' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Slider' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Slider' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Spinner.chs b/src/Graphics/UI/FLTK/LowLevel/Spinner.chs index 26276178..3a3db7a3 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Spinner.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Spinner.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Spinner ( -- * Constructor spinnerNew, + spinnerCustom, SpinnerType(..) -- * Hierarchy -- @@ -20,7 +21,7 @@ where #include "Fl_SpinnerC.h" #include "Fl_WidgetC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -34,6 +35,23 @@ enum SpinnerType { }; #endc {#enum SpinnerType {} deriving (Show, Eq) #} +{# fun Fl_OverriddenSpinner_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenSpinner_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +spinnerCustom :: + Rectangle -- ^ The bounds of this Spinner + -> Maybe T.Text -- ^ The Spinner label + -> Maybe (Ref Spinner -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Spinner) -- ^ Optional custom widget functions + -> IO (Ref Spinner) +spinnerCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Spinner_New as spinnerNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Spinner_New_WithLabel as spinnerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} spinnerNew :: Rectangle -> Maybe T.Text -> IO (Ref Spinner) @@ -45,9 +63,6 @@ spinnerNew rectangle l'= Just l -> spinnerNewWithLabel' x_pos y_pos width height l >>= toRef -{#fun Fl_Spinner_handle as spinnerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Spinner orig impl where - runOp _ _ spinner event = withRef spinner (\p -> spinnerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Spinner_set_textfont as setTextfont' { id `Ptr ()',cFromFont `Font' } -> `()' #} instance (impl ~ (Font -> IO ())) => Op (SetTextfont ()) Spinner orig impl where runOp _ _ spinner text = withRef spinner $ \spinnerPtr -> setTextfont' spinnerPtr text @@ -106,6 +121,40 @@ instance (impl ~ (Double -> IO ())) => Op (SetMinimum ()) Spinner orig impl whe {# fun Fl_Spinner_range as range' { id `Ptr ()',`Double',`Double' } -> `()' supressWarningAboutRes #} instance (impl ~ (Double -> Double -> IO ())) => Op (Range ()) Spinner orig impl where runOp _ _ valuator a b = withRef valuator $ \valuatorPtr -> range' valuatorPtr a b +{# fun Fl_Spinner_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Spinner orig impl where + runOp _ _ spinner = withRef spinner $ \spinnerPtr -> draw'' spinnerPtr +{# fun Fl_Spinner_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Spinner orig impl where + runOp _ _ spinner = withRef spinner $ \spinnerPtr -> drawSuper' spinnerPtr +{#fun Fl_Spinner_handle as spinnerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Spinner orig impl where + runOp _ _ spinner event = withRef spinner (\p -> spinnerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Spinner_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Spinner orig impl where + runOp _ _ spinner event = withRef spinner $ \spinnerPtr -> handleSuper' spinnerPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Spinner_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Spinner orig impl where + runOp _ _ spinner rectangle = withRef spinner $ \spinnerPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' spinnerPtr x_pos y_pos w_pos h_pos +{# fun Fl_Spinner_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Spinner orig impl where + runOp _ _ spinner rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef spinner $ \spinnerPtr -> resizeSuper' spinnerPtr x_pos y_pos width height +{# fun Fl_Spinner_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Spinner orig impl where + runOp _ _ spinner = withRef spinner $ \spinnerPtr -> hide' spinnerPtr +{# fun Fl_Spinner_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Spinner orig impl where + runOp _ _ spinner = withRef spinner $ \spinnerPtr -> hideSuper' spinnerPtr +{# fun Fl_Spinner_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Spinner orig impl where + runOp _ _ spinner = withRef spinner $ \spinnerPtr -> show' spinnerPtr +{# fun Fl_Spinner_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Spinner orig impl where + runOp _ _ spinner = withRef spinner $ \spinnerPtr -> showSuper' spinnerPtr -- $hierarchy -- @ @@ -122,6 +171,10 @@ instance (impl ~ (Double -> Double -> IO ())) => Op (Range ()) Spinner orig imp -- $functions -- @ +-- draw :: 'Ref' 'Spinner' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Spinner' -> 'IO' () +-- -- getFormat :: 'Ref' 'Spinner' -> 'IO' ('Maybe' 'T.Text') -- -- getMaximum :: 'Ref' 'Spinner' -> 'IO' ('Double') @@ -140,10 +193,20 @@ instance (impl ~ (Double -> Double -> IO ())) => Op (Range ()) Spinner orig imp -- -- getValue :: 'Ref' 'Spinner' -> 'IO' ('Double') -- --- handle :: 'Ref' 'Spinner' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handle :: 'Ref' 'Spinner' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Spinner' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Spinner' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Spinner' -> 'IO' () -- -- range :: 'Ref' 'Spinner' -> 'Double' -> 'Double' -> 'IO' () -- +-- resize :: 'Ref' 'Spinner' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Spinner' -> 'Rectangle' -> 'IO' () +-- -- setFormat :: 'Ref' 'Spinner' -> 'T.Text' -> 'IO' () -- -- setMaximum :: 'Ref' 'Spinner' -> 'Double' -> 'IO' () @@ -162,4 +225,7 @@ instance (impl ~ (Double -> Double -> IO ())) => Op (Range ()) Spinner orig imp -- -- setValue :: 'Ref' 'Spinner' -> 'Double' -> 'IO' () -- +-- showWidget :: 'Ref' 'Spinner' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Spinner' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs b/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs index 5e7aa684..d42889d4 100644 --- a/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs +++ b/src/Graphics/UI/FLTK/LowLevel/SysMenuBar.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.SysMenuBar ( - sysMenuBarNew + sysMenuBarNew, + sysMenuBarCustom -- * Hierarchy -- -- $hierarchy @@ -17,7 +18,7 @@ where #include "Fl_Sys_Menu_BarC.h" #include "Fl_WidgetC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -27,6 +28,22 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.MenuItem import Graphics.UI.FLTK.LowLevel.MenuPrim +{# fun Fl_OverriddenSys_Menu_Bar_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenSys_Menu_Bar_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +sysMenuBarCustom :: + Rectangle -- ^ The bounds of this SysMenuBar + -> Maybe T.Text -- ^ The SysMenuBar label + -> Maybe (Ref SysMenuBar -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs SysMenuBar) -- ^ Optional custom widget functions + -> IO (Ref SysMenuBar) +sysMenuBarCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Sys_Menu_Bar_New as sysMenuBarNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Sys_Menu_Bar_New_WithLabel as sysMenuBarNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} sysMenuBarNew :: Rectangle -> Maybe T.Text -> IO (Ref SysMenuBar) @@ -42,9 +59,6 @@ instance (impl ~ ( IO ())) => Op (Destroy ()) SysMenuBar orig impl where runOp _ _ win = swapRef win $ \winPtr -> do sysMenuBarDestroy' winPtr return nullPtr -{#fun Fl_Sys_Menu_Bar_handle as sysMenuBarHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ ( Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) SysMenuBar orig impl where - runOp _ _ menu_bar event = withRef menu_bar (\p -> sysMenuBarHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Sys_Menu_Bar_remove as remove' { id `Ptr ()',`Int' } -> `()' #} instance (impl ~ (Int -> IO ())) => Op (Remove ()) SysMenuBar orig impl where runOp _ _ menu_ index' = withRef menu_ $ \menu_Ptr -> remove' menu_Ptr index' @@ -92,10 +106,43 @@ instance (Parent a MenuItem, impl ~ ( T.Text -> Maybe Shortcut -> Maybe (Ref a-> {# fun Fl_Sys_Menu_Bar_insert_with_shortcutname_flags as insertWithShortcutnameFlags' { id `Ptr ()',`Int',unsafeToCString `T.Text', unsafeToCString `T.Text',id `FunPtr CallbackWithUserDataPrim',`Int' } -> `Int' #} instance (Parent a MenuPrim, impl ~ ( Int -> T.Text -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) SysMenuBar orig impl where runOp _ _ menu_ index' name shortcut cb flags = insertMenuItem (safeCast menu_) index' name shortcut cb flags insertWithFlags' insertWithShortcutnameFlags' +{# fun Fl_Sys_Menu_Bar_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar = withRef sysMenuBar $ \sysMenuBarPtr -> draw'' sysMenuBarPtr +{# fun Fl_Sys_Menu_Bar_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar = withRef sysMenuBar $ \sysMenuBarPtr -> drawSuper' sysMenuBarPtr +{#fun Fl_Sys_Menu_Bar_handle as sysMenuBarHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar event = withRef sysMenuBar (\p -> sysMenuBarHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Sys_Menu_Bar_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar event = withRef sysMenuBar $ \sysMenuBarPtr -> handleSuper' sysMenuBarPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Sys_Menu_Bar_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar rectangle = withRef sysMenuBar $ \sysMenuBarPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' sysMenuBarPtr x_pos y_pos w_pos h_pos +{# fun Fl_Sys_Menu_Bar_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef sysMenuBar $ \sysMenuBarPtr -> resizeSuper' sysMenuBarPtr x_pos y_pos width height +{# fun Fl_Sys_Menu_Bar_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar = withRef sysMenuBar $ \sysMenuBarPtr -> hide' sysMenuBarPtr +{# fun Fl_Sys_Menu_Bar_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar = withRef sysMenuBar $ \sysMenuBarPtr -> hideSuper' sysMenuBarPtr +{# fun Fl_Sys_Menu_Bar_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar = withRef sysMenuBar $ \sysMenuBarPtr -> show' sysMenuBarPtr +{# fun Fl_Sys_Menu_Bar_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) SysMenuBar orig impl where + runOp _ _ sysMenuBar = withRef sysMenuBar $ \sysMenuBarPtr -> showSuper' sysMenuBarPtr -- $functions -- @ --- -- add:: ('Parent' a 'MenuItem') => 'Ref' 'SysMenuBar' -> 'T.Text' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex') -- -- addName :: 'Ref' 'SysMenuBar' -> 'T.Text' -> 'IO' () @@ -106,11 +153,23 @@ instance (Parent a MenuPrim, impl ~ ( Int -> T.Text -> Maybe Shortcut -> (Ref a -- -- destroy :: 'Ref' 'SysMenuBar' -> 'IO' () -- +-- draw :: 'Ref' 'SysMenuBar' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'SysMenuBar' -> 'IO' () +-- -- getMode :: 'Ref' 'SysMenuBar' -> 'Int' -> 'IO' ('Maybe' 'MenuItemFlags') -- -- global :: 'Ref' 'SysMenuBar' -> 'IO' () -- --- handle :: 'Ref' 'SysMenuBar' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handle :: 'Ref' 'SysMenuBar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handle :: 'Ref' 'SysMenuBar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'SysMenuBar' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'SysMenuBar' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'SysMenuBar' -> 'IO' () -- -- insert:: ('Parent' a 'MenuPrim') => 'Ref' 'SysMenuBar' -> 'Int' -> 'T.Text' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('MenuItemIndex') -- @@ -118,12 +177,19 @@ instance (Parent a MenuPrim, impl ~ ( Int -> T.Text -> Maybe Shortcut -> (Ref a -- -- replace :: 'Ref' 'SysMenuBar' -> 'Int' -> 'T.Text' -> 'IO' () -- +-- resize :: 'Ref' 'SysMenuBar' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'SysMenuBar' -> 'Rectangle' -> 'IO' () +-- -- setMenu :: 'Ref' 'SysMenuBar' -> ['Ref' 'MenuItem'] -> 'IO' () -- -- setMode :: 'Ref' 'SysMenuBar' -> 'Int' -> 'MenuItemFlags' -> 'IO' () -- -- setShortcut :: 'Ref' 'SysMenuBar' -> 'Int' -> 'ShortcutKeySequence' -> 'IO' () -- +-- showWidget :: 'Ref' 'SysMenuBar' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'SysMenuBar' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/TableRow.chs b/src/Graphics/UI/FLTK/LowLevel/TableRow.chs index 702d3016..5650e8a3 100644 --- a/src/Graphics/UI/FLTK/LowLevel/TableRow.chs +++ b/src/Graphics/UI/FLTK/LowLevel/TableRow.chs @@ -95,6 +95,24 @@ instance (impl ~ ( TableRowSelectFlag -> IO ())) => Op (SelectAllRows ()) TableR TableRowSelect -> selectAllRows' tablePtr 1 TableRowDeselect -> selectAllRows' tablePtr 0 TableRowToggle -> selectAllRows' tablePtr 2 +{# fun Fl_Table_Row_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) TableRow orig impl where + runOp _ _ tableRow = withRef tableRow $ \tableRowPtr -> draw'' tableRowPtr +{# fun Fl_Table_Row_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) TableRow orig impl where + runOp _ _ tableRow = withRef tableRow $ \tableRowPtr -> drawSuper' tableRowPtr +{# fun Fl_Table_Row_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) TableRow orig impl where + runOp _ _ tableRow = withRef tableRow $ \tableRowPtr -> hide' tableRowPtr +{# fun Fl_Table_Row_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) TableRow orig impl where + runOp _ _ tableRow = withRef tableRow $ \tableRowPtr -> hideSuper' tableRowPtr +{# fun Fl_Table_Row_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) TableRow orig impl where + runOp _ _ tableRow = withRef tableRow $ \tableRowPtr -> show' tableRowPtr +{# fun Fl_Table_Row_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) TableRow orig impl where + runOp _ _ tableRow = withRef tableRow $ \tableRowPtr -> showSuper' tableRowPtr -- $functions -- @ @@ -104,15 +122,23 @@ instance (impl ~ ( TableRowSelectFlag -> IO ())) => Op (SelectAllRows ()) TableR -- -- destroy :: 'Ref' 'TableRow' -> 'IO' () -- +-- draw :: 'Ref' 'TableRow' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'TableRow' -> 'IO' () +-- -- getRowSelected :: 'Ref' 'TableRow' -> 'Int' -> 'IO' ('Either' 'OutOfRange' 'Bool') -- -- getRows :: 'Ref' 'TableRow' -> 'IO' ('Int') -- -- getType_ :: 'Ref' 'TableRow' -> 'IO' 'TableRowSelectMode' -- --- handle :: 'Ref' 'TableRow' -> 'Event' -> 'IO' ('Int') +-- handle :: 'Ref' 'TableRow' -> 'Event' -> 'IO(Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'TableRow' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- handleSuper :: 'Ref' 'TableRow' -> 'Event' -> 'IO' ('Int') +-- hide :: 'Ref' 'TableRow' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'TableRow' -> 'IO' () -- -- resize :: 'Ref' 'TableRow' -> 'Rectangle' -> 'IO' () -- @@ -130,6 +156,10 @@ instance (impl ~ ( TableRowSelectFlag -> IO ())) => Op (SelectAllRows ()) TableR -- -- setType :: 'Ref' 'TableRow' -> 'TableRowSelectMode' -> 'IO' () -- +-- showWidget :: 'Ref' 'TableRow' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'TableRow' -> 'IO' () +-- -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Tabs.chs b/src/Graphics/UI/FLTK/LowLevel/Tabs.chs index 527a79f1..56c26a4b 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Tabs.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Tabs.chs @@ -3,6 +3,7 @@ module Graphics.UI.FLTK.LowLevel.Tabs ( tabsNew, + tabsCustom, TabsHeightOffset(..) -- * Hierarchy -- @@ -18,7 +19,7 @@ where #include "Fl_Types.h" #include "Fl_TabsC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -28,6 +29,24 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy data TabsHeightOffset = TabsAtTop (Maybe Int) | TabsAtBottom (Maybe Int) +{# fun Fl_OverriddenTabs_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenTabs_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +tabsCustom :: + Rectangle -- ^ The bounds of this Tabs + -> Maybe T.Text -- ^ The Tabs label + -> Maybe (Ref Tabs -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Tabs) -- ^ Optional custom widget functions + -> IO (Ref Tabs) +tabsCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Tabs_New as tabsNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Tabs_New_WithLabel as tabsNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} tabsNew :: Rectangle -> Maybe T.Text -> IO (Ref Tabs) @@ -37,10 +56,6 @@ tabsNew rectangle l' = Nothing -> tabsNew' x_pos y_pos width height >>= toRef Just l -> tabsNewWithLabel' x_pos y_pos width height l >>= toRef -{# fun Fl_Tabs_handle as handle' { id `Ptr ()',`Int' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Tabs orig impl where - runOp _ _ tabs event = withRef tabs (\p -> handle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent - {# fun Fl_Tabs_value as value' { id `Ptr ()' } -> `Ptr ()' id #} instance (impl ~ (IO (Maybe (Ref Widget)))) => Op (GetValue ()) Tabs orig impl where runOp _ _ tabs = withRef tabs $ \tabsPtr -> value' tabsPtr >>= toMaybeRef @@ -71,6 +86,41 @@ instance (impl ~ (TabsHeightOffset -> IO Rectangle)) => Op (ClientArea ()) Tabs TabsAtBottom Nothing -> clientAreaWithTabh' tabsPtr (-1) >>= return . toRectangle TabsAtBottom (Just o) -> clientAreaWithTabh' tabsPtr (0 - o) >>= return . toRectangle +{# fun Fl_Tabs_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Tabs orig impl where + runOp _ _ tabs = withRef tabs $ \tabsPtr -> draw'' tabsPtr +{# fun Fl_Tabs_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Tabs orig impl where + runOp _ _ tabs = withRef tabs $ \tabsPtr -> drawSuper' tabsPtr +{#fun Fl_Tabs_handle as tabsHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Tabs orig impl where + runOp _ _ tabs event = withRef tabs (\p -> tabsHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Tabs_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Tabs orig impl where + runOp _ _ tabs event = withRef tabs $ \tabsPtr -> handleSuper' tabsPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Tabs_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Tabs orig impl where + runOp _ _ tabs rectangle = withRef tabs $ \tabsPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' tabsPtr x_pos y_pos w_pos h_pos +{# fun Fl_Tabs_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Tabs orig impl where + runOp _ _ tabs rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef tabs $ \tabsPtr -> resizeSuper' tabsPtr x_pos y_pos width height +{# fun Fl_Tabs_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Tabs orig impl where + runOp _ _ tabs = withRef tabs $ \tabsPtr -> hide' tabsPtr +{# fun Fl_Tabs_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Tabs orig impl where + runOp _ _ tabs = withRef tabs $ \tabsPtr -> hideSuper' tabsPtr +{# fun Fl_Tabs_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Tabs orig impl where + runOp _ _ tabs = withRef tabs $ \tabsPtr -> show' tabsPtr +{# fun Fl_Tabs_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Tabs orig impl where + runOp _ _ tabs = withRef tabs $ \tabsPtr -> showSuper' tabsPtr + -- $hierarchy -- @ -- "Graphics.UI.FLTK.LowLevel.Widget" diff --git a/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs b/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs index de5368cb..84db02f0 100644 --- a/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs +++ b/src/Graphics/UI/FLTK/LowLevel/TextDisplay.chs @@ -4,7 +4,8 @@ module Graphics.UI.FLTK.LowLevel.TextDisplay ( mkStyleTableEntriesPtr, indexStyleTableEntries, - textDisplayNew + textDisplayNew, + textDisplayCustom -- * Hierarchy -- -- $hierarchy @@ -18,7 +19,7 @@ where #include "Fl_Types.h" #include "Fl_Text_DisplayC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import qualified Foreign.Concurrent as FC import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Fl_Enumerations @@ -52,6 +53,23 @@ mkStyleTableEntriesPtr td stes = do indexStyleTableEntries :: [StyleTableEntry] -> [(Char, StyleTableEntry)] indexStyleTableEntries = zip ['A'..] +{# fun Fl_OverriddenText_Display_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenText_Display_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +textDisplayCustom :: + Rectangle -- ^ The bounds of this TextDisplay + -> Maybe T.Text -- ^ The TextDisplay label + -> Maybe (Ref TextDisplay -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs TextDisplay) -- ^ Optional custom widget functions + -> IO (Ref TextDisplay) +textDisplayCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Text_Display_New as textDisplayNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Text_Display_New_WithLabel as textDisplayNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} textDisplayNew :: Rectangle -> Maybe T.Text -> IO (Ref TextDisplay) @@ -66,15 +84,6 @@ textDisplayNew rectangle l' = {# fun Fl_Text_Display_Destroy as textDisplayDestroy' { id `Ptr ()' } -> `()' supressWarningAboutRes #} instance (impl ~ (IO ())) => Op (Destroy ()) TextDisplay orig impl where runOp _ _ text_display = withRef text_display $ \text_displayPtr -> textDisplayDestroy' text_displayPtr - -{# fun Fl_Text_Display_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} -instance (impl ~ ( Rectangle -> IO ())) => Op (Resize ()) TextDisplay orig impl where - runOp _ _ text_display rectangle = withRef text_display $ \text_displayPtr -> do - let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle - resize' text_displayPtr x_pos y_pos w_pos h_pos -{# fun Fl_Text_Display_handle as handle' { id `Ptr ()',`Int' } -> `Int' #} -instance (impl ~ (Event -> IO(Either UnknownEvent ()))) => Op (Handle ()) TextDisplay orig impl where - runOp _ _ text_display e = withRef text_display $ \text_displayPtr -> handle' text_displayPtr (fromEnum e) >>= return . successOrUnknownEvent {# fun Fl_Text_Display_set_buffer as setBuffer' { id `Ptr ()',id `Ptr ()' } -> `()' #} instance (Parent a TextBuffer, impl ~ (Maybe ( Ref a ) -> IO ())) => Op (SetBuffer ()) TextDisplay orig impl where runOp _ _ text_display buf = withRef text_display $ \text_displayPtr -> withMaybeRef buf $ \bufPtr -> setBuffer' text_displayPtr bufPtr @@ -276,10 +285,51 @@ instance (impl ~ (T.Text -> IO ())) => Op (SetLinenumberFormat ()) TextDisplay {# fun linenumber_format as linenumberFormat' { id `Ptr ()' } -> `T.Text' unsafeFromCString #} instance (impl ~ ( IO T.Text)) => Op (GetLinenumberFormat ()) TextDisplay orig impl where runOp _ _ text_display = withRef text_display $ \text_displayPtr -> linenumberFormat' text_displayPtr +{# fun Fl_Text_Display_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) TextDisplay orig impl where + runOp _ _ textDisplay = withRef textDisplay $ \textDisplayPtr -> draw'' textDisplayPtr +{# fun Fl_Text_Display_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) TextDisplay orig impl where + runOp _ _ textDisplay = withRef textDisplay $ \textDisplayPtr -> drawSuper' textDisplayPtr +{#fun Fl_Text_Display_handle as textDisplayHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) TextDisplay orig impl where + runOp _ _ textDisplay event = withRef textDisplay (\p -> textDisplayHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Text_Display_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) TextDisplay orig impl where + runOp _ _ textDisplay event = withRef textDisplay $ \textDisplayPtr -> handleSuper' textDisplayPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Text_Display_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) TextDisplay orig impl where + runOp _ _ textDisplay rectangle = withRef textDisplay $ \textDisplayPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' textDisplayPtr x_pos y_pos w_pos h_pos +{# fun Fl_Text_Display_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) TextDisplay orig impl where + runOp _ _ textDisplay rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef textDisplay $ \textDisplayPtr -> resizeSuper' textDisplayPtr x_pos y_pos width height +{# fun Fl_Text_Display_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) TextDisplay orig impl where + runOp _ _ textDisplay = withRef textDisplay $ \textDisplayPtr -> hide' textDisplayPtr +{# fun Fl_Text_Display_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) TextDisplay orig impl where + runOp _ _ textDisplay = withRef textDisplay $ \textDisplayPtr -> hideSuper' textDisplayPtr +{# fun Fl_Text_Display_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) TextDisplay orig impl where + runOp _ _ textDisplay = withRef textDisplay $ \textDisplayPtr -> show' textDisplayPtr +{# fun Fl_Text_Display_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) TextDisplay orig impl where + runOp _ _ textDisplay = withRef textDisplay $ \textDisplayPtr -> showSuper' textDisplayPtr -- $hierarchy -- @ +-- "Graphics.UI.FLTK.LowLevel.Widget" +-- | +-- v +-- "Graphics.UI.FLTK.LowLevel.Group" +-- | +-- v -- "Graphics.UI.FLTK.LowLevel.TextDisplay" + -- @ -- $functions @@ -290,6 +340,10 @@ instance (impl ~ ( IO T.Text)) => Op (GetLinenumberFormat ()) TextDisplay orig i -- -- destroy :: 'Ref' 'TextDisplay' -> 'IO' () -- +-- draw :: 'Ref' 'TextDisplay' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'TextDisplay' -> 'IO' () +-- -- getBuffer :: 'Ref' 'TextDisplay' -> 'IO' ('Maybe' ('Ref' 'TextBuffer')) -- -- getCursorColor :: 'Ref' 'TextDisplay' -> 'IO' ('Color') @@ -322,7 +376,13 @@ instance (impl ~ ( IO T.Text)) => Op (GetLinenumberFormat ()) TextDisplay orig i -- -- getTextsize :: 'Ref' 'TextDisplay' -> 'IO' ('FontSize') -- --- handle :: 'Ref' 'TextDisplay' -> 'Event' -> 'IO' ('Int') +-- handle :: 'Ref' 'TextDisplay' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'TextDisplay' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'TextDisplay' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'TextDisplay' -> 'IO' () -- -- highlightData:: ('Parent' a 'TextBuffer') => 'Ref' 'TextDisplay' -> 'Ref' a -> [('Char', 'StyleTableEntry']) -> 'Maybe(Char,UnfinishedStyleCb') -> 'IO' () -- @@ -354,6 +414,8 @@ instance (impl ~ ( IO T.Text)) => Op (GetLinenumberFormat ()) TextDisplay orig i -- -- resize :: 'Ref' 'TextDisplay' -> 'Rectangle' -> 'IO' () -- +-- resizeSuper :: 'Ref' 'TextDisplay' -> 'Rectangle' -> 'IO' () +-- -- rewindLines :: 'Ref' 'TextDisplay' -> 'BufferOffset' -> 'Int' -> 'IO' ('BufferOffset') -- -- scroll :: 'Ref' 'TextDisplay' -> 'Int' -> 'BufferOffset' -> 'IO' () @@ -396,6 +458,10 @@ instance (impl ~ ( IO T.Text)) => Op (GetLinenumberFormat ()) TextDisplay orig i -- -- showInsertPosition :: 'Ref' 'TextDisplay' -> 'IO' () -- +-- showWidget :: 'Ref' 'TextDisplay' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'TextDisplay' -> 'IO' () +-- -- skipLines :: 'Ref' 'TextDisplay' -> 'BufferOffset' -> 'Int' -> 'Bool' -> 'IO' ('BufferOffset') -- -- wordEnd :: 'Ref' 'TextDisplay' -> 'BufferOffset' -> 'IO' ('BufferOffset') diff --git a/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs b/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs index ca96923c..0b233686 100644 --- a/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs +++ b/src/Graphics/UI/FLTK/LowLevel/TextEditor.chs @@ -3,6 +3,7 @@ module Graphics.UI.FLTK.LowLevel.TextEditor ( textEditorNew, + textEditorCustom, KeyBinding(..), KeyFunc(..), KeyFuncPrim, @@ -23,7 +24,7 @@ where #include "Fl_Types.h" #include "Fl_Text_EditorC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Hierarchy @@ -104,6 +105,23 @@ arrayToKeyBindings p = let currKb = KeyBinding (KeyBindingKeySequence evs keyType) (toFunRef function') go (accum ++ [currKb]) next' +{# fun Fl_OverriddenText_Editor_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenText_Editor_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +textEditorCustom :: + Rectangle -- ^ The bounds of this TextEditor + -> Maybe T.Text -- ^ The TextEditor label + -> Maybe (Ref TextEditor -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs TextEditor) -- ^ Optional custom widget functions + -> IO (Ref TextEditor) +textEditorCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Text_Editor_New as textEditorNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Text_Editor_New_WithLabel as textEditorNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} textEditorNew :: Rectangle -> Maybe T.Text -> IO (Ref TextEditor) @@ -113,9 +131,6 @@ textEditorNew rectangle l' = Nothing -> textEditorNew' x_pos y_pos width height >>= toRef Just l -> textEditorNewWithLabel' x_pos y_pos width height l >>= toRef -{# fun Fl_Text_Editor_handle as handle' { id `Ptr ()',`Int' } -> `Int' #} -instance (impl ~ (Event -> IO(Either UnknownEvent ()))) => Op (Handle ()) TextEditor orig impl where - runOp _ _ text_editor e = withRef text_editor $ \text_editorPtr -> handle' text_editorPtr (fromEnum e) >>= return . successOrUnknownEvent {# fun Fl_Text_Editor_Destroy as textEditorDestroy' { id `Ptr ()' } -> `()' supressWarningAboutRes #} instance (impl ~ (IO ())) => Op (Destroy ()) TextEditor orig impl where runOp _ _ editor = swapRef editor $ \editorPtr -> do @@ -138,6 +153,40 @@ instance (impl ~ ([KeyBinding] -> IO ())) => Op (ReplaceKeyBindings ()) TextEdit runOp _ _ text_editor kbs = withRef text_editor $ \text_editorPtr -> do p <- keyBindingsToArray kbs replaceKeyBindings' text_editorPtr p +{# fun Fl_Text_Editor_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) TextEditor orig impl where + runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> draw'' textEditorPtr +{# fun Fl_Text_Editor_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) TextEditor orig impl where + runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> drawSuper' textEditorPtr +{#fun Fl_Text_Editor_handle as textEditorHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) TextEditor orig impl where + runOp _ _ textEditor event = withRef textEditor (\p -> textEditorHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Text_Editor_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) TextEditor orig impl where + runOp _ _ textEditor event = withRef textEditor $ \textEditorPtr -> handleSuper' textEditorPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Text_Editor_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) TextEditor orig impl where + runOp _ _ textEditor rectangle = withRef textEditor $ \textEditorPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' textEditorPtr x_pos y_pos w_pos h_pos +{# fun Fl_Text_Editor_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) TextEditor orig impl where + runOp _ _ textEditor rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef textEditor $ \textEditorPtr -> resizeSuper' textEditorPtr x_pos y_pos width height +{# fun Fl_Text_Editor_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) TextEditor orig impl where + runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> hide' textEditorPtr +{# fun Fl_Text_Editor_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) TextEditor orig impl where + runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> hideSuper' textEditorPtr +{# fun Fl_Text_Editor_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) TextEditor orig impl where + runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> show' textEditorPtr +{# fun Fl_Text_Editor_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) TextEditor orig impl where + runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> showSuper' textEditorPtr -- $hierarchy -- @ @@ -158,14 +207,31 @@ instance (impl ~ ([KeyBinding] -> IO ())) => Op (ReplaceKeyBindings ()) TextEdit -- @ -- destroy :: 'Ref' 'TextEditor' -> 'IO' () -- +-- draw :: 'Ref' 'TextEditor' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'TextEditor' -> 'IO' () +-- -- getDefaultKeyBindings :: 'Ref' 'TextEditor' -> 'IO' ['KeyBinding'] -- --- getInsertMode :: 'Ref' 'TextEditor' -> 'IO' 'Bool' +-- getInsertMode :: 'Ref' 'TextEditor' -> 'IO' ('Bool') +-- +-- handle :: 'Ref' 'TextEditor' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- handle :: 'Ref' 'TextEditor' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handleSuper :: 'Ref' 'TextEditor' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'TextEditor' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'TextEditor' -> 'IO' () -- -- replaceKeyBindings :: 'Ref' 'TextEditor' -> ['KeyBinding'] -> 'IO' () -- +-- resize :: 'Ref' 'TextEditor' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'TextEditor' -> 'Rectangle' -> 'IO' () +-- -- setInsertMode :: 'Ref' 'TextEditor' -> 'Bool' -> 'IO' () -- +-- showWidget :: 'Ref' 'TextEditor' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'TextEditor' -> 'IO' () -- @ diff --git a/src/Graphics/UI/FLTK/LowLevel/Tile.chs b/src/Graphics/UI/FLTK/LowLevel/Tile.chs index ee0e33fc..24d45a02 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Tile.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Tile.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Tile ( -- * Constructor tileNew, + tileCustom -- * Hierarchy -- -- $hierarchy @@ -18,7 +19,7 @@ where #include "Fl_Types.h" #include "Fl_TileC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -26,6 +27,24 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenTile_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenTile_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +tileCustom :: + Rectangle -- ^ The bounds of this Tile + -> Maybe T.Text -- ^ The Tile label + -> Maybe (Ref Tile -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Tile) -- ^ Optional custom widget functions + -> IO (Ref Tile) +tileCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Tile_New as tileNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Tile_New_WithLabel as tileNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} tileNew :: Rectangle -> Maybe T.Text -> IO (Ref Tile) @@ -37,29 +56,70 @@ tileNew rectangle l'= Just l -> tileNewWithLabel' x_pos y_pos width height l >>= toRef -{# fun Fl_Tile_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} -instance (impl ~ ( Rectangle -> IO ())) => Op (Resize ()) Tile orig impl where - runOp _ _ tile rectangle = withRef tile $ \tilePtr -> do - let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle - resize' tilePtr x_pos y_pos w_pos h_pos - {# fun Fl_Tile_position as setPosition' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' #} instance (impl ~ (Rectangle -> IO ())) => Op (SetPosition ()) Tile orig impl where runOp _ _ tile rectangle = withRef tile $ \tilePtr -> do let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle setPosition' tilePtr x_pos y_pos w_pos h_pos +{# fun Fl_Tile_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Tile orig impl where + runOp _ _ tile = withRef tile $ \tilePtr -> draw'' tilePtr +{# fun Fl_Tile_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Tile orig impl where + runOp _ _ tile = withRef tile $ \tilePtr -> drawSuper' tilePtr {#fun Fl_Tile_handle as tileHandle' { id `Ptr ()', id `CInt' } -> `Int' #} instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Tile orig impl where runOp _ _ tile event = withRef tile (\p -> tileHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Tile_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Tile orig impl where + runOp _ _ tile event = withRef tile $ \tilePtr -> handleSuper' tilePtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Tile_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Tile orig impl where + runOp _ _ tile rectangle = withRef tile $ \tilePtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' tilePtr x_pos y_pos w_pos h_pos +{# fun Fl_Tile_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Tile orig impl where + runOp _ _ tile rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef tile $ \tilePtr -> resizeSuper' tilePtr x_pos y_pos width height +{# fun Fl_Tile_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Tile orig impl where + runOp _ _ tile = withRef tile $ \tilePtr -> hide' tilePtr +{# fun Fl_Tile_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Tile orig impl where + runOp _ _ tile = withRef tile $ \tilePtr -> hideSuper' tilePtr +{# fun Fl_Tile_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Tile orig impl where + runOp _ _ tile = withRef tile $ \tilePtr -> show' tilePtr +{# fun Fl_Tile_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Tile orig impl where + runOp _ _ tile = withRef tile $ \tilePtr -> showSuper' tilePtr -- $functions -- @ --- handle :: 'Ref' 'Tile' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- draw :: 'Ref' 'Tile' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Tile' -> 'IO' () +-- +-- handle :: 'Ref' 'Tile' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Tile' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Tile' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Tile' -> 'IO' () -- -- resize :: 'Ref' 'Tile' -> 'Rectangle' -> 'IO' () -- +-- resizeSuper :: 'Ref' 'Tile' -> 'Rectangle' -> 'IO' () +-- -- setPosition :: 'Ref' 'Tile' -> 'Rectangle' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Tile' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Tile' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Timer.chs b/src/Graphics/UI/FLTK/LowLevel/Timer.chs index aba4b1a6..3395e52e 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Timer.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Timer.chs @@ -4,6 +4,7 @@ module Graphics.UI.FLTK.LowLevel.Timer ( -- * Constructor timerNew, + timerCustom, -- * Hierarchy -- -- $hierarchy @@ -19,7 +20,7 @@ where #include "Fl_Types.h" #include "Fl_TimerC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -27,6 +28,24 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenTimer_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenTimer_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +timerCustom :: + Rectangle -- ^ The bounds of this Timer + -> T.Text -- ^ The Timer label + -> Maybe (Ref Timer -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Timer) -- ^ Optional custom widget functions + -> IO (Ref Timer) +timerCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + (Just l') + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Timer_New as timerNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} timerNew :: Rectangle -> T.Text -> IO (Ref Timer) timerNew rectangle l'= @@ -51,9 +70,6 @@ instance (impl ~ (IO ())) => Op (Destroy ()) Timer orig impl where runOp _ _ win = swapRef win $ \winPtr -> do timerDestroy' winPtr return nullPtr -{#fun Fl_Timer_handle as timerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Timer orig impl where - runOp _ _ timer event = withRef timer (\p -> timerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Timer_direction as direction' { id `Ptr ()' } -> `CChar' id #} instance (impl ~ ( IO (CountDirection))) => Op (GetDirection ()) Timer orig impl where runOp _ _ adjuster = withRef adjuster $ \adjusterPtr -> direction' adjusterPtr >>= return . ccharToCountDirection @@ -72,25 +88,77 @@ instance (impl ~ ( IO (Bool))) => Op (GetSuspended ()) Timer orig impl where {# fun Fl_Timer_set_suspended as setSuspended' { id `Ptr ()', cFromBool `Bool' } -> `()' #} instance (impl ~ (Bool -> IO ())) => Op (SetSuspended ()) Timer orig impl where runOp _ _ adjuster s = withRef adjuster $ \adjusterPtr -> setSuspended' adjusterPtr s +{# fun Fl_Timer_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Timer orig impl where + runOp _ _ timer = withRef timer $ \timerPtr -> draw'' timerPtr +{# fun Fl_Timer_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Timer orig impl where + runOp _ _ timer = withRef timer $ \timerPtr -> drawSuper' timerPtr +{#fun Fl_Timer_handle as timerHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Timer orig impl where + runOp _ _ timer event = withRef timer (\p -> timerHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Timer_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Timer orig impl where + runOp _ _ timer event = withRef timer $ \timerPtr -> handleSuper' timerPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Timer_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Timer orig impl where + runOp _ _ timer rectangle = withRef timer $ \timerPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' timerPtr x_pos y_pos w_pos h_pos +{# fun Fl_Timer_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Timer orig impl where + runOp _ _ timer rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef timer $ \timerPtr -> resizeSuper' timerPtr x_pos y_pos width height +{# fun Fl_Timer_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Timer orig impl where + runOp _ _ timer = withRef timer $ \timerPtr -> hide' timerPtr +{# fun Fl_Timer_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Timer orig impl where + runOp _ _ timer = withRef timer $ \timerPtr -> hideSuper' timerPtr +{# fun Fl_Timer_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Timer orig impl where + runOp _ _ timer = withRef timer $ \timerPtr -> show' timerPtr +{# fun Fl_Timer_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Timer orig impl where + runOp _ _ timer = withRef timer $ \timerPtr -> showSuper' timerPtr -- $functions -- @ -- -- destroy :: 'Ref' 'Timer' -> 'IO' () -- --- getDirection :: 'Ref' 'Timer' -> 'IO' 'CountDirection' +-- draw :: 'Ref' 'Timer' -> 'IO' () -- --- getSuspended :: 'Ref' 'Timer' -> 'IO' 'Bool' +-- drawSuper :: 'Ref' 'Timer' -> 'IO' () -- --- getValue :: 'Ref' 'Timer' -> 'IO' 'Double' +-- getDirection :: 'Ref' 'Timer' -> 'IO' ('CountDirection') -- --- handle :: 'Ref' 'Timer' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- getSuspended :: 'Ref' 'Timer' -> 'IO' ('Bool') +-- +-- getValue :: 'Ref' 'Timer' -> 'IO' ('Double') +-- +-- handle :: 'Ref' 'Timer' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Timer' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Timer' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Timer' -> 'IO' () +-- +-- resize :: 'Ref' 'Timer' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Timer' -> 'Rectangle' -> 'IO' () -- -- setDirection :: 'Ref' 'Timer' -> 'CountDirection' -> 'IO' () -- -- setSuspended :: 'Ref' 'Timer' -> 'Bool' -> 'IO' () -- -- setValue :: 'Ref' 'Timer' -> 'Double' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Timer' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Timer' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Tree.chs b/src/Graphics/UI/FLTK/LowLevel/Tree.chs index c2682f20..5810e595 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Tree.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Tree.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.Tree ( - treeNew + treeNew, + treeCustom -- * Hierarchy -- -- $hierarchy @@ -23,6 +24,25 @@ import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +import Graphics.UI.FLTK.LowLevel.Widget + +{# fun Fl_OverriddenTree_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenTree_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +treeCustom :: + Rectangle -- ^ The bounds of this Tree + -> Maybe T.Text -- ^ The Tree label + -> Maybe (Ref Tree -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Tree) -- ^ Optional custom widget functions + -> IO (Ref Tree) +treeCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Tree_New as treeNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Tree_New_WithLabel as treeNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -40,12 +60,6 @@ instance (impl ~ (IO ())) => Op (Destroy ()) Tree orig impl where treeDestroy' treePtr return nullPtr -{# fun Fl_Tree_handle as handle' { id `Ptr ()', cFromEnum `Event' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ())) ) => Op (Handle ()) Tree orig impl where - runOp _ _ tree e = withRef tree $ \treePtr -> handle' treePtr e >>= return . successOrUnknownEvent -{# fun Fl_Tree_draw as draw' { id `Ptr ()' } -> `()' #} -instance (impl ~ ( IO ()) ) => Op (Draw ()) Tree orig impl where - runOp _ _ tree = withRef tree $ \treePtr -> draw' treePtr {# fun Fl_Tree_show_self as showSelf' { id `Ptr ()' } -> `()' #} instance (impl ~ ( IO ()) ) => Op (ShowSelf ()) Tree orig impl where runOp _ _ tree = withRef tree $ \treePtr -> showSelf' treePtr @@ -442,6 +456,40 @@ instance (impl ~ (TreeReasonType -> IO ()) ) => Op (SetCallbackReason ()) Tree {# fun Fl_Tree_callback_reason as callbackReason' { id `Ptr ()' } -> `TreeReasonType' cToEnum #} instance (impl ~ ( IO (TreeReasonType)) ) => Op (GetCallbackReason ()) Tree orig impl where runOp _ _ tree = withRef tree $ \treePtr -> callbackReason' treePtr +{# fun Fl_Tree_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Tree orig impl where + runOp _ _ tree = withRef tree $ \treePtr -> draw'' treePtr +{# fun Fl_Tree_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Tree orig impl where + runOp _ _ tree = withRef tree $ \treePtr -> drawSuper' treePtr +{#fun Fl_Tree_handle as treeHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Tree orig impl where + runOp _ _ tree event = withRef tree (\p -> treeHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Tree_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Tree orig impl where + runOp _ _ tree event = withRef tree $ \treePtr -> handleSuper' treePtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Tree_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Tree orig impl where + runOp _ _ tree rectangle = withRef tree $ \treePtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' treePtr x_pos y_pos w_pos h_pos +{# fun Fl_Tree_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Tree orig impl where + runOp _ _ tree rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef tree $ \treePtr -> resizeSuper' treePtr x_pos y_pos width height +{# fun Fl_Tree_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Tree orig impl where + runOp _ _ tree = withRef tree $ \treePtr -> hide' treePtr +{# fun Fl_Tree_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Tree orig impl where + runOp _ _ tree = withRef tree $ \treePtr -> hideSuper' treePtr +{# fun Fl_Tree_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Tree orig impl where + runOp _ _ tree = withRef tree $ \treePtr -> show' treePtr +{# fun Fl_Tree_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Tree orig impl where + runOp _ _ tree = withRef tree $ \treePtr -> showSuper' treePtr -- $functions -- @ @@ -473,6 +521,8 @@ instance (impl ~ ( IO (TreeReasonType)) ) => Op (GetCallbackReason ()) Tree orig -- -- draw :: 'Ref' 'Tree' -> 'IO' () -- +-- drawSuper :: 'Ref' 'Tree' -> 'IO' () +-- -- findItem :: 'Ref' 'Tree' -> 'T.Text' -> 'IO' ('Maybe' ('Ref' 'TreeItem')) -- -- firstSelectedItem :: 'Ref' 'Tree' -> 'IO' ('Maybe' ('Ref' 'TreeItem')) @@ -533,7 +583,13 @@ instance (impl ~ ( IO (TreeReasonType)) ) => Op (GetCallbackReason ()) Tree orig -- -- getVposition :: 'Ref' 'Tree' -> 'IO' ('Int') -- --- handle :: 'Ref' 'Tree' -> 'Event' -> 'IO' ('Int') +-- handle :: 'Ref' 'Tree' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Tree' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Tree' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Tree' -> 'IO' () -- -- insert:: ('Parent' a 'TreeItem') => 'Ref' 'Tree' -> 'Ref' a -> 'T.Text' -> 'Int' -> 'IO' ('Maybe' ('Ref' a)) -- @@ -581,6 +637,10 @@ instance (impl ~ ( IO (TreeReasonType)) ) => Op (GetCallbackReason ()) Tree orig -- -- remove :: 'Ref' 'Tree' -> 'Ref' 'TreeItem' -> 'IO' ('Either' 'TreeItemNotFound' ()) -- +-- resize :: 'Ref' 'Tree' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Tree' -> 'Rectangle' -> 'IO' () +-- -- root :: 'Ref' 'Tree' -> 'IO' ('Maybe' ('Ref' 'TreeItem')) -- -- rootLabel :: 'Ref' 'Tree' -> 'T.Text' -> 'IO' () @@ -664,6 +724,10 @@ instance (impl ~ ( IO (TreeReasonType)) ) => Op (GetCallbackReason ()) Tree orig -- showItemWithYoff :: 'Ref' 'Tree' -> 'Ref' 'TreeItem' -> 'Maybe' 'Int' -> 'IO' () -- -- showSelf :: 'Ref' 'Tree' -> 'IO' () +-- +-- showWidget :: 'Ref' 'Tree' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Tree' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs b/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs index 503661cb..1ca08f0a 100644 --- a/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs +++ b/src/Graphics/UI/FLTK/LowLevel/ValueInput.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.ValueInput ( -- * Constructor - valueInputNew + valueInputNew, + valueInputCustom -- * Hierarchy -- -- $hierarchy @@ -17,13 +18,29 @@ where #include "Fl_Types.h" #include "Fl_Value_InputC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenValue_Input_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenValue_Input_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +valueInputCustom :: + Rectangle -- ^ The bounds of this ValueInput + -> Maybe T.Text -- ^ The ValueInput label + -> Maybe (Ref ValueInput -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs ValueInput) -- ^ Optional custom widget functions + -> IO (Ref ValueInput) +valueInputCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' {# fun Fl_Value_Input_New as valueInputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Value_Input_New_WithLabel as valueInputNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -41,15 +58,9 @@ instance (impl ~ (IO ())) => Op (Destroy ()) ValueInput orig impl where runOp _ _ win = swapRef win $ \winPtr -> do valueInputDestroy' winPtr return nullPtr -{#fun Fl_Value_Input_handle as valueInputHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueInput orig impl where - runOp _ _ valueInput event = withRef valueInput (\p -> valueInputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Value_Input_soft as soft' { id `Ptr ()' } -> `Bool' cToBool #} instance (impl ~ ( IO (Bool))) => Op (GetSoft ()) ValueInput orig impl where runOp _ _ value_input = withRef value_input $ \value_inputPtr -> soft' value_inputPtr -{# fun Fl_Value_Input_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' #} -instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ValueInput orig impl where - runOp _ _ value_input rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef value_input $ \value_inputPtr -> resize' value_inputPtr x_pos' y_pos' width' height' {# fun Fl_Value_Input_set_soft as setSoft' { id `Ptr ()',cFromBool `Bool' } -> `()' #} instance (impl ~ (Bool-> IO ())) => Op (SetSoft ()) ValueInput orig impl where runOp _ _ value_input s = withRef value_input $ \value_inputPtr -> setSoft' value_inputPtr s @@ -79,10 +90,49 @@ instance (impl ~ ( IO (Color))) => Op (GetTextcolor ()) ValueInput orig impl whe instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueInput orig impl where runOp _ _ value_input (Color v) = withRef value_input $ \value_inputPtr -> setTextcolor' value_inputPtr (fromIntegral v) +{# fun Fl_Value_Input_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) ValueInput orig impl where + runOp _ _ valueInput = withRef valueInput $ \valueInputPtr -> draw'' valueInputPtr +{# fun Fl_Value_Input_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) ValueInput orig impl where + runOp _ _ valueInput = withRef valueInput $ \valueInputPtr -> drawSuper' valueInputPtr +{#fun Fl_Value_Input_handle as valueInputHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueInput orig impl where + runOp _ _ valueInput event = withRef valueInput (\p -> valueInputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Value_Input_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) ValueInput orig impl where + runOp _ _ valueInput event = withRef valueInput $ \valueInputPtr -> handleSuper' valueInputPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Value_Input_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ValueInput orig impl where + runOp _ _ valueInput rectangle = withRef valueInput $ \valueInputPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' valueInputPtr x_pos y_pos w_pos h_pos +{# fun Fl_Value_Input_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) ValueInput orig impl where + runOp _ _ valueInput rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef valueInput $ \valueInputPtr -> resizeSuper' valueInputPtr x_pos y_pos width height +{# fun Fl_Value_Input_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) ValueInput orig impl where + runOp _ _ valueInput = withRef valueInput $ \valueInputPtr -> hide' valueInputPtr +{# fun Fl_Value_Input_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) ValueInput orig impl where + runOp _ _ valueInput = withRef valueInput $ \valueInputPtr -> hideSuper' valueInputPtr +{# fun Fl_Value_Input_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) ValueInput orig impl where + runOp _ _ valueInput = withRef valueInput $ \valueInputPtr -> show' valueInputPtr +{# fun Fl_Value_Input_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) ValueInput orig impl where + runOp _ _ valueInput = withRef valueInput $ \valueInputPtr -> showSuper' valueInputPtr + -- $functions -- @ -- destroy :: 'Ref' 'ValueInput' -> 'IO' () -- +-- draw :: 'Ref' 'ValueInput' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'ValueInput' -> 'IO' () +-- -- getShortcut :: 'Ref' 'ValueInput' -> 'IO' ('Maybe' 'ShortcutKeySequence') -- -- getSoft :: 'Ref' 'ValueInput' -> 'IO' ('Bool') @@ -93,10 +143,18 @@ instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueInput orig impl -- -- getTextsize :: 'Ref' 'ValueInput' -> 'IO' ('FontSize') -- --- handle :: 'Ref' 'ValueInput' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handle :: 'Ref' 'ValueInput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'ValueInput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'ValueInput' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'ValueInput' -> 'IO' () -- -- resize :: 'Ref' 'ValueInput' -> 'Rectangle' -> 'IO' () -- +-- resizeSuper :: 'Ref' 'ValueInput' -> 'Rectangle' -> 'IO' () +-- -- setShortcut :: 'Ref' 'ValueInput' -> 'ShortcutKeySequence' -> 'IO' () -- -- setSoft :: 'Ref' 'ValueInput' -> 'Bool'>- 'IO' () @@ -106,6 +164,14 @@ instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueInput orig impl -- setTextfont :: 'Ref' 'ValueInput' -> 'Font' -> 'IO' () -- -- setTextsize :: 'Ref' 'ValueInput' -> 'FontSize' -> 'IO' () +-- +-- showWidget :: 'Ref' 'ValueInput' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'ValueInput' -> 'IO' () + +-- Available in FLTK 1.3.4 only: + + -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs b/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs index 4c4e5d63..4f0cd525 100644 --- a/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs +++ b/src/Graphics/UI/FLTK/LowLevel/ValueOutput.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.ValueOutput ( -- * Constructor - valueOutputNew + valueOutputNew, + valueOutputCustom -- * Hierarchy -- -- $hierarchy @@ -17,13 +18,30 @@ where #include "Fl_Types.h" #include "Fl_Value_OutputC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenValue_Output_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenValue_Output_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +valueOutputCustom :: + Rectangle -- ^ The bounds of this ValueOutput + -> Maybe T.Text -- ^ The ValueOutput label + -> Maybe (Ref ValueOutput -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs ValueOutput) -- ^ Optional custom widget functions + -> IO (Ref ValueOutput) +valueOutputCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Value_Output_New as valueOutputNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Value_Output_New_WithLabel as valueOutputNewWithLabel' { `Int',`Int',`Int',`Int',unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -42,15 +60,9 @@ instance (impl ~ IO ()) => Op (Destroy ()) ValueOutput orig impl where valueOutputDestroy' winPtr return nullPtr -{#fun Fl_Value_Output_handle as valueOutputHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueOutput orig impl where - runOp _ _ valueOutput event = withRef valueOutput (\p -> valueOutputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Value_Output_soft as soft' { id `Ptr ()' } -> `Bool' cToBool #} instance (impl ~ ( IO (Bool))) => Op (GetSoft ()) ValueOutput orig impl where runOp _ _ value_input = withRef value_input $ \value_inputPtr -> soft' value_inputPtr -{# fun Fl_Value_Output_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' #} -instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ValueOutput orig impl where - runOp _ _ value_input rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in withRef value_input $ \value_inputPtr -> resize' value_inputPtr x_pos' y_pos' width' height' {# fun Fl_Value_Output_set_soft as setSoft' { id `Ptr ()',cFromBool `Bool' } -> `()' #} instance (impl ~ (Bool-> IO ())) => Op (SetSoft ()) ValueOutput orig impl where runOp _ _ value_input s = withRef value_input $ \value_inputPtr -> setSoft' value_inputPtr s @@ -72,11 +84,49 @@ instance (impl ~ ( IO (Color))) => Op (GetTextcolor ()) ValueOutput orig impl wh {# fun Fl_Value_Output_set_textcolor as setTextcolor' { id `Ptr ()', id `CInt' } -> `()' #} instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueOutput orig impl where runOp _ _ value_input (Color v) = withRef value_input $ \value_inputPtr -> setTextcolor' value_inputPtr (fromIntegral v) +{# fun Fl_Value_Output_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) ValueOutput orig impl where + runOp _ _ valueOutput = withRef valueOutput $ \valueOutputPtr -> draw'' valueOutputPtr +{# fun Fl_Value_Output_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) ValueOutput orig impl where + runOp _ _ valueOutput = withRef valueOutput $ \valueOutputPtr -> drawSuper' valueOutputPtr +{#fun Fl_Value_Output_handle as valueOutputHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueOutput orig impl where + runOp _ _ valueOutput event = withRef valueOutput (\p -> valueOutputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Value_Output_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) ValueOutput orig impl where + runOp _ _ valueOutput event = withRef valueOutput $ \valueOutputPtr -> handleSuper' valueOutputPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Value_Output_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ValueOutput orig impl where + runOp _ _ valueOutput rectangle = withRef valueOutput $ \valueOutputPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' valueOutputPtr x_pos y_pos w_pos h_pos +{# fun Fl_Value_Output_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) ValueOutput orig impl where + runOp _ _ valueOutput rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef valueOutput $ \valueOutputPtr -> resizeSuper' valueOutputPtr x_pos y_pos width height +{# fun Fl_Value_Output_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) ValueOutput orig impl where + runOp _ _ valueOutput = withRef valueOutput $ \valueOutputPtr -> hide' valueOutputPtr +{# fun Fl_Value_Output_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) ValueOutput orig impl where + runOp _ _ valueOutput = withRef valueOutput $ \valueOutputPtr -> hideSuper' valueOutputPtr +{# fun Fl_Value_Output_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) ValueOutput orig impl where + runOp _ _ valueOutput = withRef valueOutput $ \valueOutputPtr -> show' valueOutputPtr +{# fun Fl_Value_Output_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) ValueOutput orig impl where + runOp _ _ valueOutput = withRef valueOutput $ \valueOutputPtr -> showSuper' valueOutputPtr -- $functions -- @ -- destroy :: 'Ref' 'ValueOutput' -> 'IO' () -- +-- draw :: 'Ref' 'ValueOutput' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'ValueOutput' -> 'IO' () +-- -- getSoft :: 'Ref' 'ValueOutput' -> 'IO' ('Bool') -- -- getTextcolor :: 'Ref' 'ValueOutput' -> 'IO' ('Color') @@ -85,10 +135,18 @@ instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueOutput orig imp -- -- getTextsize :: 'Ref' 'ValueOutput' -> 'IO' ('FontSize') -- --- handle :: 'Ref' 'ValueOutput' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- handle :: 'Ref' 'ValueOutput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'ValueOutput' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'ValueOutput' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'ValueOutput' -> 'IO' () -- -- resize :: 'Ref' 'ValueOutput' -> 'Rectangle' -> 'IO' () -- +-- resizeSuper :: 'Ref' 'ValueOutput' -> 'Rectangle' -> 'IO' () +-- -- setSoft :: 'Ref' 'ValueOutput' -> 'Bool'>- 'IO' () -- -- setTextcolor :: 'Ref' 'ValueOutput' -> 'Color' -> 'IO' () @@ -96,6 +154,10 @@ instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueOutput orig imp -- setTextfont :: 'Ref' 'ValueOutput' -> 'Font' -> 'IO' () -- -- setTextsize :: 'Ref' 'ValueOutput' -> 'FontSize' -> 'IO' () +-- +-- showWidget :: 'Ref' 'ValueOutput' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'ValueOutput' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs b/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs index 23a5f4f1..a601d51d 100644 --- a/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs +++ b/src/Graphics/UI/FLTK/LowLevel/ValueSlider.chs @@ -3,7 +3,8 @@ module Graphics.UI.FLTK.LowLevel.ValueSlider ( -- * Constructor - valueSliderNew + valueSliderNew, + valueSliderCustom -- * Hierarchy -- -- $hierarchy @@ -17,7 +18,7 @@ where #include "Fl_Types.h" #include "Fl_Value_SliderC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils @@ -25,6 +26,24 @@ import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenValue_Slider_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenValue_Slider_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +valueSliderCustom :: + Rectangle -- ^ The bounds of this ValueSlider + -> Maybe T.Text -- ^ The ValueSlider label + -> Maybe (Ref ValueSlider -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs ValueSlider) -- ^ Optional custom widget functions + -> IO (Ref ValueSlider) +valueSliderCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + + {# fun Fl_Value_Slider_New as valueSliderNew' { `Int',`Int',`Int',`Int' } -> `Ptr ()' id #} {# fun Fl_Value_Slider_New_WithLabel as valueSliderNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} valueSliderNew :: Rectangle -> Maybe T.Text -> IO (Ref ValueSlider) @@ -48,9 +67,6 @@ instance (impl ~ (IO ())) => Op (Destroy ()) ValueSlider orig impl where runOp _ _ win = swapRef win $ \winPtr -> do valueSliderDestroy' winPtr return nullPtr -{#fun Fl_Value_Slider_handle as valueSliderHandle' { id `Ptr ()', id `CInt' } -> `Int' #} -instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueSlider orig impl where - runOp _ _ valueSlider event = withRef valueSlider (\p -> valueSliderHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Value_Slider_textfont as textfont' { id `Ptr ()' } -> `Font' cToFont #} instance (impl ~ ( IO (Font))) => Op (GetTextfont ()) ValueSlider orig impl where runOp _ _ value_slider = withRef value_slider $ \value_sliderPtr -> textfont' value_sliderPtr @@ -69,25 +85,76 @@ instance (impl ~ ( IO (Color))) => Op (GetTextcolor ()) ValueSlider orig impl wh {# fun Fl_Value_Slider_set_textcolor as setTextcolor' { id `Ptr ()',cFromColor `Color' } -> `()' #} instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) ValueSlider orig impl where runOp _ _ value_slider s = withRef value_slider $ \value_sliderPtr -> setTextcolor' value_sliderPtr s +{# fun Fl_Value_Slider_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) ValueSlider orig impl where + runOp _ _ valueSlider = withRef valueSlider $ \valueSliderPtr -> draw'' valueSliderPtr +{# fun Fl_Value_Slider_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) ValueSlider orig impl where + runOp _ _ valueSlider = withRef valueSlider $ \valueSliderPtr -> drawSuper' valueSliderPtr +{#fun Fl_Value_Slider_handle as valueSliderHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) ValueSlider orig impl where + runOp _ _ valueSlider event = withRef valueSlider (\p -> valueSliderHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Value_Slider_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) ValueSlider orig impl where + runOp _ _ valueSlider event = withRef valueSlider $ \valueSliderPtr -> handleSuper' valueSliderPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Value_Slider_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) ValueSlider orig impl where + runOp _ _ valueSlider rectangle = withRef valueSlider $ \valueSliderPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' valueSliderPtr x_pos y_pos w_pos h_pos +{# fun Fl_Value_Slider_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) ValueSlider orig impl where + runOp _ _ valueSlider rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef valueSlider $ \valueSliderPtr -> resizeSuper' valueSliderPtr x_pos y_pos width height +{# fun Fl_Value_Slider_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) ValueSlider orig impl where + runOp _ _ valueSlider = withRef valueSlider $ \valueSliderPtr -> hide' valueSliderPtr +{# fun Fl_Value_Slider_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) ValueSlider orig impl where + runOp _ _ valueSlider = withRef valueSlider $ \valueSliderPtr -> hideSuper' valueSliderPtr +{# fun Fl_Value_Slider_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) ValueSlider orig impl where + runOp _ _ valueSlider = withRef valueSlider $ \valueSliderPtr -> show' valueSliderPtr +{# fun Fl_Value_Slider_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) ValueSlider orig impl where + runOp _ _ valueSlider = withRef valueSlider $ \valueSliderPtr -> showSuper' valueSliderPtr -- $functions -- @ --- -- destroy :: 'Ref' 'ValueSlider' -> 'IO' () -- --- getTextcolor :: 'Ref' 'ValueSlider' -> 'IO' 'Color' +-- draw :: 'Ref' 'ValueSlider' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'ValueSlider' -> 'IO' () +-- +-- getTextcolor :: 'Ref' 'ValueSlider' -> 'IO' ('Color') +-- +-- getTextfont :: 'Ref' 'ValueSlider' -> 'IO' ('Font') +-- +-- getTextsize :: 'Ref' 'ValueSlider' -> 'IO' ('FontSize') -- --- getTextfont :: 'Ref' 'ValueSlider' -> 'IO' 'Font' +-- handle :: 'Ref' 'ValueSlider' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- getTextsize :: 'Ref' 'ValueSlider' -> 'IO' 'FontSize' +-- handleSuper :: 'Ref' 'ValueSlider' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- --- handle :: 'Ref' 'ValueSlider' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ())) +-- hide :: 'Ref' 'ValueSlider' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'ValueSlider' -> 'IO' () +-- +-- resize :: 'Ref' 'ValueSlider' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'ValueSlider' -> 'Rectangle' -> 'IO' () -- -- setTextcolor :: 'Ref' 'ValueSlider' -> 'Color' -> 'IO' () -- -- setTextfont :: 'Ref' 'ValueSlider' -> 'Font' -> 'IO' () -- -- setTextsize :: 'Ref' 'ValueSlider' -> 'FontSize' -> 'IO' () +-- +-- showWidget :: 'Ref' 'ValueSlider' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'ValueSlider' -> 'IO' () -- @ -- $hierarchy diff --git a/src/Graphics/UI/FLTK/LowLevel/Wizard.chs b/src/Graphics/UI/FLTK/LowLevel/Wizard.chs index 0ffa296a..29eb728c 100644 --- a/src/Graphics/UI/FLTK/LowLevel/Wizard.chs +++ b/src/Graphics/UI/FLTK/LowLevel/Wizard.chs @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.Wizard ( - wizardNew + wizardNew, + wizardCustom -- * Hierarchy -- -- $hierarchy @@ -16,12 +17,30 @@ where #include "Fl_Types.h" #include "Fl_WizardC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) - +import Graphics.UI.FLTK.LowLevel.Fl_Enumerations +import Graphics.UI.FLTK.LowLevel.Widget import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import qualified Data.Text as T +{# fun Fl_OverriddenWizard_New_WithLabel as overriddenWidgetNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text', id `Ptr ()'} -> `Ptr ()' id #} +{# fun Fl_OverriddenWizard_New as overriddenWidgetNew' { `Int',`Int',`Int',`Int', id `Ptr ()'} -> `Ptr ()' id #} +wizardCustom :: + Rectangle -- ^ The bounds of this Wizard + -> Maybe T.Text -- ^ The Wizard label + -> Maybe (Ref Wizard -> IO ()) -- ^ Optional custom drawing function + -> Maybe (CustomWidgetFuncs Wizard) -- ^ Optional custom widget functions + -> IO (Ref Wizard) +wizardCustom rectangle l' draw' funcs' = + widgetMaker + rectangle + l' + draw' + funcs' + overriddenWidgetNew' + overriddenWidgetNewWithLabel' + {# fun Fl_Wizard_New as wizardNew' { `Int',`Int', `Int', `Int'} -> `Ptr ()' id #} {# fun Fl_Wizard_New_WithLabel as wizardNewWithLabel' { `Int',`Int',`Int',`Int', unsafeToCString `T.Text'} -> `Ptr ()' id #} @@ -53,19 +72,73 @@ instance (Parent a Widget, impl ~ ( Maybe ( Ref a ) -> IO ())) => Op (SetValue ( instance (impl ~ (IO (Maybe (Ref Widget)))) => Op (GetValue ()) Wizard orig impl where runOp _ _ wizard = withRef wizard $ \wizardPtr -> wizardValue' wizardPtr >>= toMaybeRef +{# fun Fl_Wizard_draw as draw'' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Draw ()) Wizard orig impl where + runOp _ _ wizard = withRef wizard $ \wizardPtr -> draw'' wizardPtr +{# fun Fl_Wizard_draw_super as drawSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (DrawSuper ()) Wizard orig impl where + runOp _ _ wizard = withRef wizard $ \wizardPtr -> drawSuper' wizardPtr +{#fun Fl_Wizard_handle as wizardHandle' { id `Ptr ()', id `CInt' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Wizard orig impl where + runOp _ _ wizard event = withRef wizard (\p -> wizardHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent +{# fun Fl_Wizard_handle_super as handleSuper' { id `Ptr ()',`Int' } -> `Int' #} +instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Wizard orig impl where + runOp _ _ wizard event = withRef wizard $ \wizardPtr -> handleSuper' wizardPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent +{# fun Fl_Wizard_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Wizard orig impl where + runOp _ _ wizard rectangle = withRef wizard $ \wizardPtr -> do + let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle + resize' wizardPtr x_pos y_pos w_pos h_pos +{# fun Fl_Wizard_resize_super as resizeSuper' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} +instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Wizard orig impl where + runOp _ _ wizard rectangle = + let (x_pos, y_pos, width, height) = fromRectangle rectangle + in withRef wizard $ \wizardPtr -> resizeSuper' wizardPtr x_pos y_pos width height +{# fun Fl_Wizard_hide as hide' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (Hide ()) Wizard orig impl where + runOp _ _ wizard = withRef wizard $ \wizardPtr -> hide' wizardPtr +{# fun Fl_Wizard_hide_super as hideSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (HideSuper ()) Wizard orig impl where + runOp _ _ wizard = withRef wizard $ \wizardPtr -> hideSuper' wizardPtr +{# fun Fl_Wizard_show as show' { id `Ptr ()' } -> `()' #} +instance (impl ~ ( IO ())) => Op (ShowWidget ()) Wizard orig impl where + runOp _ _ wizard = withRef wizard $ \wizardPtr -> show' wizardPtr +{# fun Fl_Wizard_show_super as showSuper' { id `Ptr ()' } -> `()' supressWarningAboutRes #} +instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Wizard orig impl where + runOp _ _ wizard = withRef wizard $ \wizardPtr -> showSuper' wizardPtr -- $functions -- @ -- -- destroy :: 'Ref' 'Wizard' -> 'IO' () -- +-- draw :: 'Ref' 'Wizard' -> 'IO' () +-- +-- drawSuper :: 'Ref' 'Wizard' -> 'IO' () +-- -- getValue :: 'Ref' 'Wizard' -> 'IO' ('Maybe' ('Ref' 'Widget')) -- +-- handle :: 'Ref' 'Wizard' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- handleSuper :: 'Ref' 'Wizard' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) +-- +-- hide :: 'Ref' 'Wizard' -> 'IO' () +-- +-- hideSuper :: 'Ref' 'Wizard' -> 'IO' () +-- -- next :: 'Ref' 'Wizard' -> 'IO' () -- -- prev :: 'Ref' 'Wizard' -> 'IO' () -- +-- resize :: 'Ref' 'Wizard' -> 'Rectangle' -> 'IO' () +-- +-- resizeSuper :: 'Ref' 'Wizard' -> 'Rectangle' -> 'IO' () +-- -- setValue:: ('Parent' a 'Widget') => 'Ref' 'Wizard' -> 'Maybe' ( 'Ref' a ) -> 'IO' () +-- +-- showWidget :: 'Ref' 'Wizard' -> 'IO' () +-- +-- showWidgetSuper :: 'Ref' 'Wizard' -> 'IO' () -- @ -- $hierarchy