Used the alignment rect instead of the frame for laying out and sizing controls on Mac OS X. Also updated the future plans document.

This commit is contained in:
Pietro Gagliardi 2014-10-24 19:13:18 -04:00
parent eb57383434
commit 643875c882
3 changed files with 6 additions and 6 deletions

View File

@ -41,6 +41,8 @@ void moveControl(id c, intptr_t x, intptr_t y, intptr_t width, intptr_t height)
// mac os x coordinate system has (0,0) in the lower-left // mac os x coordinate system has (0,0) in the lower-left
v = toNSView(c); v = toNSView(c);
frame.origin.y = ([[v superview] bounds].size.height - frame.size.height) - frame.origin.y; frame.origin.y = ([[v superview] bounds].size.height - frame.size.height) - frame.origin.y;
// here's the magic: what we specified was what we want the alignment rect to be; make it the actual frame
frame = [v frameForAlignmentRect:frame];
[v setFrame:frame]; [v setFrame:frame];
} }

View File

@ -37,7 +37,8 @@ struct xsize controlPreferredSize(id control)
c = toNSControl(control); c = toNSControl(control);
[c sizeToFit]; [c sizeToFit];
r = [c frame]; // use alignmentRect here instead of frame because we'll be resizing based on that
r = [c alignmentRectForFrame:[c frame]];
s.width = (intptr_t) r.size.width; s.width = (intptr_t) r.size.width;
s.height = (intptr_t) r.size.height; s.height = (intptr_t) r.size.height;
return s; return s;

7
future
View File

@ -1,13 +1,11 @@
mac os x sizing is now completely broken mac os x sizing is now completely broken
- need to catch window initial sizes - need to catch window initial sizes
- need to catch tab changes - need to catch tab changes
- can't just resize every tab to the current tab size; that'll just cause weirdness - can't just resize every tab to the current tab size; that doesn't seem to work
- rect should be based on the alignment rect, not the frame rect
mac os x mac os x
Table, Textbox Textbox
refuse first responder refuse first responder
Table still works because it's entirely mouse based
Textbox does not work at all Textbox does not work at all
new control stuff new control stuff
@ -126,5 +124,4 @@ gtk+, mac os x
- figure out how dialogs and Areas work together - figure out how dialogs and Areas work together
- once that is done, document the behavior of Areas - once that is done, document the behavior of Areas
all all
- make spaced settable somehow
- rename Selected to Selection? - rename Selected to Selection?