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_menuitem.cpp | 194 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 body/c_fl_menuitem.cpp (limited to 'body/c_fl_menuitem.cpp') diff --git a/body/c_fl_menuitem.cpp b/body/c_fl_menuitem.cpp new file mode 100644 index 0000000..b72c065 --- /dev/null +++ b/body/c_fl_menuitem.cpp @@ -0,0 +1,194 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#include +#include +#include +#include "c_fl_menuitem.h" + + + + +// Exports from Ada + +extern "C" void menu_item_callback_hook(void * cobj, void * ud); + + + + +// Flattened C API + +void * null_fl_menu_item() { + Fl_Menu_Item *mi = new Fl_Menu_Item; + mi->label(0); + return mi; +} + +void * new_fl_menu_item(char * t, void * c, int s, int f) { + Fl_Menu_Item *mi = new Fl_Menu_Item; + mi->callback(c==0?0:reinterpret_cast(&menu_item_callback_hook), c); + mi->flags = static_cast(f); + mi->shortcut(static_cast(s)); + mi->label(t); + return mi; +} + +void free_fl_menu_item(MENUITEM mi) { + delete static_cast(mi); +} + + + + +void * fl_menu_item_get_user_data(MENUITEM mi) { + return static_cast(mi)->user_data(); +} + +void fl_menu_item_set_callback(MENUITEM mi, void * c) { + static_cast(mi)->callback + (c==0?0:reinterpret_cast(&menu_item_callback_hook), c); +} + +void fl_menu_item_do_callback(MENUITEM mi, void * w) { + static_cast(mi)->do_callback(static_cast(w)); +} + + + + +int fl_menu_item_checkbox(MENUITEM mi) { + return static_cast(mi)->checkbox(); +} + +int fl_menu_item_radio(MENUITEM mi) { + return static_cast(mi)->radio(); +} + +int fl_menu_item_submenu(MENUITEM mi) { + return static_cast(mi)->submenu(); +} + +int fl_menu_item_value(MENUITEM mi) { + return static_cast(mi)->value(); +} + +void fl_menu_item_set(MENUITEM mi) { + static_cast(mi)->set(); +} + +void fl_menu_item_clear(MENUITEM mi) { + static_cast(mi)->clear(); +} + +void fl_menu_item_setonly(MENUITEM mi) { + static_cast(mi)->setonly(); +} + + + + +const char * fl_menu_item_get_label(MENUITEM mi) { + return static_cast(mi)->label(); +} + +void fl_menu_item_set_label(MENUITEM mi, const char *t) { + static_cast(mi)->label(t); +} + +void fl_menu_item_set_label2(MENUITEM mi, int k, const char * t) { + static_cast(mi)->label(static_cast(k), t); +} + +unsigned int fl_menu_item_get_labelcolor(MENUITEM mi) { + return static_cast(mi)->labelcolor(); +} + +void fl_menu_item_set_labelcolor(MENUITEM mi, unsigned int c) { + static_cast(mi)->labelcolor(c); +} + +int fl_menu_item_get_labelfont(MENUITEM mi) { + return static_cast(mi)->labelfont(); +} + +void fl_menu_item_set_labelfont(MENUITEM mi, int f) { + static_cast(mi)->labelfont(f); +} + +int fl_menu_item_get_labelsize(MENUITEM mi) { + return static_cast(mi)->labelsize(); +} + +void fl_menu_item_set_labelsize(MENUITEM mi, int s) { + static_cast(mi)->labelsize(s); +} + +int fl_menu_item_get_labeltype(MENUITEM mi) { + return static_cast(mi)->labeltype(); +} + +void fl_menu_item_set_labeltype(MENUITEM mi, int t) { + static_cast(mi)->labeltype(static_cast(t)); +} + + + + +int fl_menu_item_get_shortcut(MENUITEM mi) { + return static_cast(mi)->shortcut(); +} + +void fl_menu_item_set_shortcut(MENUITEM mi, int s) { + static_cast(mi)->shortcut(s); +} + +int fl_menu_item_get_flags(MENUITEM mi) { + return static_cast(mi)->flags; +} + +void fl_menu_item_set_flags(MENUITEM mi, int f) { + static_cast(mi)->flags = f; +} + + + + +void fl_menu_item_image(MENUITEM mi, void * i) { + static_cast(mi)->image(static_cast(i)); +} + + + + +void fl_menu_item_activate(MENUITEM mi) { + static_cast(mi)->activate(); +} + +void fl_menu_item_deactivate(MENUITEM mi) { + static_cast(mi)->deactivate(); +} + +void fl_menu_item_show(MENUITEM mi) { + static_cast(mi)->show(); +} + +void fl_menu_item_hide(MENUITEM mi) { + static_cast(mi)->hide(); +} + +int fl_menu_item_active(MENUITEM mi) { + return static_cast(mi)->active(); +} + +int fl_menu_item_visible(MENUITEM mi) { + return static_cast(mi)->visible(); +} + +int fl_menu_item_activevisible(MENUITEM mi) { + return static_cast(mi)->activevisible(); +} + + -- cgit