示例#1
0
文件: window.c 项目: Alcaro/RetroArch
// 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);
	}
}
示例#2
0
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));
	}
}
示例#3
0
文件: window.cpp 项目: 08opt/libui
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);
	}
}
示例#4
0
文件: main.c 项目: janet-lang/janetui
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);
}
示例#5
0
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));
}
示例#6
0
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));
}
示例#7
0
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));
}
示例#8
0
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);
}
示例#9
0
文件: window.cpp 项目: 08opt/libui
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));
}
示例#10
0
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));
}
示例#11
0
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;
}
示例#12
0
文件: window.c 项目: Alcaro/RetroArch
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));
}