mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-10 11:23:29 +00:00
c++ guard
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@40 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -4,6 +4,14 @@
|
|||||||
|
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
MWDECL MwClass MwButtonClass;
|
MWDECL MwClass MwButtonClass;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,11 +6,15 @@
|
|||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
|
||||||
#define MwDispatch(x, y) \
|
#define MwDispatch(x, y) \
|
||||||
if(x->class != NULL && x->class->y != NULL) x->class->y(x)
|
if(x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x)
|
||||||
|
|
||||||
MWDECL MwWidget MwCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
|
#ifdef __cplusplus
|
||||||
MWDECL MwWidget MwVaCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
|
extern "C" {
|
||||||
MWDECL MwWidget MwVaListCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va);
|
#endif
|
||||||
|
|
||||||
|
MWDECL MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
|
||||||
|
MWDECL MwWidget MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
|
||||||
|
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 void MwDestroyWidget(MwWidget handle);
|
MWDECL void MwDestroyWidget(MwWidget handle);
|
||||||
|
|
||||||
MWDECL void MwLoop(MwWidget handle);
|
MWDECL void MwLoop(MwWidget handle);
|
||||||
@@ -28,4 +32,8 @@ MWDECL void MwVaListApply(MwWidget handle, va_list va);
|
|||||||
MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
|
MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
|
||||||
MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
|
MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
|
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
MWDECL const char* MwDefaultBackground;
|
MWDECL const char* MwDefaultBackground;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,9 +6,17 @@
|
|||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
#include <Mw/LowLevel.h>
|
#include <Mw/LowLevel.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
MWDECL MwLLColor MwParseColor(MwWidget handle, const char* text);
|
MWDECL MwLLColor MwParseColor(MwWidget handle, const char* text);
|
||||||
|
|
||||||
MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
|
MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
|
||||||
MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
|
MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ struct _MwLLHandler {
|
|||||||
void (*down)(MwLL handle);
|
void (*down)(MwLL handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* lowlevel.c, common part */
|
/* lowlevel.c, common part */
|
||||||
MWDECL void MwLLCreateCommon(MwLL handle);
|
MWDECL void MwLLCreateCommon(MwLL handle);
|
||||||
MWDECL void MwLLDestroyCommon(MwLL handle);
|
MWDECL void MwLLDestroyCommon(MwLL handle);
|
||||||
@@ -55,4 +59,8 @@ MWDECL int MwLLPending(MwLL handle);
|
|||||||
MWDECL void MwLLNextEvent(MwLL handle);
|
MWDECL void MwLLNextEvent(MwLL handle);
|
||||||
MWDECL void MwLLSleep(int ms);
|
MWDECL void MwLLSleep(int ms);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ struct _MwWidget {
|
|||||||
MwLL lowlevel;
|
MwLL lowlevel;
|
||||||
MwWidget parent;
|
MwWidget parent;
|
||||||
MwWidget* children;
|
MwWidget* children;
|
||||||
MwClass class;
|
MwClass widget_class;
|
||||||
|
|
||||||
int pressed;
|
int pressed;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
|
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
MWDECL MwClass MwWindowClass;
|
MWDECL MwClass MwWindowClass;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
20
src/core.c
20
src/core.c
@@ -20,17 +20,17 @@ static void lldownhandler(MwLL handle) {
|
|||||||
h->pressed = 1;
|
h->pressed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwWidget MwCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
|
MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
|
||||||
MwWidget h = malloc(sizeof(*h));
|
MwWidget h = malloc(sizeof(*h));
|
||||||
|
|
||||||
h->name = malloc(strlen(name) + 1);
|
h->name = malloc(strlen(name) + 1);
|
||||||
strcpy(h->name, name);
|
strcpy(h->name, name);
|
||||||
|
|
||||||
h->parent = parent;
|
h->parent = parent;
|
||||||
h->children = NULL;
|
h->children = NULL;
|
||||||
h->lowlevel = MwLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height);
|
h->lowlevel = MwLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height);
|
||||||
h->class = class;
|
h->widget_class = widget_class;
|
||||||
h->pressed = 0;
|
h->pressed = 0;
|
||||||
|
|
||||||
h->lowlevel->user = h;
|
h->lowlevel->user = h;
|
||||||
h->lowlevel->handler->draw = lldrawhandler;
|
h->lowlevel->handler->draw = lldrawhandler;
|
||||||
@@ -51,21 +51,21 @@ MwWidget MwCreateWidget(MwClass class, const char* name, MwWidget parent, int x,
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwWidget MwVaCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...) {
|
MwWidget MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...) {
|
||||||
MwWidget h;
|
MwWidget h;
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
va_start(va, height);
|
va_start(va, height);
|
||||||
h = MwVaListCreateWidget(class, name, parent, x, y, width, height, va);
|
h = MwVaListCreateWidget(widget_class, name, parent, x, y, width, height, va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
MwWidget MwVaListCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va) {
|
MwWidget MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va) {
|
||||||
MwWidget h;
|
MwWidget h;
|
||||||
|
|
||||||
h = MwCreateWidget(class, name, parent, x, y, width, height);
|
h = MwCreateWidget(widget_class, name, parent, x, y, width, height);
|
||||||
MwVaListApply(h, va);
|
MwVaListApply(h, va);
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
|
|||||||
Reference in New Issue
Block a user