From 2dd2c3870f799bc9d209067419fad08eb4d9a226 Mon Sep 17 00:00:00 2001 From: Nishi Date: Wed, 22 Apr 2026 12:05:49 +0900 Subject: [PATCH] introduce MWAPI --- examples/basic/box.c | 2 +- examples/basic/calculator.c | 4 +- examples/basic/clipboard.c | 6 +- examples/basic/colorpicker.c | 4 +- examples/basic/example.c | 10 ++-- examples/basic/listbox.c | 4 +- examples/basic/messagebox.c | 8 +-- examples/basic/periodic.c | 8 +-- examples/basic/rotate.c | 4 +- examples/basic/scrollbar.c | 1 - examples/basic/treeview.c | 4 +- examples/basic/viewport.c | 2 +- examples/gldemos/clock.c | 4 +- examples/gldemos/glutlayer.c | 6 +- examples/gldemos/triangle.c | 6 +- examples/gldemos/tripaint.c | 6 +- examples/vkdemos/vulkan.c | 2 +- include/Mw/Abstract/Directory.h | 12 ++-- include/Mw/Abstract/Dynamic.h | 6 +- include/Mw/Abstract/Time.h | 4 +- include/Mw/Core.h | 88 +++++++++++++++------------- include/Mw/Default.h | 2 +- include/Mw/Dialog/ColorPicker.h | 2 +- include/Mw/Dialog/DirectoryChooser.h | 2 +- include/Mw/Dialog/FileChooser.h | 4 +- include/Mw/Dialog/MessageBox.h | 4 +- include/Mw/Draw.h | 46 +++++++-------- include/Mw/Font.h | 4 +- include/Mw/MachDep.h | 6 ++ include/Mw/String.h | 12 ++-- include/Mw/TypeDefs.h | 4 +- include/Mw/Unicode.h | 8 +-- include/Mw/Widget/Vulkan.h | 2 +- src/core.c | 10 ++++ src/dialog/colorpicker.c | 12 ++-- src/dialog/filechooser.c | 24 ++++---- src/dialog/messagebox.c | 2 +- src/widget/combobox.c | 2 +- src/widget/listbox.c | 8 +-- src/widget/treeview.c | 6 +- src/widget/viewport.c | 4 +- 41 files changed, 189 insertions(+), 166 deletions(-) diff --git a/examples/basic/box.c b/examples/basic/box.c index 1b37168..e14b9f5 100644 --- a/examples/basic/box.c +++ b/examples/basic/box.c @@ -2,7 +2,7 @@ MwWidget window, box; -void resize(MwWidget handle, void* user, void* client) { +void MWAPI resize(MwWidget handle, void* user, void* client) { int ww = MwGetInteger(handle, MwNwidth); int wh = MwGetInteger(handle, MwNheight); diff --git a/examples/basic/calculator.c b/examples/basic/calculator.c index 998c3e3..8889e97 100644 --- a/examples/basic/calculator.c +++ b/examples/basic/calculator.c @@ -7,7 +7,7 @@ MwWidget inp; double stack[512]; int sp = 0; -static void resize(MwWidget handle, void* client, void* user) { +static void MWAPI resize(MwWidget handle, void* client, void* user) { int ww = MwGetInteger(handle, MwNwidth); int wh = MwGetInteger(handle, MwNheight) - MwGetInteger(inp, MwNheight); int i; @@ -30,7 +30,7 @@ static void resize(MwWidget handle, void* client, void* user) { } } -static void activate(MwWidget handle, void* client, void* user) { +static void MWAPI activate(MwWidget handle, void* client, void* user) { const char* n = MwGetText(handle, MwNtext); if(('0' <= n[0] && n[0] <= '9') || n[0] == '.') { diff --git a/examples/basic/clipboard.c b/examples/basic/clipboard.c index 94a192f..9d060c3 100644 --- a/examples/basic/clipboard.c +++ b/examples/basic/clipboard.c @@ -2,7 +2,7 @@ MwWidget window, instructions, text1, text2, cur_text; -static void resize(MwWidget handle, void* user_data, void* call_data) { +static void MWAPI resize(MwWidget handle, void* user_data, void* call_data) { unsigned int w, h; (void)user_data; @@ -28,7 +28,7 @@ static void resize(MwWidget handle, void* user_data, void* call_data) { MwNheight, h - 125 - 50 * 3, NULL); } -static void clipboard(MwWidget handle, void* user_data, void* call_data) { +static void MWAPI clipboard(MwWidget handle, void* user_data, void* call_data) { char* clipboard = call_data; (void)handle; @@ -40,7 +40,7 @@ static void clipboard(MwWidget handle, void* user_data, void* call_data) { } } -static void tick(MwWidget handle, void* user_data, void* call_data) { +static void MWAPI tick(MwWidget handle, void* user_data, void* call_data) { cur_text = text1; MwGetClipboard(handle, MwCLIPBOARD_MAIN); cur_text = text2; diff --git a/examples/basic/colorpicker.c b/examples/basic/colorpicker.c index 6471b78..fb92fda 100644 --- a/examples/basic/colorpicker.c +++ b/examples/basic/colorpicker.c @@ -4,7 +4,7 @@ MwWidget cpicker; MwWidget window; MwWidget button; -void color_callback(MwWidget handle, void* user_data, void* call_data) { +void MWAPI color_callback(MwWidget handle, void* user_data, void* call_data) { char hexColor[8]; MwRGB* rgb = call_data; @@ -18,7 +18,7 @@ void color_callback(MwWidget handle, void* user_data, void* call_data) { MwSetText(window, MwNbackground, hexColor); } -void color_picker(MwWidget handle, void* user_data, void* call_data) { +void MWAPI color_picker(MwWidget handle, void* user_data, void* call_data) { MwWidget cpicker = MwColorPicker(window, "cpicker"); (void)handle; diff --git a/examples/basic/example.c b/examples/basic/example.c index 7e13acd..9facecb 100644 --- a/examples/basic/example.c +++ b/examples/basic/example.c @@ -2,7 +2,7 @@ MwWidget window, menu, button, button2, button3, button4, button5, button6; -void handler(MwWidget handle, void* user_data, void* call_data) { +void MWAPI handler(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; @@ -10,7 +10,7 @@ void handler(MwWidget handle, void* user_data, void* call_data) { printf("hello world!\n"); } -void handler_theme(MwWidget handle, void* user_data, void* call_data) { +void MWAPI handler_theme(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; @@ -20,7 +20,7 @@ void handler_theme(MwWidget handle, void* user_data, void* call_data) { NULL); } -void handler_look(MwWidget handle, void* user_data, void* call_data) { +void MWAPI handler_look(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; @@ -30,7 +30,7 @@ void handler_look(MwWidget handle, void* user_data, void* call_data) { NULL); } -void handler_font(MwWidget handle, void* user_data, void* call_data) { +void MWAPI handler_font(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; @@ -40,7 +40,7 @@ void handler_font(MwWidget handle, void* user_data, void* call_data) { NULL); } -void resize(MwWidget handle, void* user_data, void* call_data) { +void MWAPI resize(MwWidget handle, void* user_data, void* call_data) { unsigned int w, h, mh; (void)user_data; diff --git a/examples/basic/listbox.c b/examples/basic/listbox.c index 3120d01..2b74119 100644 --- a/examples/basic/listbox.c +++ b/examples/basic/listbox.c @@ -4,13 +4,13 @@ MwWidget wmain; -void destroy(MwWidget handle, void* user, void* call) { +void MWAPI destroy(MwWidget handle, void* user, void* call) { (void)handle; (void)call; MwDestroyWidget(user); } -void activate(MwWidget handle, void* user, void* call) { +void MWAPI activate(MwWidget handle, void* user, void* call) { char msg[256]; MwWidget msgbox; diff --git a/examples/basic/messagebox.c b/examples/basic/messagebox.c index 343042f..8c617d7 100644 --- a/examples/basic/messagebox.c +++ b/examples/basic/messagebox.c @@ -1,12 +1,12 @@ #include -void ok(MwWidget handle, void* user, void* call) { +void MWAPI ok(MwWidget handle, void* user, void* call) { (void)handle; (void)call; MwDestroyWidget(user); } -void spawn(MwWidget handle, void* user, void* call) { +void MWAPI spawn(MwWidget handle, void* user, void* call) { MwWidget mb = MwMessageBox(user, "news has arrived!", "title", MwMB_ICONNEWS | MwMB_BUTTONOK); (void)handle; @@ -16,7 +16,7 @@ void spawn(MwWidget handle, void* user, void* call) { MwAddUserHandler(mb, MwNcloseHandler, ok, mb); } -void spawn2(MwWidget handle, void* user, void* call) { +void MWAPI spawn2(MwWidget handle, void* user, void* call) { MwWidget mb = MwMessageBox(user, "something went wrong!", "title", MwMB_ICONERROR | MwMB_BUTTONOK); (void)handle; @@ -26,7 +26,7 @@ void spawn2(MwWidget handle, void* user, void* call) { MwAddUserHandler(mb, MwNcloseHandler, ok, mb); } -void spawn3(MwWidget handle, void* user, void* call) { +void MWAPI spawn3(MwWidget handle, void* user, void* call) { int i; (void)handle; diff --git a/examples/basic/periodic.c b/examples/basic/periodic.c index f2466ad..c46bba7 100644 --- a/examples/basic/periodic.c +++ b/examples/basic/periodic.c @@ -11,7 +11,7 @@ MwWidget boxes[32]; int n = 0, row = -1; MwMenu e; -static void resize(MwWidget handle, void* user, void* call) { +static void MWAPI resize(MwWidget handle, void* user, void* call) { int w = MwGetInteger(window, MwNwidth); int h = MwGetInteger(window, MwNheight); @@ -47,7 +47,7 @@ static void add(MwWidget w) { } } -static void resize_content(MwWidget handle, void* user, void* call) { +static void MWAPI resize_content(MwWidget handle, void* user, void* call) { MwWidget* ws = MwGetChildren(handle); if(ws != NULL) { int pw = MwGetInteger(ws[0], "IpWidth"); @@ -76,7 +76,7 @@ static void resize_content(MwWidget handle, void* user, void* call) { } } -static void resize_frame(MwWidget handle, void* user, void* call) { +static void MWAPI resize_frame(MwWidget handle, void* user, void* call) { MwWidget* ws = MwGetChildren(handle); if(ws != NULL) { int w = MwGetInteger(handle, MwNwidth); @@ -140,7 +140,7 @@ static MwWidget child(MwWidget w) { return MwGetVoid(w, "VhandledWidget"); } -static void menu_handler(MwWidget handle, void* user, void* call) { +static void MWAPI menu_handler(MwWidget handle, void* user, void* call) { if(call == e) MwDestroyWidget(window); } diff --git a/examples/basic/rotate.c b/examples/basic/rotate.c index 574eb2d..dbf9c5e 100644 --- a/examples/basic/rotate.c +++ b/examples/basic/rotate.c @@ -14,7 +14,7 @@ double deg = 0; int ww, wh; -void handler(MwWidget w, void* user, void* client) { +void MWAPI handler(MwWidget w, void* user, void* client) { int i; double cdeg = deg; @@ -44,7 +44,7 @@ void handler(MwWidget w, void* user, void* client) { deg += 120.0 / (1000.0 / MwWaitMS); } -void resize(MwWidget w, void* user, void* client) { +void MWAPI resize(MwWidget w, void* user, void* client) { (void)w; (void)user; (void)client; diff --git a/examples/basic/scrollbar.c b/examples/basic/scrollbar.c index 594cd98..dbaae9a 100644 --- a/examples/basic/scrollbar.c +++ b/examples/basic/scrollbar.c @@ -1,4 +1,3 @@ - #include int main() { diff --git a/examples/basic/treeview.c b/examples/basic/treeview.c index 3be61cd..273dd3e 100644 --- a/examples/basic/treeview.c +++ b/examples/basic/treeview.c @@ -2,13 +2,13 @@ MwWidget wmain; -void destroy(MwWidget handle, void* user, void* call) { +void MWAPI destroy(MwWidget handle, void* user, void* call) { (void)handle; (void)call; MwDestroyWidget(user); } -void activate(MwWidget handle, void* user, void* call) { +void MWAPI activate(MwWidget handle, void* user, void* call) { char msg[256]; MwWidget msgbox; diff --git a/examples/basic/viewport.c b/examples/basic/viewport.c index 506ec78..c114935 100644 --- a/examples/basic/viewport.c +++ b/examples/basic/viewport.c @@ -2,7 +2,7 @@ MwWidget vp; -static void resize(MwWidget handle, void* user, void* call) { +static void MWAPI resize(MwWidget handle, void* user, void* call) { int w = MwGetInteger(handle, MwNwidth); int h = MwGetInteger(handle, MwNheight); diff --git a/examples/gldemos/clock.c b/examples/gldemos/clock.c index 271b088..9f683b5 100644 --- a/examples/gldemos/clock.c +++ b/examples/gldemos/clock.c @@ -13,7 +13,7 @@ double deg2rad(double deg) { return (360.0 - deg) / 180.0 * M_PI; } -void tick(MwWidget handle, void* user, void* call) { +void MWAPI tick(MwWidget handle, void* user, void* call) { time_t t = time(NULL); int i; double rad; @@ -104,7 +104,7 @@ void tick(MwWidget handle, void* user, void* call) { MwOpenGLSwapBuffer(opengl); } -void resize(MwWidget handle, void* user, void* call) { +void MWAPI resize(MwWidget handle, void* user, void* call) { int w = MwGetInteger(handle, MwNwidth); int h = MwGetInteger(handle, MwNheight); diff --git a/examples/gldemos/glutlayer.c b/examples/gldemos/glutlayer.c index dd24ef5..dda07d8 100644 --- a/examples/gldemos/glutlayer.c +++ b/examples/gldemos/glutlayer.c @@ -9,7 +9,7 @@ static void reshape(int width, int height); static void init(void); static void key(int k); -static void tick(MwWidget handle, void* user, void* client) { +static void MWAPI tick(MwWidget handle, void* user, void* client) { (void)handle; (void)user; (void)client; @@ -20,7 +20,7 @@ static void tick(MwWidget handle, void* user, void* client) { MwOpenGLSwapBuffer(opengl); } -static void resize(MwWidget handle, void* user, void* client) { +static void MWAPI resize(MwWidget handle, void* user, void* client) { int ww, wh; (void)user; @@ -37,7 +37,7 @@ static void resize(MwWidget handle, void* user, void* client) { reshape(ww, wh); } -static void key_pressed(MwWidget handle, void* user, void* client) { +static void MWAPI key_pressed(MwWidget handle, void* user, void* client) { (void)handle; (void)user; diff --git a/examples/gldemos/triangle.c b/examples/gldemos/triangle.c index ceb70e3..702fca0 100644 --- a/examples/gldemos/triangle.c +++ b/examples/gldemos/triangle.c @@ -6,7 +6,7 @@ int ow, oh; double deg = 0; double dir = 1; -void resize(MwWidget handle, void* user_data, void* call_data) { +void MWAPI resize(MwWidget handle, void* user_data, void* call_data) { unsigned int w, h; (void)user_data; @@ -27,7 +27,7 @@ void resize(MwWidget handle, void* user_data, void* call_data) { NULL); } -void tick(MwWidget handle, void* user_data, void* call_data) { +void MWAPI tick(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; @@ -61,7 +61,7 @@ void tick(MwWidget handle, void* user_data, void* call_data) { deg += 120.0 / (1000.0 / MwWaitMS) * dir; } -void activate(MwWidget handle, void* user_data, void* call_data) { +void MWAPI activate(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; diff --git a/examples/gldemos/tripaint.c b/examples/gldemos/tripaint.c index 2e53d9b..069315a 100644 --- a/examples/gldemos/tripaint.c +++ b/examples/gldemos/tripaint.c @@ -17,7 +17,7 @@ int ct = 0; int click = 0; int mx, my; -static void tick(MwWidget handle, void* user, void* call) { +static void MWAPI tick(MwWidget handle, void* user, void* call) { int i; int w = MwGetInteger(opengl, MwNwidth); int h = MwGetInteger(opengl, MwNheight); @@ -50,7 +50,7 @@ static void tick(MwWidget handle, void* user, void* call) { MwOpenGLSwapBuffer(opengl); } -static void mouse(MwWidget handle, void* user, void* call) { +static void MWAPI mouse(MwWidget handle, void* user, void* call) { MwMouse* mouse = call; (void)handle; @@ -91,7 +91,7 @@ static void mouse(MwWidget handle, void* user, void* call) { } } -static void mouse_move(MwWidget handle, void* user, void* call) { +static void MWAPI mouse_move(MwWidget handle, void* user, void* call) { MwPoint* point = call; (void)handle; diff --git a/examples/vkdemos/vulkan.c b/examples/vkdemos/vulkan.c index f5faa9b..2d03030 100644 --- a/examples/vkdemos/vulkan.c +++ b/examples/vkdemos/vulkan.c @@ -66,7 +66,7 @@ VkSwapchainCreateInfoKHR swapchainCreateInfo = {}; PFN_##name _##name = (PFN_##name)_vkGetInstanceProcAddr(instance, #name); \ assert(_##name); -void tick(MwWidget handle, void* user_data, void* call_data) { +void MWAPI tick(MwWidget handle, void* user_data, void* call_data) { (void)handle; (void)user_data; (void)call_data; diff --git a/include/Mw/Abstract/Directory.h b/include/Mw/Abstract/Directory.h index 7f6629b..1e1db49 100644 --- a/include/Mw/Abstract/Directory.h +++ b/include/Mw/Abstract/Directory.h @@ -17,32 +17,32 @@ extern "C" { * @param path Path * @return Handle */ -MWDECL void* MwDirectoryOpen(const char* path); +MWDECL void* MWAPI MwDirectoryOpen(const char* path); /*! * @brief Closes a directory * @param handle Handle */ -MWDECL void MwDirectoryClose(void* handle); +MWDECL void MWAPI MwDirectoryClose(void* handle); /*! * @brief Reads a directory * @param handle Handle * @return Directory entry */ -MWDECL MwDirectoryEntry* MwDirectoryRead(void* handle); +MWDECL MwDirectoryEntry* MWAPI MwDirectoryRead(void* handle); /*! * @brief Frees a directory entry * @param entry Entry */ -MWDECL void MwDirectoryFreeEntry(MwDirectoryEntry* entry); +MWDECL void MWAPI MwDirectoryFreeEntry(MwDirectoryEntry* entry); /*! * @brief Gets a current directory * @param Directory */ -MWDECL char* MwDirectoryCurrent(void); +MWDECL char* MWAPI MwDirectoryCurrent(void); /*! * @brief Joins 2 paths @@ -50,7 +50,7 @@ MWDECL char* MwDirectoryCurrent(void); * @param b Path * @return Path */ -MWDECL char* MwDirectoryJoin(char* a, char* b); +MWDECL char* MWAPI MwDirectoryJoin(char* a, char* b); #ifdef __cplusplus } diff --git a/include/Mw/Abstract/Dynamic.h b/include/Mw/Abstract/Dynamic.h index d649d4d..ead5070 100644 --- a/include/Mw/Abstract/Dynamic.h +++ b/include/Mw/Abstract/Dynamic.h @@ -16,20 +16,20 @@ extern "C" { * @param path Path * @return Handle */ -MWDECL void* MwDynamicOpen(const char* path); +MWDECL void* MWAPI MwDynamicOpen(const char* path); /*! * @brief Gets a symbol from the dynamic library * @param handle Handle * @param symbol Symbol */ -MWDECL void* MwDynamicSymbol(void* handle, const char* symbol); +MWDECL void* MWAPI MwDynamicSymbol(void* handle, const char* symbol); /*! * @brief Closes a dynamic library * @param handle Handle */ -MWDECL void MwDynamicClose(void* handle); +MWDECL void MWAPI MwDynamicClose(void* handle); #ifdef __cplusplus } diff --git a/include/Mw/Abstract/Time.h b/include/Mw/Abstract/Time.h index 58f246e..c8ffbf6 100644 --- a/include/Mw/Abstract/Time.h +++ b/include/Mw/Abstract/Time.h @@ -15,13 +15,13 @@ extern "C" { * @brief Sleeps for milliseconds * @param ms Milliseconds */ -MWDECL void MwTimeSleep(int ms); +MWDECL void MWAPI MwTimeSleep(int ms); /*! * @brief Gets a monotonic time * @return Monotonic time */ -MWDECL long MwTimeGetTick(void); +MWDECL long MWAPI MwTimeGetTick(void); #ifdef __cplusplus } diff --git a/include/Mw/Core.h b/include/Mw/Core.h index 31c6ca4..2562e9b 100644 --- a/include/Mw/Core.h +++ b/include/Mw/Core.h @@ -60,7 +60,7 @@ extern "C" { * @brief Initializes the Milsko Toolkit * @return `0` if successful */ -MWDECL int MwLibraryInit(void); +MWDECL int MWAPI MwLibraryInit(void); /*! * @brief Creates a widget @@ -73,7 +73,7 @@ MWDECL int MwLibraryInit(void); * @param height Height * @return Widget */ -MWDECL MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height); +MWDECL MwWidget MWAPI MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height); /*! * @brief Creates a widget @@ -87,7 +87,7 @@ MWDECL MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget * @param ... Same with MwVaApply * @return Widget */ -MWDECL MwWidget MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...); +MWDECL MwWidget MWAPI MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...); /*! * @brief Creates a widget @@ -101,13 +101,13 @@ MWDECL MwWidget MwVaCreateWidget(MwClass widget_class, const char* name, MwWidge * @param va Same with MwVaListApply * @return Widget */ -MWDECL MwWidget MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va); +MWDECL MwWidget MWAPI MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va); /*! * @brief Destroys the widget and its child widgets * @param handle Widget */ -MWDECL void MwDestroyWidget(MwWidget handle); +MWDECL void MWAPI MwDestroyWidget(MwWidget handle); /*! * @brief Executes a method specific to the widget (varadic version). @@ -115,7 +115,7 @@ MWDECL void MwDestroyWidget(MwWidget handle); * @param handle Widget * @param ... Widget function arguments. */ -MWDECL void MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, ...); +MWDECL void MWAPI MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, ...); /*! * @brief Executes a method specific to the widget (va_list version). @@ -123,27 +123,27 @@ MWDECL void MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, * @param handle Widget * @param va Widget function arguments. */ -MWDECL void MwVaListWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va); +MWDECL void MWAPI MwVaListWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va); /*! * @brief Runs the main loop * @param handle Widget */ -MWDECL void MwLoop(MwWidget handle); +MWDECL void MWAPI MwLoop(MwWidget handle); /*! * @brief Runs the single step * @param handle Widget * @return `0` if successful */ -MWDECL int MwStep(MwWidget handle); +MWDECL int MWAPI MwStep(MwWidget handle); /*! * @brief Check if any event is pending * @param handle Widget * @return `1` if any event is pending */ -MWDECL int MwPending(MwWidget handle); +MWDECL int MWAPI MwPending(MwWidget handle); /*! * @brief Sets an integer property @@ -151,7 +151,7 @@ MWDECL int MwPending(MwWidget handle); * @param key Key * @param n Value */ -MWDECL void MwSetInteger(MwWidget handle, const char* key, int n); +MWDECL void MWAPI MwSetInteger(MwWidget handle, const char* key, int n); /*! * @brief Sets a text property @@ -159,7 +159,7 @@ MWDECL void MwSetInteger(MwWidget handle, const char* key, int n); * @param key Key * @param value Value */ -MWDECL void MwSetText(MwWidget handle, const char* key, const char* value); +MWDECL void MWAPI MwSetText(MwWidget handle, const char* key, const char* value); /*! * @brief Sets a void pointer property @@ -167,7 +167,7 @@ MWDECL void MwSetText(MwWidget handle, const char* key, const char* value); * @param key Key * @param value Value */ -MWDECL void MwSetVoid(MwWidget handle, const char* key, void* value); +MWDECL void MWAPI MwSetVoid(MwWidget handle, const char* key, void* value); /*! * @brief Gets the integer property @@ -175,7 +175,7 @@ MWDECL void MwSetVoid(MwWidget handle, const char* key, void* value); * @param key Key * @return Value */ -MWDECL int MwGetInteger(MwWidget handle, const char* key); +MWDECL int MWAPI MwGetInteger(MwWidget handle, const char* key); /*! * @brief Gets the text property @@ -183,7 +183,7 @@ MWDECL int MwGetInteger(MwWidget handle, const char* key); * @param key Key * @return Value */ -MWDECL const char* MwGetText(MwWidget handle, const char* key); +MWDECL const char* MWAPI MwGetText(MwWidget handle, const char* key); /*! * @brief Gets the void pointer property @@ -191,28 +191,28 @@ MWDECL const char* MwGetText(MwWidget handle, const char* key); * @param key Key * @return Value */ -MWDECL void* MwGetVoid(MwWidget handle, const char* key); +MWDECL void* MWAPI MwGetVoid(MwWidget handle, const char* key); /*! * @brief Sets the default property * @param handle Widget * @warning This is called when widget is created */ -MWDECL void MwSetDefault(MwWidget handle); +MWDECL void MWAPI MwSetDefault(MwWidget handle); /*! * @brief Sets the properties * @param handle Widget * @param ... Properties */ -MWDECL void MwVaApply(MwWidget handle, ...); +MWDECL void MWAPI MwVaApply(MwWidget handle, ...); /*! * @brief Sets properties * @param handle Widget * @param va Properties */ -MWDECL void MwVaListApply(MwWidget handle, va_list va); +MWDECL void MWAPI MwVaListApply(MwWidget handle, va_list va); /*! * @brief Sets a user handler @@ -221,7 +221,7 @@ MWDECL void MwVaListApply(MwWidget handle, va_list va); * @param handler Handler * @param user_data User data passed to handler */ -MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data); +MWDECL void MWAPI MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data); /*! * @brief Dispatches the user handler @@ -229,7 +229,7 @@ MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler han * @param key Key * @param handler_data Handler data passed to handler */ -MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data); +MWDECL void MWAPI MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data); /*! * @brief Sets an error handler @@ -237,52 +237,52 @@ MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handle * @param handler Handler * @param user_data User data passed to handler */ -MWDECL void MwSetErrorHandler(MwErrorHandler handler, void* user_data); +MWDECL void MWAPI MwSetErrorHandler(MwErrorHandler handler, void* user_data); /*! * @brief Dispatches the error handler * @param code Error code * @param message Error message */ -MWDECL void MwDispatchError(int code, const char* message); +MWDECL void MWAPI MwDispatchError(int code, const char* message); /*! * @brief Forcefully makes widget render * @param handle Widget */ -MWDECL void MwForceRender(MwWidget handle); +MWDECL void MWAPI MwForceRender(MwWidget handle); /*! * @brief Forcefully makes widget render * @param handle Widget * @param ptr Ignored */ -MWDECL void MwForceRender2(MwWidget handle, void* ptr); +MWDECL void MWAPI MwForceRender2(MwWidget handle, void* ptr); /*! * @brief Adds an widget to tick handler list * @param handle Widget */ -MWDECL void MwAddTickList(MwWidget handle); +MWDECL void MWAPI MwAddTickList(MwWidget handle); /*! * @brief Focus the widget * @param handle Widget */ -MWDECL void MwFocus(MwWidget handle); +MWDECL void MWAPI MwFocus(MwWidget handle); /*! * @brief Grabs the pointer * @param handle Widget * @param toggle Toggle */ -MWDECL void MwGrabPointer(MwWidget handle, int toggle); +MWDECL void MWAPI MwGrabPointer(MwWidget handle, int toggle); /*! * @brief Hides the cursor * @param handle Widget */ -MWDECL void MwHideCursor(MwWidget handle); +MWDECL void MWAPI MwHideCursor(MwWidget handle); /*! * @brief Toggles the dark theme @@ -290,76 +290,84 @@ MWDECL void MwHideCursor(MwWidget handle); * @param toggle Toggle * @deprecated Use MwNdarkTheme instead */ -MWDECL void MwSetDarkTheme(MwWidget handle, int toggle); +MWDECL void MWAPI MwSetDarkTheme(MwWidget handle, int toggle); /*! * @brief Gets the parent widget * @param handle Widget * @return Parent widget */ -MWDECL MwWidget MwGetParent(MwWidget handle); +MWDECL MwWidget MWAPI MwGetParent(MwWidget handle); /*! * @brief Show widget * @param handle Widget * @param toggle Toggle */ -MWDECL void MwShow(MwWidget handle, int toggle); +MWDECL void MWAPI MwShow(MwWidget handle, int toggle); /*! * @brief Reparents widget * @param handle Widget * @param new_parent New parent */ -MWDECL void MwReparent(MwWidget handle, MwWidget new_parent); +MWDECL void MWAPI MwReparent(MwWidget handle, MwWidget new_parent); /*! * @brief Gets class of widget * @param handle Widget * @return Class */ -MWDECL MwClass MwGetClass(MwWidget handle); +MWDECL MwClass MWAPI MwGetClass(MwWidget handle); /*! * @brief Gets name of widget * @param handle Widget * @return Name */ -MWDECL const char* MwGetName(MwWidget handle); +MWDECL const char* MWAPI MwGetName(MwWidget handle); /*! * @brief Gets children of widget * @param handle Widget * @return Children (NULL-terminated array) */ -MWDECL MwWidget* MwGetChildren(MwWidget handle); +MWDECL MwWidget* MWAPI MwGetChildren(MwWidget handle); /*! * @brief Gets the cursor coordinate * @param handle Widget * @param point Point */ -MWDECL void MwGetCursorCoord(MwWidget handle, MwPoint* point); +MWDECL void MWAPI MwGetCursorCoord(MwWidget handle, MwPoint* point); /*! * @brief Gets the screen size * @param handle Widget * @param rect Rectangle */ -MWDECL void MwGetScreenSize(MwWidget handle, MwRect* rect); +MWDECL void MWAPI MwGetScreenSize(MwWidget handle, MwRect* rect); /*! * @brief Reports whether a widget reports global or local coordinates upon GetXY/SetXY. Anything with a parent reports local, and most backends report global coordinates being supported for top level windows, but some (Wayland) do not. * @param handle Widget */ -MWDECL int MwGetCoordinateType(MwWidget handle); +MWDECL int MWAPI MwGetCoordinateType(MwWidget handle); /*! * @brief Queue to get clipboard content. * @param handle Widget * @param clipboard_type The Clipboard Type to get. See MwClipboardType. This is ignored on backends that aren't X11/Wayland, so if you're unsure, just use MwClipboardMain */ -MWDECL void MwGetClipboard(MwWidget handle, int clipboard_type); +MWDECL void MWAPI MwGetClipboard(MwWidget handle, int clipboard_type); + +#ifdef _MILSKO +MWDECL void MwForceRender_Internal(MwWidget handle); +MWDECL void MwForceRender2_Internal(MwWidget handle, void* ptr); + +#define MwForceRender MwForceRender_Internal +#define MwForceRender2 MwForceRender2_Internal +#endif #ifdef __cplusplus } diff --git a/include/Mw/Default.h b/include/Mw/Default.h index 3d197d0..8e3c0b2 100644 --- a/include/Mw/Default.h +++ b/include/Mw/Default.h @@ -61,7 +61,7 @@ MWDECL const int MwDefaultShadow; * @brief Gets default border width * @param handle Widget */ -MWDECL int MwDefaultBorderWidth(MwWidget handle); +MWDECL int MWAPI MwDefaultBorderWidth(MwWidget handle); #ifdef __cplusplus } diff --git a/include/Mw/Dialog/ColorPicker.h b/include/Mw/Dialog/ColorPicker.h index a4d77a1..b143fdf 100644 --- a/include/Mw/Dialog/ColorPicker.h +++ b/include/Mw/Dialog/ColorPicker.h @@ -18,7 +18,7 @@ extern "C" { * @param title Title text * @return Widget */ -MWDECL MwWidget MwColorPicker(MwWidget handle, const char* title); +MWDECL MwWidget MWAPI MwColorPicker(MwWidget handle, const char* title); #ifdef __cplusplus } diff --git a/include/Mw/Dialog/DirectoryChooser.h b/include/Mw/Dialog/DirectoryChooser.h index dceaaa6..cc6853c 100644 --- a/include/Mw/Dialog/DirectoryChooser.h +++ b/include/Mw/Dialog/DirectoryChooser.h @@ -18,7 +18,7 @@ extern "C" { * @param title Title text * @return Widget */ -MWDECL MwWidget MwDirectoryChooser(MwWidget handle, const char* title); +MWDECL MwWidget MWAPI MwDirectoryChooser(MwWidget handle, const char* title); #ifdef __cplusplus } diff --git a/include/Mw/Dialog/FileChooser.h b/include/Mw/Dialog/FileChooser.h index fbabc49..f6aa094 100644 --- a/include/Mw/Dialog/FileChooser.h +++ b/include/Mw/Dialog/FileChooser.h @@ -18,7 +18,7 @@ extern "C" { * @param title Title text * @return Widget */ -MWDECL MwWidget MwFileChooser(MwWidget handle, const char* title); +MWDECL MwWidget MWAPI MwFileChooser(MwWidget handle, const char* title); /*! * @brief Creates a file chooser @@ -27,7 +27,7 @@ MWDECL MwWidget MwFileChooser(MwWidget handle, const char* title); * @param dir Show directory only or not * @return Widget */ -MWDECL MwWidget MwFileChooserEx(MwWidget handle, const char* title, int dir); +MWDECL MwWidget MWAPI MwFileChooserEx(MwWidget handle, const char* title, int dir); #ifdef __cplusplus } diff --git a/include/Mw/Dialog/MessageBox.h b/include/Mw/Dialog/MessageBox.h index c0e76ed..a8a5a46 100644 --- a/include/Mw/Dialog/MessageBox.h +++ b/include/Mw/Dialog/MessageBox.h @@ -20,14 +20,14 @@ extern "C" { * @param flag Flag * @return Widget */ -MWDECL MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag); +MWDECL MwWidget MWAPI MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag); /*! * @brief Gets a child of the message box * @param handle Widget * @param child Child */ -MWDECL MwWidget MwMessageBoxGetChild(MwWidget handle, int child); +MWDECL MwWidget MWAPI MwMessageBoxGetChild(MwWidget handle, int child); #ifdef __cplusplus } diff --git a/include/Mw/Draw.h b/include/Mw/Draw.h index 9208d72..15bf655 100644 --- a/include/Mw/Draw.h +++ b/include/Mw/Draw.h @@ -19,14 +19,14 @@ extern "C" { * @param text Color text * @return Color */ -MWDECL MwLLColor MwParseColor(MwWidget handle, const char* text); +MWDECL MwLLColor MWAPI MwParseColor(MwWidget handle, const char* text); /*! * @brief Parses a color text * @param text Color text * @param rgb RGB */ -MWDECL void MwParseColorNoAllocate(const char* text, MwRGB* rgb); +MWDECL void MWAPI MwParseColorNoAllocate(const char* text, MwRGB* rgb); /*! * @brief Lighten a color @@ -37,7 +37,7 @@ MWDECL void MwParseColorNoAllocate(const char* text, MwRGB* rgb); * @param b Blue * @return Color */ -MWDECL MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b); +MWDECL MwLLColor MWAPI MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b); /*! * @brief Draws a filled rectangle @@ -45,7 +45,7 @@ MWDECL MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, * @param rect Rectangle area * @param color Color */ -MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color); +MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color); /*! * @brief Draws a filled rectangle that fades to a darker color @@ -53,7 +53,7 @@ MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color); * @param rect Rectangle area * @param color Color */ -MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color); +MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color); /*! * @brief Draws a frame @@ -63,7 +63,7 @@ MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color); * @param invert Invert the 3D border color or not * @warning `rect` gets changed to the area of rectangle inside */ -MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert); +MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert); /*! * @brief Does the DrawFrame/DrawRect combo used for drawing widget. @@ -73,7 +73,7 @@ MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int inve * @param invert Invert the 3D border color or not * @warning `rect` gets changed to the area of rectangle inside */ -MWDECL void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border); +MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border); /*! * @brief Draws a triangle @@ -82,7 +82,7 @@ MWDECL void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int * @param color Color * @param invert Invert the 3D border color or not */ -MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction); +MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction); /*! * @brief Draws a frame with specified border width @@ -96,7 +96,7 @@ MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int i * @param rounded Rounded or not * @warning `rect` gets changed to the area of rectangle inside */ -MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same); +MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same); /*! * @brief Creates a pixmap from image @@ -104,7 +104,7 @@ MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int in * @param path Path * @return Pixmap */ -MWDECL MwLLPixmap MwLoadImage(MwWidget handle, const char* path); +MWDECL MwLLPixmap MWAPI MwLoadImage(MwWidget handle, const char* path); /*! * @brief Get color components @@ -113,7 +113,7 @@ MWDECL MwLLPixmap MwLoadImage(MwWidget handle, const char* path); * @param green Pointer to green color * @param blue Pointer to blue color */ -MWDECL void MwColorGet(MwLLColor color, int* red, int* green, int* blue); +MWDECL void MWAPI MwColorGet(MwLLColor color, int* red, int* green, int* blue); /*! * @brief Creates a pixmap from raw data @@ -123,28 +123,28 @@ MWDECL void MwColorGet(MwLLColor color, int* red, int* green, int* blue); * @param height Height * @return Pixmap */ -MWDECL MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height); +MWDECL MwLLPixmap MWAPI MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height); /*! * @brief Updates a pixmap using raw data * @param pixmap Pixmap to update * @param rgb RGBA data */ -MWDECL void MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb); +MWDECL void MWAPI MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb); /*! * @brief Gets the raw data of pixmap * @param pixmap Pixmap * @return RFBA data */ -MWDECL unsigned char* MwPixmapGetRaw(MwLLPixmap pixmap); +MWDECL unsigned char* MWAPI MwPixmapGetRaw(MwLLPixmap pixmap); /*! * @brief Gets the size of pixmap * @param pixmap Pixmap * @param rect Size */ -MWDECL void MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect); +MWDECL void MWAPI MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect); /*! * @brief Creates a pixmap from XPM data @@ -152,7 +152,7 @@ MWDECL void MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect); * @param data Data * @return Pixmap */ -MWDECL MwLLPixmap MwLoadXPM(MwWidget handle, char** data); +MWDECL MwLLPixmap MWAPI MwLoadXPM(MwWidget handle, char** data); /*! * @brief Creates a pixmap from icon data @@ -160,7 +160,7 @@ MWDECL MwLLPixmap MwLoadXPM(MwWidget handle, char** data); * @param data Data * @return Pixmap */ -MWDECL MwLLPixmap MwLoadIcon(MwWidget handle, MwU32* data); +MWDECL MwLLPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data); /*! * @brief Draws a diamond @@ -169,7 +169,7 @@ MWDECL MwLLPixmap MwLoadIcon(MwWidget handle, MwU32* data); * @param color Color * @param invert Invert the 3D border color or not */ -MWDECL void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert); +MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert); /* text.c */ @@ -182,7 +182,7 @@ MWDECL void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int in * @param align Align * @param color Color */ -MWDECL void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color); +MWDECL void MWAPI MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color); /*! * @brief Calculates a text width @@ -191,7 +191,7 @@ MWDECL void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char * @param font Font, NULLable * @return Text width */ -MWDECL int MwTextWidth(MwWidget handle, MwFLFont font, const char* text); +MWDECL int MWAPI MwTextWidth(MwWidget handle, MwFLFont font, const char* text); /*! * @brief Calculates a text height @@ -200,7 +200,7 @@ MWDECL int MwTextWidth(MwWidget handle, MwFLFont font, const char* text); * @param font Font, NULLable * @return Text height */ -MWDECL int MwTextHeight(MwWidget handle, MwFLFont font, const char* text); +MWDECL int MWAPI MwTextHeight(MwWidget handle, MwFLFont font, const char* text); /* color.c */ @@ -210,14 +210,14 @@ MWDECL int MwTextHeight(MwWidget handle, MwFLFont font, const char* text); * @param color Color name * @return Color */ -MWDECL MwLLColor MwParseColorName(MwWidget handle, const char* color); +MWDECL MwLLColor MWAPI MwParseColorName(MwWidget handle, const char* color); /*! * @brief Parses a color name * @param color Color name * @param rgb RGB */ -MWDECL void MwParseColorNameNoAllocate(const char* color, MwRGB* rgb); +MWDECL void MWAPI MwParseColorNameNoAllocate(const char* color, MwRGB* rgb); #ifdef __cplusplus } diff --git a/include/Mw/Font.h b/include/Mw/Font.h index 6f22b89..9902af6 100644 --- a/include/Mw/Font.h +++ b/include/Mw/Font.h @@ -18,13 +18,13 @@ extern "C" { * @param size Data size * @return Font handle */ -MWDECL void* MwFontLoad(unsigned char* data, unsigned int size); +MWDECL void* MWAPI MwFontLoad(unsigned char* data, unsigned int size); /*! * @brief Frees a font handle * @param handle Handle */ -MWDECL void MwFontFree(void* handle); +MWDECL void MWAPI MwFontFree(void* handle); #ifdef __cplusplus } diff --git a/include/Mw/MachDep.h b/include/Mw/MachDep.h index 4c9b9d6..218ab5d 100644 --- a/include/Mw/MachDep.h +++ b/include/Mw/MachDep.h @@ -94,6 +94,12 @@ #define MWDECL extern #endif +#if defined(_WIN32) +#define MWAPI __cdecl +#else +#define MWAPI +#endif + #define MwInline static __inline #endif diff --git a/include/Mw/String.h b/include/Mw/String.h index 2a744d9..5333d01 100644 --- a/include/Mw/String.h +++ b/include/Mw/String.h @@ -17,7 +17,7 @@ extern "C" { * @param str String * @return String */ -MWDECL char* MwStringDuplicate(const char* str); +MWDECL char* MWAPI MwStringDuplicate(const char* str); /*! * @brief Concatenates 2 strings @@ -25,21 +25,21 @@ MWDECL char* MwStringDuplicate(const char* str); * @param str2 String * @return String */ -MWDECL char* MwStringConcat(const char* str1, const char* str2); +MWDECL char* MWAPI MwStringConcat(const char* str1, const char* str2); /*! * @brief Converts size to string * @param out Output * @param size Size */ -MWDECL void MwStringSize(char* out, MwOffset size); +MWDECL void MWAPI MwStringSize(char* out, MwOffset size); /*! * @brief Converts time to string * @param out Output * @param t Time */ -MWDECL void MwStringTime(char* out, time_t t); +MWDECL void MWAPI MwStringTime(char* out, time_t t); /*! * @brief Prints up to n characters into a bufferMwStringPrintIntoBuffer. @@ -47,14 +47,14 @@ MWDECL void MwStringTime(char* out, time_t t); * @param out Buffer * @param size Max size */ -MWDECL void MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...); +MWDECL void MWAPI MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...); /*! * @brief Check if the given key is UTF8 * @param key Input * @return whether its utf8 */ -MWDECL MwBool MwStringIsKeyUTF8(MwU32 key); +MWDECL MwBool MWAPI MwStringIsKeyUTF8(MwU32 key); #ifdef __cplusplus } diff --git a/include/Mw/TypeDefs.h b/include/Mw/TypeDefs.h index 561c53b..04187d61 100644 --- a/include/Mw/TypeDefs.h +++ b/include/Mw/TypeDefs.h @@ -43,8 +43,8 @@ typedef void (*MwHandlerMouse)(MwWidget handle, void* ptr); typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args); typedef void (*MwHandlerClipboardReceived)(MwWidget handle, const char* data); -typedef void (*MwUserHandler)(MwWidget handle, void* user_data, void* call_data); -typedef void (*MwErrorHandler)(int code, const char* message, void* user_data); +typedef void (MWAPI *MwUserHandler)(MwWidget handle, void* user_data, void* call_data); +typedef void (MWAPI *MwErrorHandler)(int code, const char* message, void* user_data); struct _MwTextKeyValue { char* key; diff --git a/include/Mw/Unicode.h b/include/Mw/Unicode.h index 2aa6d19..32edeaa 100644 --- a/include/Mw/Unicode.h +++ b/include/Mw/Unicode.h @@ -18,14 +18,14 @@ extern "C" { * @brief output Output * @return Bytes this multibyte takes */ -MWDECL int MwUTF8ToUTF32(const char* input, int* output); +MWDECL int MWAPI MwUTF8ToUTF32(const char* input, int* output); /*! * @brief Calculates UTF-8 string length * @brief input Input * @return Length */ -MWDECL int MwUTF8Length(const char* input); +MWDECL int MWAPI MwUTF8Length(const char* input); /*! * @brief Copies UTF-8 string to other string @@ -36,7 +36,7 @@ MWDECL int MwUTF8Length(const char* input); * @brief len Length * @return Copied length in bytes */ -MWDECL int MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int len); +MWDECL int MWAPI MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int len); /*! * @brief Converts UTF-32 to UTF-8 @@ -44,7 +44,7 @@ MWDECL int MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int * @brief output Output * @return Bytes this wide byte takes */ -MWDECL int MwUTF32ToUTF8(int input, char* output); +MWDECL int MWAPI MwUTF32ToUTF8(int input, char* output); #ifdef __cplusplus } diff --git a/include/Mw/Widget/Vulkan.h b/include/Mw/Widget/Vulkan.h index d9084d7..4c7e0bb 100644 --- a/include/Mw/Widget/Vulkan.h +++ b/include/Mw/Widget/Vulkan.h @@ -103,7 +103,7 @@ MwInline void* MwVulkanGetField(MwWidget handle, int field, int* err) { /*! * @brief Return whether Vulkan is installed on the target platform. */ -MWDECL int MwVulkanSupported(void); +MWDECL int MWAPI MwVulkanSupported(void); #ifdef __cplusplus } diff --git a/src/core.c b/src/core.c index 4a5aecd..8342b83 100644 --- a/src/core.c +++ b/src/core.c @@ -913,6 +913,16 @@ void MwForceRender2(MwWidget handle, void* ptr) { MwForceRender(handle); } +void MwForceRender_Internal(MwWidget handle) { + MwForceRender(handle); +} + +void MwForceRender2_Internal(MwWidget handle, void* ptr) { + (void)ptr; + + MwForceRender(handle); +} + void MwAddTickList(MwWidget handle) { MwWidget root = handle; while(root->parent != NULL) root = root->parent; diff --git a/src/dialog/colorpicker.c b/src/dialog/colorpicker.c index c08b535..3a26ad8 100644 --- a/src/dialog/colorpicker.c +++ b/src/dialog/colorpicker.c @@ -158,7 +158,7 @@ static void color_picker_image_update(color_picker_t* picker) { /* printf("%d\n", n); */ } -static void color_picker_click(MwWidget handle, void* user, void* call) { +static void MWAPI color_picker_click(MwWidget handle, void* user, void* call) { color_picker_t* picker = user; MwMouse* mouse = call; char hexColor[8]; @@ -190,7 +190,7 @@ static void color_picker_click(MwWidget handle, void* user, void* call) { MwSetText(picker->color_display_text, MwNbackground, hexColor); MwSetText(picker->color_display_text, MwNtext, hexColor); } -static void color_picker_on_change_value(MwWidget handle, void* user, +static void MWAPI color_picker_on_change_value(MwWidget handle, void* user, void* call) { color_picker_t* picker = user; @@ -206,7 +206,7 @@ static void color_picker_on_change_value(MwWidget handle, void* user, /* color_picker_image_update(picker); */ } -static void color_picker_tick(MwWidget handle, void* user, +static void MWAPI color_picker_tick(MwWidget handle, void* user, void* call) { color_picker_t* picker = user; @@ -224,7 +224,7 @@ static void color_picker_destroy(color_picker_t* picker) { free(picker); } -static void color_picker_close(MwWidget handle, void* user, +static void MWAPI color_picker_close(MwWidget handle, void* user, void* call) { color_picker_t* picker = user; @@ -234,7 +234,7 @@ static void color_picker_close(MwWidget handle, void* user, MwDestroyWidget(handle); } -static void color_display_text_change(MwWidget handle, void* user, +static void MWAPI color_display_text_change(MwWidget handle, void* user, void* call) { color_picker_t* picker = user; char hexColor[9]; @@ -265,7 +265,7 @@ static void color_display_text_change(MwWidget handle, void* user, MwLLFreeColor(color); } -static void color_picker_finish(MwWidget handle, void* user, +static void MWAPI color_picker_finish(MwWidget handle, void* user, void* call) { color_picker_t* picker = user; diff --git a/src/dialog/filechooser.c b/src/dialog/filechooser.c index b65346b..8b603e9 100644 --- a/src/dialog/filechooser.c +++ b/src/dialog/filechooser.c @@ -53,35 +53,35 @@ static void destroy(MwWidget handle) { MwDestroyWidget(handle); } -static void filecancel(MwWidget handle, void* user, void* call) { +static void MWAPI filecancel(MwWidget handle, void* user, void* call) { (void)user; (void)call; destroy(handle->parent); } -static void cancel_window(MwWidget handle, void* user, void* call) { +static void MWAPI cancel_window(MwWidget handle, void* user, void* call) { (void)user; (void)call; destroy(handle); } -static void okay(MwWidget handle, void* user, void* call) { +static void MWAPI okay(MwWidget handle, void* user, void* call) { (void)user; (void)call; destroy(handle->parent); } -static void msgbox_okay(MwWidget handle, void* user, void* call) { +static void MWAPI msgbox_okay(MwWidget handle, void* user, void* call) { (void)user; (void)call; MwDestroyWidget(handle->parent); } -static void files_activate(MwWidget handle, void* user, void* call) { +static void MWAPI files_activate(MwWidget handle, void* user, void* call) { int index = *(int*)call; filechooser_t* fc = handle->parent->opaque; @@ -104,7 +104,7 @@ static void files_activate(MwWidget handle, void* user, void* call) { } } -static void okay_activate(MwWidget handle, void* user, void* call) { +static void MWAPI okay_activate(MwWidget handle, void* user, void* call) { filechooser_t* fc = handle->parent->opaque; char* t = (char*)MwGetText(fc->filename, MwNtext); struct stat s; @@ -140,7 +140,7 @@ static void okay_activate(MwWidget handle, void* user, void* call) { if(p != NULL) free(p); } -static void nav_activate(MwWidget handle, void* user, void* call) { +static void MWAPI nav_activate(MwWidget handle, void* user, void* call) { int index = *(int*)call; const char* e = MwListBoxGet(handle, index); @@ -156,7 +156,7 @@ static void nav_activate(MwWidget handle, void* user, void* call) { } } -static void addr_up_activate(MwWidget handle, void* user, void* call) { +static void MWAPI addr_up_activate(MwWidget handle, void* user, void* call) { filechooser_t* fc = handle->parent->opaque; char* p = MwDirectoryJoin(fc->path, ".."); @@ -168,7 +168,7 @@ static void addr_up_activate(MwWidget handle, void* user, void* call) { free(p); } -static void addr_back_activate(MwWidget handle, void* user, void* call) { +static void MWAPI addr_back_activate(MwWidget handle, void* user, void* call) { filechooser_t* fc = handle->parent->opaque; (void)user; @@ -181,7 +181,7 @@ static void addr_back_activate(MwWidget handle, void* user, void* call) { } } -static void addr_fwd_activate(MwWidget handle, void* user, void* call) { +static void MWAPI addr_fwd_activate(MwWidget handle, void* user, void* call) { filechooser_t* fc = handle->parent->opaque; (void)user; @@ -192,7 +192,7 @@ static void addr_fwd_activate(MwWidget handle, void* user, void* call) { } } -static void addr_activate(MwWidget handle, void* user, void* call) { +static void MWAPI addr_activate(MwWidget handle, void* user, void* call) { (void)user; (void)call; @@ -390,7 +390,7 @@ static void layout(MwWidget handle) { } } -static void resize(MwWidget handle, void* user, void* call) { +static void MWAPI resize(MwWidget handle, void* user, void* call) { (void)user; (void)call; diff --git a/src/dialog/messagebox.c b/src/dialog/messagebox.c index c634b5d..4bb5d34 100644 --- a/src/dialog/messagebox.c +++ b/src/dialog/messagebox.c @@ -24,7 +24,7 @@ static void messagebox_destroy_inject(MwWidget handle) { if((px = MwGetVoid(handle, MwNpixmap)) != NULL) MwLLDestroyPixmap(px); } -static void messagebox_close(MwWidget handle, void* user, void* call) { +static void MWAPI messagebox_close(MwWidget handle, void* user, void* call) { (void)user; (void)call; MwDestroyWidget(handle); diff --git a/src/widget/combobox.c b/src/widget/combobox.c index 2803cbe..dd037e9 100644 --- a/src/widget/combobox.c +++ b/src/widget/combobox.c @@ -78,7 +78,7 @@ static void draw(MwWidget handle) { MwLLFreeColor(base); } -static void listbox_activate(MwWidget handle, void* user, void* client) { +static void MWAPI listbox_activate(MwWidget handle, void* user, void* client) { MwComboBox cb = handle->parent->internal; (void)user; diff --git a/src/widget/listbox.c b/src/widget/listbox.c index 90d5126..c500d3a 100644 --- a/src/widget/listbox.c +++ b/src/widget/listbox.c @@ -54,7 +54,7 @@ static int get_col_width(MwListBox lb, int ind) { return 0; } -static void vscroll_changed(MwWidget handle, void* user, void* call) { +static void MWAPI vscroll_changed(MwWidget handle, void* user, void* call) { MwListBox lb = handle->parent->internal; (void)user; @@ -63,7 +63,7 @@ static void vscroll_changed(MwWidget handle, void* user, void* call) { lb->changed = 1; } -static void frame_mouse_down(MwWidget handle, void* user, void* call) { +static void MWAPI frame_mouse_down(MwWidget handle, void* user, void* call) { MwListBox lb = handle->parent->internal; MwMouse* m = call; @@ -98,7 +98,7 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) { } } -static void frame_mouse_up(MwWidget handle, void* user, void* call) { +static void MWAPI frame_mouse_up(MwWidget handle, void* user, void* call) { MwListBox lb = handle->parent->internal; MwMouse* m = call; @@ -109,7 +109,7 @@ static void frame_mouse_up(MwWidget handle, void* user, void* call) { } } -static void frame_mouse_move(MwWidget handle, void* user, void* call) { +static void MWAPI frame_mouse_move(MwWidget handle, void* user, void* call) { MwListBox lb = handle->parent->internal; MwPoint* p = call; diff --git a/src/widget/treeview.c b/src/widget/treeview.c index 580ecd6..3fe3985 100644 --- a/src/widget/treeview.c +++ b/src/widget/treeview.c @@ -6,7 +6,7 @@ #define LineSpace 16 #define LinePadding 4 -static void vscroll_changed(MwWidget handle, void* user, void* call) { +static void MWAPI vscroll_changed(MwWidget handle, void* user, void* call) { MwTreeView tv = handle->parent->internal; (void)user; @@ -211,7 +211,7 @@ static int recursive_length(MwTreeViewEntry** e) { return l; } -static void frame_mouse_down(MwWidget handle, void* user, void* call) { +static void MWAPI frame_mouse_down(MwWidget handle, void* user, void* call) { MwTreeView tv = handle->parent->internal; MwMouse* mouse = call; @@ -222,7 +222,7 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) { static void resize(MwWidget handle); -static void frame_mouse_up(MwWidget handle, void* user, void* call) { +static void MWAPI frame_mouse_up(MwWidget handle, void* user, void* call) { MwTreeView tv = handle->parent->internal; int shared = 0; int skip = MwGetInteger(tv->vscroll, MwNvalue) * (MwGetInteger(tv->vscroll, MwNmaxValue) - MwGetInteger(tv->vscroll, MwNareaShown)) / MwGetInteger(tv->vscroll, MwNmaxValue); diff --git a/src/widget/viewport.c b/src/widget/viewport.c index ceaab5e..2541b65 100644 --- a/src/widget/viewport.c +++ b/src/widget/viewport.c @@ -1,6 +1,6 @@ #include -static void vscroll_changed(MwWidget handle, void* user, void* call) { +static void MWAPI vscroll_changed(MwWidget handle, void* user, void* call) { MwViewport vp = user; (void)handle; @@ -9,7 +9,7 @@ static void vscroll_changed(MwWidget handle, void* user, void* call) { vp->vchanged = 1; } -static void hscroll_changed(MwWidget handle, void* user, void* call) { +static void MWAPI hscroll_changed(MwWidget handle, void* user, void* call) { MwViewport vp = user; (void)handle;