summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-28 00:13:18 -0400
committerPietro Gagliardi <[email protected]>2014-10-28 00:13:18 -0400
commit73fcb4e22d4f90e61165f5cdb438f3a4b224ad4c (patch)
treebfc46d1f8cd5c69b47c0ec391c404ca4d9c54aaa
parent6b27bd732743948e0002abe4d452212fad8ac045 (diff)
Fixed Mac OS X issues.
-rw-r--r--container_darwin.go4
-rw-r--r--group_darwin.go5
-rw-r--r--tab_darwin.go3
-rw-r--r--window_darwin.go6
4 files changed, 9 insertions, 9 deletions
diff --git a/container_darwin.go b/container_darwin.go
index 539ed57..5cc2b1c 100644
--- a/container_darwin.go
+++ b/container_darwin.go
@@ -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
}
diff --git a/group_darwin.go b/group_darwin.go
index eb3055c..aeca48a 100644
--- a/group_darwin.go
+++ b/group_darwin.go
@@ -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
}
diff --git a/tab_darwin.go b/tab_darwin.go
index 9f5ecff..7a8aefe 100644
--- a/tab_darwin.go
+++ b/tab_darwin.go
@@ -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))
diff --git a/window_darwin.go b/window_darwin.go
index 32f744a..cffc2a0 100644
--- a/window_darwin.go
+++ b/window_darwin.go
@@ -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() {