diff --git a/redo/reredo/darwin/box.m b/redo/reredo/darwin/box.m index f9528efd..c795c2da 100644 --- a/redo/reredo/darwin/box.m +++ b/redo/reredo/darwin/box.m @@ -197,6 +197,9 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy) [b->children addObject:[NSValue valueWithPointer:c]]; [b->stretchy addObject:[NSNumber numberWithInt:stretchy]]; + uiControlSetParent(c, uiControl(b)); + [b->view addSubview:childView]; + // TODO save the old hugging priorities // if a control is stretchy, it should not hug in the primary direction // otherwise, it should *forcibly* hug @@ -208,7 +211,6 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy) // make sure controls don't hug their secondary direction so they fill the width of the view setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->secondaryOrientation); - uiControlSetParent(c, uiControl(b)); relayout(b); } @@ -216,9 +218,12 @@ void uiBoxDelete(uiBox *b, uintmax_t n) { NSValue *v; uiControl *removed; + NSView *removedView; v = (NSValue *) [b->children objectAtIndex:n]; removed = (uiControl *) [v pointerValue]; + removedView = (NSView *) uiControlHandle(removed); + [removedView removeFromSuperview]; uiControlSetParent(removed, NULL); [b->children removeObjectAtIndex:n]; [b->stretchy removeObjectAtIndex:n]; diff --git a/redo/reredo/darwin/control.m b/redo/reredo/darwin/control.m index 1a6ab658..62bad8bc 100644 --- a/redo/reredo/darwin/control.m +++ b/redo/reredo/darwin/control.m @@ -15,6 +15,11 @@ void osCommitShow(uiControl *c) NSView *view; view = (NSView *) uiControlHandle(c); + // TODO + if ([view isKindOfClass:[NSWindow class]]) { + [view makeKeyAndOrderFront:view]; + return; + } [view setHidden:NO]; } @@ -50,6 +55,9 @@ void uiDarwinFinishControl(uiControl *c) view = (NSView *) uiControlHandle(c); [view retain]; + // TODO omit this for uiWindow properly + if ([view respondsToSelector:@selector(setTranslatesAutoresizingMaskIntoConstraints:)]) + [view setTranslatesAutoresizingMaskIntoConstraints:NO]; } void uiDarwinSetControlFont(NSControl *c, NSControlSize size)