stuff
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@9 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
bf857097e5
commit
8c788c3911
6 changed files with 63 additions and 10 deletions
33
src/core.c
33
src/core.c
|
|
@ -1,10 +1,41 @@
|
|||
/* $Id$ */
|
||||
#include <Milsko/Milsko.h>
|
||||
|
||||
HMILSKO MilskoCreateWidget(HMILSKO parent, int x, int y, unsigned int width, unsigned int height) {
|
||||
#include "stb_ds.h"
|
||||
|
||||
HMILSKO MilskoCreateWidget(MilskoClass class, HMILSKO parent, int x, int y, unsigned int width, unsigned int height) {
|
||||
HMILSKO h = malloc(sizeof(*h));
|
||||
|
||||
h->parent = parent;
|
||||
h->children = NULL;
|
||||
h->lowlevel = MilskoLLCreate(parent->lowlevel, x, y, width, height);
|
||||
|
||||
arrput(parent->children, h);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
void MilskoDestroyWidget(HMILSKO handle) {
|
||||
int i;
|
||||
|
||||
if(handle->children != NULL) {
|
||||
for(i = 0; i < arrlen(handle->children); i++) {
|
||||
if(handle->children[i] == handle) {
|
||||
MilskoDestroyWidget(handle->children[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
arrfree(handle->children);
|
||||
}
|
||||
|
||||
if(handle->parent != NULL) {
|
||||
for(i = 0; i < arrlen(handle->parent->children); i++) {
|
||||
if(handle->parent->children[i] == handle) {
|
||||
arrdel(handle->parent->children, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MilskoLLDestroy(handle->lowlevel);
|
||||
free(handle);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue