Beispiel #1
0
void uiControlVerifySetParent(uiControl *c, uiControl *parent)
{
	uiControl *curParent;

	if (uiControlToplevel(c))
		userbug("You cannot give a toplevel uiControl a parent. (control: %p)", c);
	curParent = uiControlParent(c);
	if (parent != NULL && curParent != NULL)
		userbug("You cannot give a uiControl a parent while it already has one. (control: %p; current parent: %p; new parent: %p)", c, curParent, parent);
	if (parent == NULL && curParent == NULL)
		implbug("attempt to double unparent uiControl %p", c);
}
Beispiel #2
0
void uiControlVerifySetParent(uiControl *c, uiControl *parent)
{
	uiControl *curParent;

	if (uiControlToplevel(c))
		complain("cannot set a parent on a toplevel (uiWindow)");
	curParent = uiControlParent(c);
	if (parent != NULL && curParent != NULL)
		complain("attempt to reparent uiControl %p (has parent %p, attempt to give parent %p)", c, curParent, parent);
	if (parent == NULL && curParent == NULL)
		// TODO implbug()
		complain("attempt to double unparent uiControl %p — likely an implementation bug ", c);
}
Beispiel #3
0
static Janet janet_ui_top_level(int32_t argc, Janet *argv) {
    janet_fixarity(argc, 1);
    uiControl *c = janet_getcontrol(argv, 0);
    return janet_wrap_boolean(uiControlToplevel(c));
}