Implemented new control preferredSize() on Mac OS X. Now that Stack works everywhere, I can resolve TODOs.

This commit is contained in:
Pietro Gagliardi 2015-04-07 20:28:28 -04:00
parent a6f175767e
commit 05a1cc535a
1 changed files with 9 additions and 2 deletions

View File

@ -25,12 +25,19 @@ static void singleSetParent(uiControl *c, uintptr_t parent)
[parentView addSubview:S(c)->immediate]; [parentView addSubview:S(c)->immediate];
} }
// also good for NSBox and NSProgressIndicator
static uiSize singlePreferredSize(uiControl *c, uiSizing *d) static uiSize singlePreferredSize(uiControl *c, uiSizing *d)
{ {
uiSize size; uiSize size;
NSControl *control;
NSRect r;
// TODO control = (NSControl *) (S(c)->view);
size.width = size.height = 0; [control sizeToFit];
// use alignmentRect here instead of frame because we'll be resizing based on that
r = [control alignmentRectForFrame:[control frame]];
size.width = (intmax_t) r.size.width;
size.height = (intmax_t) r.size.height;
return size; return size;
} }