summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-06-30 23:48:08 -0400
committerPietro Gagliardi <[email protected]>2014-06-30 23:48:08 -0400
commit3565889e15e387fce435c3ffadeaea9823fb2eed (patch)
tree93cf5de89c9010fc16da37949d441d97e3386f89 /window.go
parentffa1bbe0b91a8c812ddcea5c5d65e55f60d07f33 (diff)
Made Window.Closing a callback closure.
Diffstat (limited to 'window.go')
-rw-r--r--window.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/window.go b/window.go
index 57283f2..e485723 100644
--- a/window.go
+++ b/window.go
@@ -8,6 +8,13 @@ import (
// Window represents an on-screen window.
type Window struct {
+ // Closing is called when the Close button is pressed by the user, or when the application needs to be quit (should the underlying system provide a concept of application distinct from window).
+ // Return true to allow the window to be closed; false otherwise.
+ // You cannot change this field after the Window has been created.
+ // [TODO close vs. hide]
+ // TODO nil
+ Closing func() bool
+
created bool
sysData *sysData
initTitle string
@@ -103,9 +110,7 @@ func (w *Window) create(control Control, show bool) {
}
w.sysData.spaced = w.spaced
w.sysData.winhandler = w.handler
- w.sysData.close = func(b *bool) {
- w.sysData.winhandler.Event(Closing, b)
- }
+ w.sysData.close = w.Closing
err := w.sysData.make(nil)
if err != nil {
panic(fmt.Errorf("error opening window: %v", err))