Attempted to fill in uiGroup; also fixed uiUninit() bugs.

This commit is contained in:
Pietro Gagliardi 2015-08-17 17:27:27 -04:00
parent ab9432cc7e
commit f2e30548fc
3 changed files with 28 additions and 7 deletions

View File

@ -8,13 +8,23 @@ struct uiGroup {
int margined;
};
static void onDestroy(uiGroup *);
uiDarwinDefineControlWithOnDestroy(
uiGroup, // type name
uiGroupType, // type function
box, // handle
/* TODO */; // on destroy
onDestroy(this); // on destroy
)
static void onDestroy(uiGroup *g)
{
if (g->child != NULL) {
uiControlSetParent(g->child, NULL);
uiControlDestroy(g->child);
}
}
// TODO group container update
char *uiGroupTitle(uiGroup *g)
@ -31,15 +41,20 @@ void uiGroupSetTitle(uiGroup *g, const char *text)
void uiGroupSetChild(uiGroup *g, uiControl *child)
{
/* TODO
if (g->child != NULL)
NSView *childView;
if (g->child != NULL) {
childView = (NSView *) uiControlHandle(g->child);
[childView removeFromSuperview];
uiControlSetParent(g->child, NULL);
}
g->child = child;
if (g->child != NULL) {
childView = (NSView *) uiControlHandle(g->child);
uiControlSetParent(g->child, uiControl(g));
//TODO uiControlQueueResize(g->child);
[g->box addSubview:childView];
layoutSingleView(g->box, childView, g->margined);
}
*/
}
int uiGroupMargined(uiGroup *g)
@ -49,9 +64,13 @@ int uiGroupMargined(uiGroup *g)
void uiGroupSetMargined(uiGroup *g, int margined)
{
NSView *childView;
g->margined = margined;
// TODO
//TODO uiControlQueueResize(uiControl(g));
if (g->child != NULL) {
childView = (NSView *) uiControlHandle(g->child);
layoutSingleView(g->box, childView, g->margined);
}
}
uiGroup *uiNewGroup(const char *title)

View File

@ -91,6 +91,7 @@ void uiUninit(void)
uninitMenus();
// TODO free application delegate
// TODO free NSApplication resources (main menu, etc.)
uninitTypes();
uninitAlloc();
}

View File

@ -32,6 +32,7 @@ static void onDestroy(uiTab *t)
uiControl *c;
c = (uiControl *) [v pointerValue];
uiControlSetParent(c, NULL);
uiControlDestroy(c);
}];
// and finally destroy ourselves