And implemented proper control showing on Mac OS X.
This commit is contained in:
parent
f470768a8e
commit
310fbe58fd
|
@ -23,12 +23,27 @@ uiLogObjCClassAllocations
|
|||
}
|
||||
|
||||
- (void)setFrameSize:(NSSize)s
|
||||
{
|
||||
[super setFrameSize:s];
|
||||
[self uiUpdateNow];
|
||||
}
|
||||
|
||||
- (void)uiUpdateNow
|
||||
{
|
||||
uiSizing d;
|
||||
|
||||
[super setFrameSize:s];
|
||||
if (self.child != NULL)
|
||||
(*(self.child->resize))(self.child, [self bounds].origin.y, [self bounds].origin.y, [self bounds].size.width, [self bounds].size.height, &d);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void updateParent(uintptr_t parent)
|
||||
{
|
||||
uiContainer *c;
|
||||
|
||||
if (parent == 0)
|
||||
return;
|
||||
c = (uiContainer *) parent;
|
||||
[c uiUpdateNow];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
uiSingleViewControl *s = S(c);
|
||||
uintptr_t oldparent;
|
||||
NSView *parentView;
|
||||
|
||||
[parentView addSubview:S(c)->immediate];
|
||||
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
|
||||
|
|
|
@ -36,5 +36,7 @@ extern void setStandardControlFont(NSControl *);
|
|||
|
||||
// container_darwin.m
|
||||
@interface uiContainer : NSView
|
||||
// TODO rename to uiChild
|
||||
@property uiControl *child;
|
||||
- (void)uiUpdateNow;
|
||||
@end
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
// 6 april 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODO
|
||||
// - showing on size
|
||||
|
||||
@interface uiWindowDelegate : NSObject <NSWindowDelegate>
|
||||
@property (assign) NSWindow *w;
|
||||
@property (assign) uiContainer *container;
|
||||
|
|
Loading…
Reference in New Issue