From c300ec0f456da533291b10db57d27a9c3bb8de9f Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Mon, 13 Jan 2025 15:47:35 +1300 Subject: Filled holes in Group binding API --- src/c_fl_group.cpp | 90 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 24 deletions(-) (limited to 'src/c_fl_group.cpp') 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(g); -} - - - - -void fl_group_end(GROUP g) { - reinterpret_cast(g)->end(); + delete static_cast(g); } void fl_group_add(GROUP g, WIDGET item) { - reinterpret_cast(g)->add(reinterpret_cast(item)); + static_cast(g)->add(static_cast(item)); } void fl_group_insert(GROUP g, WIDGET item, int place) { - reinterpret_cast(g)->insert(*(reinterpret_cast(item)), place); + static_cast(g)->insert(*(static_cast(item)), place); } void fl_group_insert2(GROUP g, WIDGET item, WIDGET before) { - reinterpret_cast(g)->insert(*(reinterpret_cast(item)), reinterpret_cast(before)); + static_cast(g)->insert(*(static_cast(item)), static_cast(before)); } void fl_group_remove(GROUP g, WIDGET item) { - reinterpret_cast(g)->remove(reinterpret_cast(item)); + static_cast(g)->remove(static_cast(item)); } void fl_group_remove2(GROUP g, int place) { - reinterpret_cast(g)->remove(place); + static_cast(g)->remove(place); } void * fl_group_child(GROUP g, int place) { - return reinterpret_cast(g)->child(place); + return static_cast(g)->child(place); } int fl_group_find(GROUP g, WIDGET item) { - return reinterpret_cast(g)->find(reinterpret_cast(item)); + return static_cast(g)->find(static_cast(item)); } int fl_group_children(GROUP g) { - return reinterpret_cast(g)->children(); + return static_cast(g)->children(); } unsigned int fl_group_get_clip_children(GROUP g) { - return reinterpret_cast(g)->clip_children(); + return static_cast(g)->clip_children(); } void fl_group_set_clip_children(GROUP g, int c) { - reinterpret_cast(g)->clip_children(c); + static_cast(g)->clip_children(c); } +void fl_group_add_resizable(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast(w)); + static_cast(g)->add_resizable(ref); +} + void * fl_group_get_resizable(GROUP g) { - return reinterpret_cast(g)->resizable(); + return static_cast(g)->resizable(); } void fl_group_set_resizable(GROUP g, WIDGET item) { - reinterpret_cast(g)->resizable(reinterpret_cast(item)); + static_cast(g)->resizable(static_cast(item)); } void fl_group_init_sizes(GROUP g) { - reinterpret_cast(g)->init_sizes(); + static_cast(g)->init_sizes(); +} + +void fl_group_resize(GROUP g, int x, int y, int w, int h) { + static_cast(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(g)); + Fl_Group::current(static_cast(g)); +} + +void fl_group_begin(GROUP g) { + static_cast(g)->begin(); +} + +void fl_group_end(GROUP g) { + static_cast(g)->end(); } void fl_group_draw(GROUP g) { - reinterpret_cast(g)->Fl_Group::draw(); + static_cast(g)->Fl_Group::draw(); +} + +void fl_group_draw_child(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast(w)); + (static_cast(g)->*(&Friend_Group::draw_child))(ref); +} + +void fl_group_draw_children(GROUP g) { + (static_cast(g)->*(&Friend_Group::draw_children))(); +} + +void fl_group_draw_outside_label(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast(w)); + (static_cast(g)->*(&Friend_Group::draw_outside_label))(ref); +} + +void fl_group_update_child(GROUP g, WIDGET w) { + Fl_Widget &ref = *(static_cast(w)); + (static_cast(g)->*(&Friend_Group::update_child))(ref); } int fl_group_handle(GROUP g, int e) { - return reinterpret_cast(g)->Fl_Group::handle(e); + return static_cast(g)->Fl_Group::handle(e); } -- cgit