mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 08:00:50 +00:00
merge generic_func_idea from git
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@433 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -91,6 +91,22 @@ MWDECL MwWidget MwVaListCreateWidget(MwClass widget_class, const char* name, MwW
|
||||
*/
|
||||
MWDECL void MwDestroyWidget(MwWidget handle);
|
||||
|
||||
/*!
|
||||
* %brief Executes a method specific to the widget (varadic version).
|
||||
* %warning Prefer using corresponding functions for better code clarity and type safety.
|
||||
* %param handle Widget
|
||||
* %param ... Widget function arguments.
|
||||
*/
|
||||
MWDECL void MwWidgetExecute(MwWidget handle, const char* func_name, void* out, ...);
|
||||
|
||||
/*!
|
||||
* %brief Executes a method specific to the widget (va_list version).
|
||||
* %warning Prefer using corresponding functions for better code clarity and type safety.
|
||||
* %param handle Widget
|
||||
* %param va Widget function arguments.
|
||||
*/
|
||||
MWDECL void MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va);
|
||||
|
||||
/*!
|
||||
* %brief Runs the main loop
|
||||
* %param handle Widget
|
||||
|
||||
@@ -39,4 +39,6 @@
|
||||
#define MWDECL extern
|
||||
#endif
|
||||
|
||||
#define MwInline __inline
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@ typedef void (*MwHandler4)(MwWidget handle, int key);
|
||||
typedef void (*MwHandler5)(MwWidget handle, void* ptr);
|
||||
typedef void (*MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
|
||||
typedef void (*MwErrorHandler)(int code, const char* message, void* user_data);
|
||||
typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args);
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L || __GNUC__ > 2
|
||||
typedef unsigned long long MwOffset;
|
||||
@@ -174,21 +175,21 @@ struct _MwCursor {
|
||||
};
|
||||
|
||||
struct _MwClass {
|
||||
MwHandler2 create;
|
||||
MwHandler destroy;
|
||||
MwHandler draw;
|
||||
MwHandler click;
|
||||
MwHandler parent_resize;
|
||||
MwHandler3 prop_change;
|
||||
MwHandler mouse_move;
|
||||
MwHandler5 mouse_up;
|
||||
MwHandler5 mouse_down;
|
||||
MwHandler4 key;
|
||||
void* reserved1;
|
||||
void* reserved2;
|
||||
void* reserved3;
|
||||
void* reserved4;
|
||||
void* reserved5;
|
||||
MwHandler2 create;
|
||||
MwHandler destroy;
|
||||
MwHandler draw;
|
||||
MwHandler click;
|
||||
MwHandler parent_resize;
|
||||
MwHandler3 prop_change;
|
||||
MwHandler mouse_move;
|
||||
MwHandler5 mouse_up;
|
||||
MwHandler5 mouse_down;
|
||||
MwHandler4 key;
|
||||
MwHandlerExecute execute;
|
||||
void* reserved2;
|
||||
void* reserved3;
|
||||
void* reserved4;
|
||||
void* reserved5;
|
||||
};
|
||||
|
||||
struct _MwFont {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -26,7 +27,7 @@ MWDECL MwClass MwListBoxClass;
|
||||
* %param pixmap Pixmap
|
||||
* %param ... Text
|
||||
*/
|
||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...); /* VA_HINT:pixmap */
|
||||
void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...); /* VA_HINT:pixmap */
|
||||
|
||||
/*!
|
||||
* %brief Inserts multiple items on the listbox
|
||||
@@ -36,7 +37,7 @@ MWDECL void MwListBoxInsert(MwWidget handle, int index, MwLLPixmap pixmap, ...);
|
||||
* %param pixmap Pixmap
|
||||
* %param ... Text
|
||||
*/
|
||||
MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, ...); /* VA_HINT:pixmap */
|
||||
void MwListBoxInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, ...); /* VA_HINT:pixmap */
|
||||
|
||||
/*!
|
||||
* %brief Inserts item on the listbox
|
||||
@@ -45,7 +46,7 @@ MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, int count, MwLLP
|
||||
* %param pixmap Pixmap
|
||||
* %param va Text
|
||||
*/
|
||||
MWDECL void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_list va);
|
||||
void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_list va);
|
||||
|
||||
/*!
|
||||
* %brief Inserts multiple items on the listbox
|
||||
@@ -55,14 +56,16 @@ MWDECL void MwListBoxVaInsert(MwWidget handle, int index, MwLLPixmap pixmap, va_
|
||||
* %param pixmap Pixmap
|
||||
* %param va Text
|
||||
*/
|
||||
MWDECL void MwListBoxVaInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, va_list va);
|
||||
void MwListBoxVaInsertMultiple(MwWidget handle, int index, int count, MwLLPixmap* pixmap, va_list va);
|
||||
|
||||
/*!
|
||||
* %brief Deletes item from the listbox
|
||||
* %param handle Widget
|
||||
* %param index Index
|
||||
*/
|
||||
MWDECL void MwListBoxDelete(MwWidget handle, int index);
|
||||
MwInline void MwListBoxDelete(MwWidget handle, int index) {
|
||||
MwWidgetExecute(handle, "mwListboxDelete", NULL, index);
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Gets item from the listbox
|
||||
@@ -70,7 +73,11 @@ MWDECL void MwListBoxDelete(MwWidget handle, int index);
|
||||
* %param index Index
|
||||
* %return Item
|
||||
*/
|
||||
MWDECL const char* MwListBoxGet(MwWidget handle, int index);
|
||||
MwInline const char* MwListBoxGet(MwWidget handle, int index) {
|
||||
const char* out;
|
||||
MwWidgetExecute(handle, "mwListBoxGet", &out, index);
|
||||
return out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Sets an item width of the listbox
|
||||
@@ -78,13 +85,17 @@ MWDECL const char* MwListBoxGet(MwWidget handle, int index);
|
||||
* %param index Column index
|
||||
* %param width Width
|
||||
*/
|
||||
MWDECL void MwListBoxSetWidth(MwWidget handle, int index, int width);
|
||||
MwInline void MwListBoxSetWidth(MwWidget handle, int index, int width) {
|
||||
MwWidgetExecute(handle, "mwListBoxSetWidth", NULL, index, width);
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Resets the listbox
|
||||
* %param handle Widget
|
||||
*/
|
||||
MWDECL void MwListBoxReset(MwWidget handle);
|
||||
MwInline void MwListBoxReset(MwWidget handle) {
|
||||
MwWidgetExecute(handle, "mwListBoxReset", NULL, handle);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -25,7 +26,11 @@ MWDECL MwClass MwMenuClass;
|
||||
* %param name Menu name
|
||||
* %return Menu
|
||||
*/
|
||||
MWDECL MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name);
|
||||
MwInline MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
|
||||
MwMenu out;
|
||||
MwWidgetExecute(handle, "mwMenuAdd", &out, menu, name);
|
||||
return out;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@@ -33,7 +34,9 @@ MWDECL MwClass MwOpenGLClass;
|
||||
* %brief Make a widget current OpenGL context
|
||||
* %param handle Widget
|
||||
*/
|
||||
MWDECL void MwOpenGLMakeCurrent(MwWidget handle);
|
||||
MwInline void MwOpenGLMakeCurrent(MwWidget handle) {
|
||||
MwWidgetExecute(handle, "mwOpenGLMakeCurrent", NULL);
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Get a procedure from OpenGL
|
||||
@@ -41,13 +44,19 @@ MWDECL void MwOpenGLMakeCurrent(MwWidget handle);
|
||||
* %param name Name
|
||||
* %return Procedure
|
||||
*/
|
||||
MWDECL void* MwOpenGLGetProcAddress(MwWidget handle, const char* name);
|
||||
MwInline void* MwOpenGLGetProcAddress(MwWidget handle, const char* name) {
|
||||
void* out;
|
||||
MwWidgetExecute(handle, "mwOpenGLGetProcAddress", &out, name);
|
||||
return out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Swaps the buffer of OpenGL context
|
||||
* %param handle Widget
|
||||
*/
|
||||
MWDECL void MwOpenGLSwapBuffer(MwWidget handle);
|
||||
MwInline void MwOpenGLSwapBuffer(MwWidget handle) {
|
||||
MwWidgetExecute(handle, "mwOpenGLSwapBuffer", NULL);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -24,7 +25,11 @@ MWDECL MwClass MwScrollBarClass;
|
||||
* %param handle Widget
|
||||
* %return Visible length
|
||||
*/
|
||||
MWDECL int MwScrollBarGetVisibleLength(MwWidget handle);
|
||||
MwInline int MwScrollBarGetVisibleLength(MwWidget handle) {
|
||||
int out;
|
||||
MwWidgetExecute(handle, "mwScrollBarGetVisibleLength", &out, NULL);
|
||||
return out;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -18,7 +19,9 @@ extern "C" {
|
||||
*/
|
||||
MWDECL MwClass MwSubMenuClass;
|
||||
|
||||
MWDECL void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point);
|
||||
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
MwWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -23,7 +24,11 @@ MWDECL MwClass MwViewportClass;
|
||||
* %param handle Widget
|
||||
* %return Widget
|
||||
*/
|
||||
MWDECL MwWidget MwViewportGetViewport(MwWidget handle);
|
||||
MwInline MwWidget MwViewportGetViewport(MwWidget handle) {
|
||||
MwWidget out;
|
||||
MwWidgetExecute(handle, "mwViewportGetViewport", &out);
|
||||
return out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Set viewport size
|
||||
@@ -31,7 +36,9 @@ MWDECL MwWidget MwViewportGetViewport(MwWidget handle);
|
||||
* %param w Width
|
||||
* %param h Height
|
||||
*/
|
||||
MWDECL void MwViewportSetSize(MwWidget handle, int w, int h);
|
||||
MwInline void MwViewportSetSize(MwWidget handle, int w, int h) {
|
||||
MwWidgetExecute(handle, "mwViewportSetSize", NULL, w, h);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
#include <Mw/Error.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -112,7 +113,11 @@ typedef enum MwVulkanField_T {
|
||||
* %brief Function for getting a field from within Vulkan.
|
||||
* %warning Consult the documentation for MwVulkanField to know what type is expected for out.
|
||||
*/
|
||||
MWDECL void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out);
|
||||
MwInline void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
void* field_out;
|
||||
MwWidgetExecute(handle, "mwVulkanGetField", &field_out, field, out);
|
||||
return field_out;
|
||||
};
|
||||
|
||||
/*!
|
||||
* %brief Return whether Vulkan is installed on the target platform.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
#include <Mw/Core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -24,7 +25,9 @@ MWDECL MwClass MwWindowClass;
|
||||
* %param handle Widget
|
||||
* %param toggle Toggle
|
||||
*/
|
||||
MWDECL void MwWindowMakeBorderless(MwWidget handle, int toggle);
|
||||
MwInline void MwWindowMakeBorderless(MwWidget handle, int toggle) {
|
||||
MwWidgetExecute(handle, "mwWindowMakeBorderless", NULL, toggle);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user