summaryrefslogtreecommitdiff
path: root/body/c_fl_overlay_window.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_overlay_window.cpp
parenta4703a65b015140cd4a7a985db66264875ade734 (diff)
Split public API and private implementation files into different directories
Diffstat (limited to 'body/c_fl_overlay_window.cpp')
-rw-r--r--body/c_fl_overlay_window.cpp116
1 files changed, 116 insertions, 0 deletions
diff --git a/body/c_fl_overlay_window.cpp b/body/c_fl_overlay_window.cpp
new file mode 100644
index 0000000..0d434c3
--- /dev/null
+++ b/body/c_fl_overlay_window.cpp
@@ -0,0 +1,116 @@
+
+
+// Programmed by Jedidiah Barber
+// Released into the public domain
+
+
+#include <FL/Fl_Overlay_Window.H>
+#include "c_fl_overlay_window.h"
+
+
+
+
+// Exports from Ada
+
+extern "C" void widget_draw_hook(void * ud);
+extern "C" int widget_handle_hook(void * ud, int e);
+
+extern "C" void overlay_window_draw_overlay_hook(void * ud);
+
+
+
+
+// Attaching all relevant hooks and friends
+
+class My_Overlay_Window : public Fl_Overlay_Window {
+public:
+ using Fl_Overlay_Window::Fl_Overlay_Window;
+
+ friend OVERLAYWINDOW new_fl_overlay_window(int x, int y, int w, int h, char *label);
+ friend OVERLAYWINDOW new_fl_overlay_window2(int w, int h, char *label);
+
+ friend void fl_overlay_window_draw(OVERLAYWINDOW w);
+ friend int fl_overlay_window_handle(OVERLAYWINDOW w, int e);
+
+ void draw();
+ void draw_overlay();
+ int handle(int e);
+};
+
+void My_Overlay_Window::draw() {
+ widget_draw_hook(this->user_data());
+}
+
+void My_Overlay_Window::draw_overlay() {
+ overlay_window_draw_overlay_hook(this->user_data());
+}
+
+int My_Overlay_Window::handle(int e) {
+ return widget_handle_hook(this->user_data(), e);
+}
+
+
+
+
+// Flattened C API
+
+OVERLAYWINDOW new_fl_overlay_window(int x, int y, int w, int h, char *label) {
+ My_Overlay_Window *ow = new My_Overlay_Window(x, y, w, h, label);
+ return ow;
+}
+
+OVERLAYWINDOW new_fl_overlay_window2(int w, int h, char *label) {
+ My_Overlay_Window *ow = new My_Overlay_Window(w, h, label);
+ return ow;
+}
+
+void free_fl_overlay_window(OVERLAYWINDOW w) {
+ delete static_cast<My_Overlay_Window*>(w);
+}
+
+
+
+
+int fl_overlay_window_can_do_overlay(OVERLAYWINDOW w) {
+ return static_cast<Fl_Overlay_Window*>(w)->can_do_overlay();
+}
+
+void fl_overlay_window_resize(OVERLAYWINDOW ow, int x, int y, int w, int h) {
+ static_cast<Fl_Overlay_Window*>(ow)->resize(x, y, w, h);
+}
+
+
+
+
+void fl_overlay_window_show(OVERLAYWINDOW w) {
+ static_cast<Fl_Overlay_Window*>(w)->show();
+}
+
+void fl_overlay_window_show2(OVERLAYWINDOW w, int c, void * v) {
+ static_cast<Fl_Overlay_Window*>(w)->show(c, static_cast<char**>(v));
+}
+
+void fl_overlay_window_hide(OVERLAYWINDOW w) {
+ static_cast<Fl_Overlay_Window*>(w)->hide();
+}
+
+void fl_overlay_window_flush(OVERLAYWINDOW w) {
+ static_cast<Fl_Overlay_Window*>(w)->flush();
+}
+
+
+
+
+void fl_overlay_window_redraw_overlay(OVERLAYWINDOW w) {
+ static_cast<Fl_Overlay_Window*>(w)->redraw_overlay();
+}
+
+void fl_overlay_window_draw(OVERLAYWINDOW w) {
+ static_cast<My_Overlay_Window*>(w)->Fl_Overlay_Window::draw();
+}
+
+int fl_overlay_window_handle(OVERLAYWINDOW w, int e) {
+ return static_cast<My_Overlay_Window*>(w)->Fl_Overlay_Window::handle(e);
+}
+
+