diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-07 20:28:28 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-07 20:28:28 -0400 |
| commit | 1bb187d55bad0b34b1fad22f77ce88a9d42e79dd (patch) | |
| tree | b87e70630f9ec66da6b7d7fefb6c2dce3a7fb9a3 | |
| parent | 89643f70f73e76d8b6484255c3460757715ceeb5 (diff) | |
Implemented new control preferredSize() on Mac OS X. Now that Stack works everywhere, I can resolve TODOs.
| -rw-r--r-- | new/newcontrol_darwin.m | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/new/newcontrol_darwin.m b/new/newcontrol_darwin.m index 10f2438..cb5388f 100644 --- a/new/newcontrol_darwin.m +++ b/new/newcontrol_darwin.m @@ -25,12 +25,19 @@ static void singleSetParent(uiControl *c, uintptr_t parent) [parentView addSubview:S(c)->immediate]; } +// also good for NSBox and NSProgressIndicator static uiSize singlePreferredSize(uiControl *c, uiSizing *d) { uiSize size; + NSControl *control; + NSRect r; - // TODO - size.width = size.height = 0; + control = (NSControl *) (S(c)->view); + [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; } |
