git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@131 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-02 02:17:27 +00:00
parent 42e1558c23
commit 81c47a9733
10 changed files with 225 additions and 35 deletions

View File

@@ -55,9 +55,13 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
h->name = malloc(strlen(name) + 1);
strcpy(h->name, name);
h->parent = parent;
h->children = NULL;
h->lowlevel = MwLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height);
h->parent = parent;
h->children = NULL;
if((h->lowlevel = MwLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height)) == NULL) {
free(h->name);
free(h);
return NULL;
}
h->widget_class = widget_class;
h->pressed = 0;
h->close = 0;
@@ -115,10 +119,8 @@ void MwDestroyWidget(MwWidget handle) {
if(handle->children != NULL) {
for(i = 0; i < arrlen(handle->children); i++) {
if(handle->children[i] == handle) {
MwDestroyWidget(handle->children[i]);
break;
}
MwDestroyWidget(handle->children[i]);
break;
}
arrfree(handle->children);
}