summaryrefslogtreecommitdiff
path: root/src/c_fl_group.cpp
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-05-01 22:56:51 +1000
committerJed Barber <jjbarber@y7mail.com>2017-05-01 22:56:51 +1000
commitfbdef14a42388934067427854b6f5559bef31e8d (patch)
treea6d8cd4df18aaeb8b5293e60d0c0120abbcd035c /src/c_fl_group.cpp
parent727cd771facf506910ddbb63532b3b6af7fb1b77 (diff)
Draw method implemented for Groups, Menus, although Menus are now no longer abstract even though they should be
Diffstat (limited to 'src/c_fl_group.cpp')
-rw-r--r--src/c_fl_group.cpp62
1 files changed, 51 insertions, 11 deletions
diff --git a/src/c_fl_group.cpp b/src/c_fl_group.cpp
index 9ea2764..4546be0 100644
--- a/src/c_fl_group.cpp
+++ b/src/c_fl_group.cpp
@@ -6,64 +6,104 @@
#include "c_fl_widget.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Group : public Fl_Group {
+ public:
+ using Fl_Group::Fl_Group;
+ friend void group_set_draw_hook(GROUP g, void * d);
+ friend void fl_group_draw(GROUP g);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Group::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Group::real_draw() {
+ Fl_Group::draw();
+}
+
+
+void group_set_draw_hook(GROUP g, void * d) {
+ reinterpret_cast<My_Group*>(g)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_group_draw(GROUP g) {
+ reinterpret_cast<My_Group*>(g)->real_draw();
+}
+
+
+
+
GROUP new_fl_group(int x, int y, int w, int h, char* label) {
- Fl_Group *g = new Fl_Group(x, y, w, h, label);
+ My_Group *g = new My_Group(x, y, w, h, label);
return g;
}
void free_fl_group(GROUP g) {
- delete reinterpret_cast<Fl_Group*>(g);
+ delete reinterpret_cast<My_Group*>(g);
}
void fl_group_end(GROUP g) {
- reinterpret_cast<Fl_Group*>(g)->end();
+ reinterpret_cast<My_Group*>(g)->end();
}
void fl_group_add(GROUP g, WIDGET item) {
- reinterpret_cast<Fl_Group*>(g)->add(reinterpret_cast<Fl_Widget*>(item));
+ reinterpret_cast<My_Group*>(g)->add(reinterpret_cast<Fl_Widget*>(item));
}
int fl_group_find(GROUP g, WIDGET item) {
- return reinterpret_cast<Fl_Group*>(g)->find(reinterpret_cast<Fl_Widget*>(item));
+ return reinterpret_cast<My_Group*>(g)->find(reinterpret_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);
+ reinterpret_cast<My_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), place);
}
void fl_group_remove(GROUP g, WIDGET item) {
- reinterpret_cast<Fl_Group*>(g)->remove(reinterpret_cast<Fl_Widget*>(item));
+ reinterpret_cast<My_Group*>(g)->remove(reinterpret_cast<Fl_Widget*>(item));
}
void fl_group_remove2(GROUP g, int place) {
- reinterpret_cast<Fl_Group*>(g)->remove(place);
+ reinterpret_cast<My_Group*>(g)->remove(place);
}
void fl_group_resizable(GROUP g, WIDGET item) {
- reinterpret_cast<Fl_Group*>(g)->resizable(reinterpret_cast<Fl_Widget*>(item));
+ reinterpret_cast<My_Group*>(g)->resizable(reinterpret_cast<Fl_Widget*>(item));
}
int fl_group_children(GROUP g) {
- return reinterpret_cast<Fl_Group*>(g)->children();
+ return reinterpret_cast<My_Group*>(g)->children();
}
void * fl_group_child(GROUP g, int place) {
- return reinterpret_cast<Fl_Group*>(g)->child(place);
+ return reinterpret_cast<My_Group*>(g)->child(place);
}