// TODO save and restore expands and aligns void uiWindowSetChild(uiWindow *w, uiControl *child) { if (w->child != NULL) { uiControlSetParent(w->child, NULL); uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, TRUE); } w->child = child; if (w->child != NULL) { uiControlSetParent(w->child, uiControl(w)); uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, FALSE); } }
void uiGroupSetChild(uiGroup *g, uiControl *child) { if (g->child != NULL) { uiControlSetParent(g->child, NULL); uiWindowsControlSetParentHWND(uiWindowsControl(g->child), NULL); } g->child = child; if (g->child != NULL) { uiControlSetParent(g->child, uiControl(g)); uiWindowsControlSetParentHWND(uiWindowsControl(g->child), g->hwnd); uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl(g->child)); uiWindowsControlMinimumSizeChanged(uiWindowsControl(g)); } }
void uiWindowSetChild(uiWindow *w, uiControl *child) { if (w->child != NULL) { uiControlSetParent(w->child, NULL); uiWindowsControlSetParentHWND(uiWindowsControl(w->child), NULL); } w->child = child; if (w->child != NULL) { uiControlSetParent(w->child, uiControl(w)); uiWindowsControlSetParentHWND(uiWindowsControl(w->child), w->hwnd); uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl(w->child)); windowRelayout(w); } }
static Janet janet_ui_parent(int32_t argc, Janet *argv) { uiControl *c, *d; janet_arity(argc, 1, 2); c = janet_getcontrol(argv, 0); if (argc == 2) { d = janet_getcontrol(argv, 1); uiControlSetParent(c, d); return argv[0]; } return janet_ui_handle_to_control(uiControlParent(c), &control_td); }
static void uiGroupDestroy(uiControl *c) { uiGroup *g = uiGroup(c); if (g->child != NULL) { uiControlSetParent(g->child, NULL); uiControlDestroy(g->child); } uiWindowsEnsureDestroyWindow(g->hwnd); uiFreeControl(uiControl(g)); }
void uiFormDelete(uiForm *f, int index) { struct formChild fc; fc = (*(f->controls))[index]; uiControlSetParent(fc.c, NULL); uiWindowsControlSetParentHWND(uiWindowsControl(fc.c), NULL); uiWindowsEnsureDestroyWindow(fc.label); f->controls->erase(f->controls->begin() + index); formArrangeChildren(f); uiWindowsControlMinimumSizeChanged(uiWindowsControl(f)); }
static void uiFormDestroy(uiControl *c) { uiForm *f = uiForm(c); for (const struct formChild &fc : *(f->controls)) { uiControlSetParent(fc.c, NULL); uiControlDestroy(fc.c); uiWindowsEnsureDestroyWindow(fc.label); } delete f->controls; uiWindowsEnsureDestroyWindow(f->hwnd); uiFreeControl(uiControl(f)); }
void uiprivChildRemove(uiprivChild *c) { uiControlSetParent(c->c, NULL); uiUnixControlSetContainer(uiUnixControl(c->c), c->parent, TRUE); gtk_widget_set_hexpand(c->widget, c->oldhexpand); gtk_widget_set_halign(c->widget, c->oldhalign); gtk_widget_set_vexpand(c->widget, c->oldvexpand); gtk_widget_set_valign(c->widget, c->oldvalign); if (c->box != NULL) gtk_widget_destroy(c->box); uiprivFree(c); }
static void uiWindowDestroy(uiControl *c) { uiWindow *w = uiWindow(c); // first hide ourselves ShowWindow(w->hwnd, SW_HIDE); // now destroy the child if (w->child != NULL) { uiControlSetParent(w->child, NULL); uiControlDestroy(w->child); } // now free the menubar, if any if (w->menubar != NULL) freeMenubar(w->menubar); // and finally free ourselves windows.erase(w); uiWindowsEnsureDestroyWindow(w->hwnd); uiFreeControl(uiControl(w)); }
void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy) { struct formChild fc; WCHAR *wlabel; fc.c = c; wlabel = toUTF16(label); fc.label = uiWindowsEnsureCreateControlHWND(0, L"STATIC", wlabel, SS_LEFT | SS_NOPREFIX, hInstance, NULL, TRUE); uiFree(wlabel); uiWindowsEnsureSetParentHWND(fc.label, f->hwnd); fc.stretchy = stretchy; uiControlSetParent(fc.c, uiControl(f)); uiWindowsControlSetParentHWND(uiWindowsControl(fc.c), f->hwnd); f->controls->push_back(fc); formArrangeChildren(f); uiWindowsControlMinimumSizeChanged(uiWindowsControl(f)); }
uiprivChild *uiprivNewChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer) { uiprivChild *c; if (child == NULL) return NULL; c = uiprivNew(uiprivChild); c->c = child; c->widget = GTK_WIDGET(uiControlHandle(c->c)); c->oldhexpand = gtk_widget_get_hexpand(c->widget); c->oldhalign = gtk_widget_get_halign(c->widget); c->oldvexpand = gtk_widget_get_vexpand(c->widget); c->oldvalign = gtk_widget_get_valign(c->widget); uiControlSetParent(c->c, parent); uiUnixControlSetContainer(uiUnixControl(c->c), parentContainer, FALSE); c->parent = parentContainer; return c; }
static void uiWindowDestroy(uiControl *c) { uiWindow *w = uiWindow(c); // first hide ourselves gtk_widget_hide(w->widget); // now destroy the child if (w->child != NULL) { uiControlSetParent(w->child, NULL); uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, TRUE); uiControlDestroy(w->child); } // now destroy the menus, if any if (w->menubar != NULL) freeMenubar(w->menubar); gtk_widget_destroy(w->childHolderWidget); gtk_widget_destroy(w->vboxWidget); // and finally free ourselves // use gtk_widget_destroy() instead of g_object_unref() because GTK+ has internal references (see #165) gtk_widget_destroy(w->widget); uiFreeControl(uiControl(w)); }