bad solution

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@30 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-28 21:55:50 +00:00
parent c2b08729ef
commit 61b442d259
7 changed files with 92 additions and 63 deletions

View File

@@ -3,12 +3,9 @@
#include "stb_ds.h"
#define Dispatch(x, y) \
if(x->class != NULL && x->class->y != NULL) x->class->y(x)
static void llhandler(MilskoLL handle) {
MilskoWidget h = (MilskoWidget)handle->user;
Dispatch(h, draw);
MilskoDispatch(h, draw);
}
MilskoWidget MilskoCreateWidget(MilskoClass class, const char* name, MilskoWidget parent, int x, int y, unsigned int width, unsigned int height) {
@@ -22,8 +19,8 @@ MilskoWidget MilskoCreateWidget(MilskoClass class, const char* name, MilskoWidge
h->lowlevel = MilskoLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height);
h->class = class;
h->lowlevel->user = h;
h->lowlevel->draw = llhandler;
h->lowlevel->user = h;
h->lowlevel->callback->draw = llhandler;
if(parent != NULL) arrput(parent->children, h);
@@ -33,7 +30,7 @@ MilskoWidget MilskoCreateWidget(MilskoClass class, const char* name, MilskoWidge
shdefault(h->text, NULL);
shdefault(h->integer, -1);
Dispatch(h, create);
MilskoDispatch(h, create);
return h;
}
@@ -41,7 +38,7 @@ MilskoWidget MilskoCreateWidget(MilskoClass class, const char* name, MilskoWidge
void MilskoDestroyWidget(MilskoWidget handle) {
int i;
Dispatch(handle, destroy);
MilskoDispatch(handle, destroy);
free(handle->name);