summaryrefslogtreecommitdiff
path: root/body/c_fl_tabs.cpp
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-21 21:04:54 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-21 21:04:54 +1300
commitb4438b2fbe895694be98e6e8426103deefc51448 (patch)
tree760d86cd7c06420a91dad102cc9546aee73146fc /body/c_fl_tabs.cpp
parenta4703a65b015140cd4a7a985db66264875ade734 (diff)
Split public API and private implementation files into different directories
Diffstat (limited to 'body/c_fl_tabs.cpp')
-rw-r--r--body/c_fl_tabs.cpp111
1 files changed, 111 insertions, 0 deletions
diff --git a/body/c_fl_tabs.cpp b/body/c_fl_tabs.cpp
new file mode 100644
index 0000000..df7327f
--- /dev/null
+++ b/body/c_fl_tabs.cpp
@@ -0,0 +1,111 @@
+
+
+// Programmed by Jedidiah Barber
+// Released into the public domain
+
+
+#include <FL/Fl_Tabs.H>
+#include "c_fl_tabs.h"
+
+
+
+
+// Exports from Ada
+
+extern "C" void widget_draw_hook(void * ud);
+extern "C" int widget_handle_hook(void * ud, int e);
+
+
+
+
+// Non-friend protected access
+
+class Friend_Tabs : Fl_Tabs {
+public:
+ using Fl_Tabs::redraw_tabs;
+};
+
+
+
+
+// Attaching all relevant hooks and friends
+
+class My_Tabs : public Fl_Tabs {
+public:
+ using Fl_Tabs::Fl_Tabs;
+
+ friend void fl_tabs_draw(TABS t);
+ friend int fl_tabs_handle(TABS t, int e);
+
+ void draw();
+ int handle(int e);
+};
+
+void My_Tabs::draw() {
+ widget_draw_hook(this->user_data());
+}
+
+int My_Tabs::handle(int e) {
+ return widget_handle_hook(this->user_data(), e);
+}
+
+
+
+
+// Flattened C API
+
+TABS new_fl_tabs(int x, int y, int w, int h, char* label) {
+ My_Tabs *t = new My_Tabs(x, y, w, h, label);
+ return t;
+}
+
+void free_fl_tabs(TABS t) {
+ delete static_cast<My_Tabs*>(t);
+}
+
+
+
+
+void fl_tabs_client_area(TABS t, int * x, int * y, int * w, int * h, int i) {
+ static_cast<Fl_Tabs*>(t)->client_area(*x,*y,*w,*h,i);
+}
+
+
+
+
+void * fl_tabs_get_push(TABS t) {
+ return static_cast<Fl_Tabs*>(t)->push();
+}
+
+void fl_tabs_set_push(TABS t, void * w) {
+ static_cast<Fl_Tabs*>(t)->push(static_cast<Fl_Widget*>(w));
+}
+
+void * fl_tabs_get_value(TABS t) {
+ return static_cast<Fl_Tabs*>(t)->value();
+}
+
+void fl_tabs_set_value(TABS t, void * w) {
+ static_cast<Fl_Tabs*>(t)->value(static_cast<Fl_Widget*>(w));
+}
+
+void * fl_tabs_which(TABS t, int x, int y) {
+ return static_cast<Fl_Tabs*>(t)->which(x,y);
+}
+
+
+
+
+void fl_tabs_draw(TABS t) {
+ static_cast<My_Tabs*>(t)->Fl_Tabs::draw();
+}
+
+void fl_tabs_redraw_tabs(TABS t) {
+ (static_cast<Fl_Tabs*>(t)->*(&Friend_Tabs::redraw_tabs))();
+}
+
+int fl_tabs_handle(TABS t, int e) {
+ return static_cast<My_Tabs*>(t)->Fl_Tabs::handle(e);
+}
+
+