Fixed Mac OS X sizing and more TODOs. Ready to merge back!

This commit is contained in:
Pietro Gagliardi 2014-10-18 17:02:51 -04:00
parent 922407d5b6
commit 8c8b642adb
4 changed files with 21 additions and 4 deletions

10
future
View File

@ -1,7 +1,13 @@
mac os x sizing is now completely broken
- need to catch window initial sizes
- need to catch tab changes
- rect should be based on the alignment rect, not the frame rect
new control stuff
Tab, Group
- should host Controls directly
- should have sharedWndProc()
- should host Controls directly?
- should have sharedWndProc()
- Tab needs Margined
more flexible sizing determination
Tab needs a SetMargined(n), Margined(n)

View File

@ -17,7 +17,7 @@ type sizing struct {
sizingbase
// for size calculations
// nothing for mac
// nothing on Mac OS X
// for the actual resizing
neighborAlign C.struct_xalignment

View File

@ -34,7 +34,14 @@ id newContainerView(void *gocontainer)
void moveControl(id c, intptr_t x, intptr_t y, intptr_t width, intptr_t height)
{
[toNSView(c) setFrame:NSMakeRect((CGFloat) x, (CGFloat) y, (CGFloat) width, (CGFloat) height)];
NSView *v;
NSRect frame;
frame = NSMakeRect((CGFloat) x, (CGFloat) y, (CGFloat) width, (CGFloat) height);
// mac os x coordinate system has (0,0) in the lower-left
v = toNSView(c);
frame.origin.y = ([[v superview] bounds].size.height - frame.size.height) - frame.origin.y;
[v setFrame:frame];
}
struct xrect containerBounds(id view)

View File

@ -34,6 +34,7 @@ func newWindow(title string, width int, height int, control Control) *window {
C.windowSetDelegate(w.id, unsafe.Pointer(w))
C.windowSetContentView(w.id, w.container.id)
w.child.setParent(w.container.parent())
// trigger an initial resize
return w
}
@ -49,6 +50,9 @@ func (w *window) SetTitle(title string) {
func (w *window) Show() {
C.windowShow(w.id)
// trigger an initial resize
// TODO fine-tune this
windowResized(unsafe.Pointer(w))
}
func (w *window) Hide() {