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

View File

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

View File

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