Fixed Mac OS X issues.

This commit is contained in:
Pietro Gagliardi 2014-10-28 00:13:18 -04:00
parent 6b27bd7327
commit 73fcb4e22d
4 changed files with 9 additions and 9 deletions

View File

@ -25,8 +25,10 @@ type sizing struct {
neighborAlign C.struct_xalignment
}
func newContainer() *container {
// containerResized() gets called early so we have to do this in the constructor
func newContainer(resize func(x int, y int, width int, height int, d *sizing)) *container {
c := new(container)
c.resize = resize
c.id = C.newContainerView(unsafe.Pointer(c))
return c
}

View File

@ -18,11 +18,10 @@ type group struct {
func newGroup(text string, control Control) Group {
g := new(group)
g.container = newContainer()
g.controlSingleObject = newControlSingleObject(C.newGroup(g.container.id))
g.child = control
g.container = newContainer(g.child.resize)
g.child.setParent(g.container.parent())
g.container.resize = g.child.resize
g.controlSingleObject = newControlSingleObject(C.newGroup(g.container.id))
g.SetText(text)
return g
}

View File

@ -24,10 +24,9 @@ func newTab() Tab {
}
func (t *tab) Append(name string, control Control) {
c := newContainer()
c := newContainer(control.resize)
t.tabs = append(t.tabs, c)
control.setParent(c.parent())
c.resize = control.resize
t.children = append(t.children, control)
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))

View File

@ -27,12 +27,11 @@ func newWindow(title string, width int, height int, control Control) *window {
id: id,
closing: newEvent(),
child: control,
container: newContainer(),
}
C.windowSetDelegate(w.id, unsafe.Pointer(w))
C.windowSetContentView(w.id, w.container.id)
w.container = newContainer(w.child.resize)
w.child.setParent(w.container.parent())
w.container.resize = w.child.resize
C.windowSetContentView(w.id, w.container.id)
// trigger an initial resize
return w
}
@ -49,6 +48,7 @@ func (w *window) SetTitle(title string) {
func (w *window) Show() {
C.windowShow(w.id)
// TODO we need a dummy resize here because things might not be in the right place
}
func (w *window) Hide() {