summaryrefslogtreecommitdiff
path: root/redo/window_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-19 09:44:32 -0400
committerPietro Gagliardi <[email protected]>2014-07-19 09:44:32 -0400
commit48c5055eb960d6db3d3b997bdc859670f473a277 (patch)
treeebde497dc011e9c1a8dca63710e59fb9e2b75c69 /redo/window_darwin.go
parent47c0f573a986622a1968cf324fb1c5c5881a63a5 (diff)
Started dropping the whole request/response system because it fell apart... time to make a ui.Do(func(){ ... })
Diffstat (limited to 'redo/window_darwin.go')
-rw-r--r--redo/window_darwin.go114
1 files changed, 30 insertions, 84 deletions
diff --git a/redo/window_darwin.go b/redo/window_darwin.go
index c84c204..4fc442a 100644
--- a/redo/window_darwin.go
+++ b/redo/window_darwin.go
@@ -20,106 +20,52 @@ type window struct {
spaced bool
}
-func newWindow(title string, width int, height int) *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- 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(),
- }
- C.windowSetDelegate(id, unsafe.Pointer(w))
- c <- w
- },
- resp: c,
+func newWindow(title string, width int, height int) *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(),
}
+ C.windowSetDelegate(id, unsafe.Pointer(w))
+ return w
}
-func (w *window) SetControl(control Control) *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- if w.child != nil { // unparent existing control
- w.child.unparent()
- }
- control.unparent()
- control.parent(w)
- w.child = control
- c <- struct{}{}
- },
- resp: c,
+func (w *window) SetControl(control Control) {
+ if w.child != nil { // unparent existing control
+ w.child.unparent()
}
+ control.unparent()
+ control.parent(w)
+ w.child = control
}
-func (w *window) Title() *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- c <- C.GoString(C.windowTitle(w.id))
- },
- resp: c,
- }
+func (w *window) Title() string {
+ return C.GoString(C.windowTitle(w.id))
}
-func (w *window) SetTitle(title string) *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- ctitle := C.CString(title)
- defer C.free(unsafe.Pointer(ctitle))
- C.windowSetTitle(w.id, ctitle)
- c <- struct{}{}
- },
- resp: c,
- }
+func (w *window) SetTitle(title string) {
+ ctitle := C.CString(title)
+ defer C.free(unsafe.Pointer(ctitle))
+ C.windowSetTitle(w.id, ctitle)
}
-func (w *window) Show() *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- C.windowShow(w.id)
- c <- struct{}{}
- },
- resp: c,
- }
+func (w *window) Show() {
+ C.windowShow(w.id)
}
-func (w *window) Hide() *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- C.windowHide(w.id)
- c <- struct{}{}
- },
- resp: c,
- }
+func (w *window) Hide() {
+ C.windowHide(w.id)
}
-func (w *window) Close() *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- C.windowClose(w.id)
- c <- struct{}{}
- },
- resp: c,
- }
+func (w *window) Close() {
+ C.windowClose(w.id)
}
-func (w *window) OnClosing(e func(c Doer) bool) *Request {
- c := make(chan interface{})
- return &Request{
- op: func() {
- w.closing.setbool(e)
- c <- struct{}{}
- },
- resp: c,
- }
+func (w *window) OnClosing(e func() bool) {
+ w.closing.setbool(e)
}
//export windowClosing