summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-01 09:44:57 -0400
committerPietro Gagliardi <[email protected]>2014-07-01 09:44:57 -0400
commitabb642071dd97dadbaa676415c7221201ed9be06 (patch)
treec9a96d487c266484c2aaa2de4c7e266a7352f57a /window.go
parent969700f790abbdb08befbeccfaa2e048299a7e6f (diff)
Made the default action for Window.Closing reject the close request.
Diffstat (limited to 'window.go')
-rw-r--r--window.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/window.go b/window.go
index d404d44..5e0cf5f 100644
--- a/window.go
+++ b/window.go
@@ -12,7 +12,7 @@ type Window struct {
// 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
+ // If Closing is nil, a default which rejects the close will be used.
Closing func() bool
created bool
@@ -86,6 +86,11 @@ func (w *Window) create(control Control, show bool) {
}
w.sysData.spaced = w.spaced
w.sysData.close = w.Closing
+ if w.sysData.close == nil {
+ w.sysData.close = func() bool {
+ return false
+ }
+ }
err := w.sysData.make(nil)
if err != nil {
panic(fmt.Errorf("error opening window: %v", err))