diff options
Diffstat (limited to 'src/c_fl_group.cpp')
-rw-r--r-- | src/c_fl_group.cpp | 90 |
1 files changed, 66 insertions, 24 deletions
diff --git a/src/c_fl_group.cpp b/src/c_fl_group.cpp index 890fd9a..62bee03 100644 --- a/src/c_fl_group.cpp +++ b/src/c_fl_group.cpp @@ -20,6 +20,19 @@ extern "C" int widget_handle_hook(void * ud, int e); +// Non-friend protected access + +class Friend_Group : Fl_Group { +public: + using Fl_Group::draw_child; + using Fl_Group::draw_children; + using Fl_Group::draw_outside_label; + using Fl_Group::update_child; +}; + + + + // Attaching all relevant hooks and friends class My_Group : public Fl_Group { @@ -52,78 +65,80 @@ GROUP new_fl_group(int x, int y, int w, int h, char* label) { } void free_fl_group(GROUP g) { - delete reinterpret_cast<My_Group*>(g); -} - - - - -void fl_group_end(GROUP g) { - reinterpret_cast<Fl_Group*>(g)->end(); + delete static_cast<My_Group*>(g); } void fl_group_add(GROUP g, WIDGET item) { - reinterpret_cast<Fl_Group*>(g)->add(reinterpret_cast<Fl_Widget*>(item)); + static_cast<Fl_Group*>(g)->add(static_cast<Fl_Widget*>(item)); } void fl_group_insert(GROUP g, WIDGET item, int place) { - reinterpret_cast<Fl_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), place); + static_cast<Fl_Group*>(g)->insert(*(static_cast<Fl_Widget*>(item)), place); } void fl_group_insert2(GROUP g, WIDGET item, WIDGET before) { - reinterpret_cast<Fl_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), reinterpret_cast<Fl_Widget*>(before)); + static_cast<Fl_Group*>(g)->insert(*(static_cast<Fl_Widget*>(item)), static_cast<Fl_Widget*>(before)); } void fl_group_remove(GROUP g, WIDGET item) { - reinterpret_cast<Fl_Group*>(g)->remove(reinterpret_cast<Fl_Widget*>(item)); + static_cast<Fl_Group*>(g)->remove(static_cast<Fl_Widget*>(item)); } void fl_group_remove2(GROUP g, int place) { - reinterpret_cast<Fl_Group*>(g)->remove(place); + static_cast<Fl_Group*>(g)->remove(place); } void * fl_group_child(GROUP g, int place) { - return reinterpret_cast<Fl_Group*>(g)->child(place); + return static_cast<Fl_Group*>(g)->child(place); } int fl_group_find(GROUP g, WIDGET item) { - return reinterpret_cast<Fl_Group*>(g)->find(reinterpret_cast<Fl_Widget*>(item)); + return static_cast<Fl_Group*>(g)->find(static_cast<Fl_Widget*>(item)); } int fl_group_children(GROUP g) { - return reinterpret_cast<Fl_Group*>(g)->children(); + return static_cast<Fl_Group*>(g)->children(); } unsigned int fl_group_get_clip_children(GROUP g) { - return reinterpret_cast<Fl_Group*>(g)->clip_children(); + return static_cast<Fl_Group*>(g)->clip_children(); } void fl_group_set_clip_children(GROUP g, int c) { - reinterpret_cast<Fl_Group*>(g)->clip_children(c); + static_cast<Fl_Group*>(g)->clip_children(c); } +void fl_group_add_resizable(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast<Fl_Widget*>(w)); + static_cast<Fl_Group*>(g)->add_resizable(ref); +} + void * fl_group_get_resizable(GROUP g) { - return reinterpret_cast<Fl_Group*>(g)->resizable(); + return static_cast<Fl_Group*>(g)->resizable(); } void fl_group_set_resizable(GROUP g, WIDGET item) { - reinterpret_cast<Fl_Group*>(g)->resizable(reinterpret_cast<Fl_Widget*>(item)); + static_cast<Fl_Group*>(g)->resizable(static_cast<Fl_Widget*>(item)); } void fl_group_init_sizes(GROUP g) { - reinterpret_cast<Fl_Group*>(g)->init_sizes(); + static_cast<Fl_Group*>(g)->init_sizes(); +} + +void fl_group_resize(GROUP g, int x, int y, int w, int h) { + static_cast<Fl_Group*>(g)->resize(x, y, w, h); } @@ -134,18 +149,45 @@ void * fl_group_get_current() { } void fl_group_set_current(GROUP g) { - Fl_Group::current(reinterpret_cast<Fl_Group*>(g)); + Fl_Group::current(static_cast<Fl_Group*>(g)); +} + +void fl_group_begin(GROUP g) { + static_cast<Fl_Group*>(g)->begin(); +} + +void fl_group_end(GROUP g) { + static_cast<Fl_Group*>(g)->end(); } void fl_group_draw(GROUP g) { - reinterpret_cast<My_Group*>(g)->Fl_Group::draw(); + static_cast<My_Group*>(g)->Fl_Group::draw(); +} + +void fl_group_draw_child(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast<Fl_Widget*>(w)); + (static_cast<Fl_Group*>(g)->*(&Friend_Group::draw_child))(ref); +} + +void fl_group_draw_children(GROUP g) { + (static_cast<Fl_Group*>(g)->*(&Friend_Group::draw_children))(); +} + +void fl_group_draw_outside_label(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast<Fl_Widget*>(w)); + (static_cast<Fl_Group*>(g)->*(&Friend_Group::draw_outside_label))(ref); +} + +void fl_group_update_child(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast<Fl_Widget*>(w)); + (static_cast<Fl_Group*>(g)->*(&Friend_Group::update_child))(ref); } int fl_group_handle(GROUP g, int e) { - return reinterpret_cast<My_Group*>(g)->Fl_Group::handle(e); + return static_cast<My_Group*>(g)->Fl_Group::handle(e); } |