// Programmed by Jedidiah Barber // Released into the public domain #include #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 reinterpret_cast(w); } int fl_overlay_window_can_do_overlay(OVERLAYWINDOW w) { return reinterpret_cast(w)->can_do_overlay(); } void fl_overlay_window_resize(OVERLAYWINDOW ow, int x, int y, int w, int h) { reinterpret_cast(ow)->resize(x, y, w, h); } void fl_overlay_window_show(OVERLAYWINDOW w) { reinterpret_cast(w)->show(); } void fl_overlay_window_hide(OVERLAYWINDOW w) { reinterpret_cast(w)->hide(); } void fl_overlay_window_flush(OVERLAYWINDOW w) { reinterpret_cast(w)->flush(); } void fl_overlay_window_redraw_overlay(OVERLAYWINDOW w) { reinterpret_cast(w)->redraw_overlay(); } void fl_overlay_window_draw(OVERLAYWINDOW w) { reinterpret_cast(w)->Fl_Overlay_Window::draw(); } int fl_overlay_window_handle(OVERLAYWINDOW w, int e) { return reinterpret_cast(w)->Fl_Overlay_Window::handle(e); }