From 410378b4516b7f9ca541100057b14a22c5f0dd04 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 8 Apr 2015 19:14:22 -0400 Subject: And implemented proper control showing on Mac OS X. --- new/newcontrol_darwin.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'new/newcontrol_darwin.m') diff --git a/new/newcontrol_darwin.m b/new/newcontrol_darwin.m index 04f6c1c..8b0bd48 100644 --- a/new/newcontrol_darwin.m +++ b/new/newcontrol_darwin.m @@ -8,6 +8,7 @@ struct uiSingleViewControl { NSView *view; NSScrollView *scrollView; NSView *immediate; // the control that is added to the parent container; either view or scrollView + uintptr_t parent; }; #define S(c) ((uiSingleViewControl *) (c)) @@ -24,9 +25,17 @@ static uintptr_t singleHandle(uiControl *c) static void singleSetParent(uiControl *c, uintptr_t parent) { - NSView *parentView = (NSView *) parent; - - [parentView addSubview:S(c)->immediate]; + uiSingleViewControl *s = S(c); + uintptr_t oldparent; + NSView *parentView; + + oldparent = s->parent; + s->parent = parent; + parentView = (NSView *) (s->parent); + // TODO will this change parents? + [parentView addSubview:s->immediate]; + updateParent(oldparent); + updateParent(s->parent); } // also good for NSBox and NSProgressIndicator -- cgit v1.2.3