diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-25 20:10:09 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-25 20:10:09 -0400 |
| commit | 3d5e8feba4d2980f0be647231ae0f75385afa45b (patch) | |
| tree | 5040c7129eeaae8dd18597db50b0f4669d4d25f8 /redo/window_darwin.go | |
| parent | d1702d33e055fb254cfacb1ad7d3d3f60314bba6 (diff) | |
Implemented the various parenting and sizing changes on the Mac OS X backend; also moved a line in window_windows.go around for consistency.
Diffstat (limited to 'redo/window_darwin.go')
| -rw-r--r-- | redo/window_darwin.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/redo/window_darwin.go b/redo/window_darwin.go index 859c79a..90679bc 100644 --- a/redo/window_darwin.go +++ b/redo/window_darwin.go @@ -13,23 +13,29 @@ import "C" type window struct { id C.id - child Control - closing *event - spaced bool + *container +} + +type controlParent interface { + setParent(C.id) } -func newWindow(title string, width int, height int) *window { +func newWindow(title string, width int, height int, control Control) *window { id := C.newWindow(C.intptr_t(width), C.intptr_t(height)) ctitle := C.CString(title) defer C.free(unsafe.Pointer(ctitle)) C.windowSetTitle(id, ctitle) w := &window{ - id: id, - closing: newEvent(), + id: id, + closing: newEvent(), + container: new(container), } + w.container.beginResize = w.beginResize C.windowSetDelegate(id, unsafe.Pointer(w)) + w.child = control + w.child.setParent(w.id) return w } @@ -72,6 +78,6 @@ func windowClosing(xw unsafe.Pointer) C.BOOL { //export windowResized func windowResized(xw unsafe.Pointer, width C.uintptr_t, height C.uintptr_t) { w := (*window)(unsafe.Pointer(xw)) - w.doresize(int(width), int(height)) + w.resize(int(width), int(height)) fmt.Printf("new size %d x %d\n", width, height) } |
