Fixed Mac OS X issues.
This commit is contained in:
parent
6b27bd7327
commit
73fcb4e22d
|
@ -25,8 +25,10 @@ type sizing struct {
|
||||||
neighborAlign C.struct_xalignment
|
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 := new(container)
|
||||||
|
c.resize = resize
|
||||||
c.id = C.newContainerView(unsafe.Pointer(c))
|
c.id = C.newContainerView(unsafe.Pointer(c))
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,10 @@ type group struct {
|
||||||
|
|
||||||
func newGroup(text string, control Control) Group {
|
func newGroup(text string, control Control) Group {
|
||||||
g := new(group)
|
g := new(group)
|
||||||
g.container = newContainer()
|
|
||||||
g.controlSingleObject = newControlSingleObject(C.newGroup(g.container.id))
|
|
||||||
g.child = control
|
g.child = control
|
||||||
|
g.container = newContainer(g.child.resize)
|
||||||
g.child.setParent(g.container.parent())
|
g.child.setParent(g.container.parent())
|
||||||
g.container.resize = g.child.resize
|
g.controlSingleObject = newControlSingleObject(C.newGroup(g.container.id))
|
||||||
g.SetText(text)
|
g.SetText(text)
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,9 @@ func newTab() Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tab) Append(name string, control Control) {
|
func (t *tab) Append(name string, control Control) {
|
||||||
c := newContainer()
|
c := newContainer(control.resize)
|
||||||
t.tabs = append(t.tabs, c)
|
t.tabs = append(t.tabs, c)
|
||||||
control.setParent(c.parent())
|
control.setParent(c.parent())
|
||||||
c.resize = control.resize
|
|
||||||
t.children = append(t.children, control)
|
t.children = append(t.children, control)
|
||||||
cname := C.CString(name)
|
cname := C.CString(name)
|
||||||
defer C.free(unsafe.Pointer(cname))
|
defer C.free(unsafe.Pointer(cname))
|
||||||
|
|
|
@ -27,12 +27,11 @@ func newWindow(title string, width int, height int, control Control) *window {
|
||||||
id: id,
|
id: id,
|
||||||
closing: newEvent(),
|
closing: newEvent(),
|
||||||
child: control,
|
child: control,
|
||||||
container: newContainer(),
|
|
||||||
}
|
}
|
||||||
C.windowSetDelegate(w.id, unsafe.Pointer(w))
|
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.child.setParent(w.container.parent())
|
||||||
w.container.resize = w.child.resize
|
C.windowSetContentView(w.id, w.container.id)
|
||||||
// trigger an initial resize
|
// trigger an initial resize
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
@ -49,6 +48,7 @@ func (w *window) SetTitle(title string) {
|
||||||
|
|
||||||
func (w *window) Show() {
|
func (w *window) Show() {
|
||||||
C.windowShow(w.id)
|
C.windowShow(w.id)
|
||||||
|
// TODO we need a dummy resize here because things might not be in the right place
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) Hide() {
|
func (w *window) Hide() {
|
||||||
|
|
Loading…
Reference in New Issue