From b4438b2fbe895694be98e6e8426103deefc51448 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 21 Jan 2025 21:04:54 +1300 Subject: Split public API and private implementation files into different directories --- body/c_fl_help_view.cpp | 193 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 body/c_fl_help_view.cpp (limited to 'body/c_fl_help_view.cpp') diff --git a/body/c_fl_help_view.cpp b/body/c_fl_help_view.cpp new file mode 100644 index 0000000..aa2fd65 --- /dev/null +++ b/body/c_fl_help_view.cpp @@ -0,0 +1,193 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#include +#include +#include +#include "c_fl_help_view.h" + + + + +// Exports from Ada + +extern "C" void widget_draw_hook(void * ud); +extern "C" int widget_handle_hook(void * ud, int e); + + + + +// Attaching all relevant hooks and friends + +class My_Help_View : public Fl_Help_View { +public: + using Fl_Help_View::Fl_Help_View; + + friend void fl_help_view_draw(HELPVIEW v); + friend int fl_help_view_handle(HELPVIEW v, int e); + + void draw(); + int handle(int e); +}; + +void My_Help_View::draw() { + widget_draw_hook(this->user_data()); +} + +int My_Help_View::handle(int e) { + return widget_handle_hook(this->user_data(), e); +} + + + + +// Flattened C API + +HELPVIEW new_fl_help_view(int x, int y, int w, int h, char * label) { + My_Help_View *v = new My_Help_View(x, y, w, h, label); + return v; +} + +void free_fl_help_view(HELPVIEW v) { + delete static_cast(v); +} + + + + +void fl_help_view_clear_selection(HELPVIEW v) { + static_cast(v)->clear_selection(); +} + +void fl_help_view_select_all(HELPVIEW v) { + static_cast(v)->select_all(); +} + + + + +int fl_help_view_find(HELPVIEW v, const char * s, int p) { + return static_cast(v)->find(s, p); +} + +int fl_help_view_get_leftline(HELPVIEW v) { + return static_cast(v)->leftline(); +} + +void fl_help_view_set_leftline(HELPVIEW v, int t) { + static_cast(v)->leftline(t); +} + +int fl_help_view_get_topline(HELPVIEW v) { + return static_cast(v)->topline(); +} + +void fl_help_view_set_topline(HELPVIEW v, int t) { + static_cast(v)->topline(t); +} + +void fl_help_view_set_topline_target(HELPVIEW v, const char * t) { + static_cast(v)->topline(t); +} + + + + +const char * fl_help_view_directory(HELPVIEW v) { + return static_cast(v)->directory(); +} + +const char * fl_help_view_filename(HELPVIEW v) { + return static_cast(v)->filename(); +} + +int fl_help_view_load(HELPVIEW v, const char * f) { + return static_cast(v)->load(f); +} + +const char * fl_help_view_title(HELPVIEW v) { + return static_cast(v)->title(); +} + +const char * fl_help_view_get_value(HELPVIEW v) { + return static_cast(v)->value(); +} + +void fl_help_view_set_value(HELPVIEW v, const char * t) { + static_cast(v)->value(t); +} + +void fl_help_view_link(HELPVIEW v, void * f) { + static_cast(v)->link(reinterpret_cast(f)); +} + + + + +int fl_help_view_get_scrollbar_size(HELPVIEW v) { + return static_cast(v)->scrollbar_size(); +} + +void fl_help_view_set_scrollbar_size(HELPVIEW v, int s) { + static_cast(v)->scrollbar_size(s); +} + +int fl_help_view_get_size(HELPVIEW v) { + return static_cast(v)->size(); +} + +void fl_help_view_set_size(HELPVIEW v, int w, int h) { + static_cast(v)->size(w, h); +} + +void fl_help_view_resize(HELPVIEW v, int x, int y, int w, int h) { + static_cast(v)->resize(x, y, w, h); +} + +unsigned int fl_help_view_get_textcolor(HELPVIEW v) { + return static_cast(v)->textcolor(); +} + +void fl_help_view_set_textcolor(HELPVIEW v, unsigned int c) { + static_cast(v)->textcolor(c); +} + +int fl_help_view_get_textfont(HELPVIEW v) { + return static_cast(v)->textfont(); +} + +void fl_help_view_set_textfont(HELPVIEW v, int f) { + static_cast(v)->textfont(f); +} + +int fl_help_view_get_textsize(HELPVIEW v) { + return static_cast(v)->textsize(); +} + +void fl_help_view_set_textsize(HELPVIEW v, int s) { + static_cast(v)->textsize(s); +} + + + + +void fl_help_view_draw(HELPVIEW v) { +#if FL_ABI_VERSION >= 10303 + static_cast(v)->Fl_Help_View::draw(); +#else + static_cast(v)->Fl_Group::draw(); +#endif +} + +int fl_help_view_handle(HELPVIEW v, int e) { +#if FL_ABI_VERSION >= 10303 + return static_cast(v)->Fl_Help_View::handle(e); +#else + return static_cast(v)->Fl_Group::handle(e); +#endif +} + + -- cgit