add MwReparent

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@726 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-15 15:19:35 +00:00
parent 45c8395839
commit d7325cd228
6 changed files with 55 additions and 32 deletions

View File

@@ -271,9 +271,15 @@ static void clean_destroy_queue(MwWidget handle) {
}
int MwStep(MwWidget handle) {
int i;
int i;
MwWidget* widgets = NULL;
if(setjmp(handle->before_step)) return 0;
for(i = 0; i < arrlen(handle->children); i++) MwStep(handle->children[i]);
for(i = 0; i < arrlen(handle->children); i++) {
arrput(widgets, handle->children[i]);
}
for(i = 0; i < arrlen(widgets); i++) MwStep(widgets[i]);
arrfree(widgets);
handle->prop_event = 0;
if(handle->lowlevel != NULL && MwLLPending(handle->lowlevel)) MwLLNextEvent(handle->lowlevel);
@@ -639,3 +645,18 @@ int MwLibraryInit(void) {
void MwShow(MwWidget handle, int toggle) {
MwLLShow(handle->lowlevel, toggle);
}
void MwReparent(MwWidget handle, MwWidget new_parent) {
if(handle->parent != NULL) {
int i;
for(i = 0; i < arrlen(handle->parent->children); i++) {
if(handle->parent->children[i] == handle) {
arrdel(handle->parent->children, i);
break;
}
}
}
handle->parent = new_parent;
arrput(new_parent->children, handle);
}