summaryrefslogtreecommitdiff
path: root/window_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-27 23:57:54 -0400
committerPietro Gagliardi <[email protected]>2014-10-27 23:57:54 -0400
commit6b27bd732743948e0002abe4d452212fad8ac045 (patch)
tree65ae76cefa98fb72adbcb48fd4432b967afb20bd /window_darwin.go
parenta2cbccd41e1ed2f3f8cf832594d27343278000b7 (diff)
Restructured container on Mac OS X likewise. Still have to test.
Diffstat (limited to 'window_darwin.go')
-rw-r--r--window_darwin.go18
1 files changed, 4 insertions, 14 deletions
diff --git a/window_darwin.go b/window_darwin.go
index e0804be..32f744a 100644
--- a/window_darwin.go
+++ b/window_darwin.go
@@ -16,8 +16,6 @@ type window struct {
child Control
container *container
-
- margined bool
}
func newWindow(title string, width int, height int, control Control) *window {
@@ -34,6 +32,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())
+ w.container.resize = w.child.resize
// trigger an initial resize
return w
}
@@ -50,9 +49,6 @@ 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() {
@@ -68,11 +64,11 @@ func (w *window) OnClosing(e func() bool) {
}
func (w *window) Margined() bool {
- return w.margined
+ return w.container.margined
}
func (w *window) SetMargined(margined bool) {
- w.margined = margined
+ w.container.margined = margined
}
//export windowClosing
@@ -85,10 +81,4 @@ func windowClosing(xw unsafe.Pointer) C.BOOL {
return C.NO
}
-//export windowResized
-func windowResized(data unsafe.Pointer) {
- w := (*window)(data)
- a := w.container.allocation(w.margined)
- d := w.beginResize()
- w.child.resize(int(a.x), int(a.y), int(a.width), int(a.height), d)
-}
+// no need for windowResized; the child container takes care of that