From c8ae74cf2677195106dcd526c8b745a995be9075 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 28 Jun 2014 01:57:07 -0400 Subject: Implemented the new events in the portable code. --- button.go | 3 +++ sysdata.go | 3 ++- window.go | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/button.go b/button.go index 2ee3efd..25d0600 100644 --- a/button.go +++ b/button.go @@ -36,6 +36,9 @@ func (b *Button) Text() string { } func (b *Button) make(window *sysData) error { + b.sysData.event = func() { + window.winhandler.Event(Clicked, b) + } err := b.sysData.make(window) if err != nil { return err diff --git a/sysdata.go b/sysdata.go index 14bfc20..9144517 100644 --- a/sysdata.go +++ b/sysdata.go @@ -10,7 +10,8 @@ type cSysData struct { alternate bool // editable for Combobox, multi-select for listbox, password for lineedit handler AreaHandler // for Areas; TODO rename to areahandler winhandler WindowHandler // for Windows - event func() // provided by each widget + close func(*bool) // provided by each Window + event func() // provided by each control } // this interface is used to make sure all sysDatas are synced diff --git a/window.go b/window.go index a1c7532..63f03b8 100644 --- a/window.go +++ b/window.go @@ -98,6 +98,10 @@ func (w *Window) Create(control Control) { panic("window already open") } w.sysData.spaced = w.spaced + w.sysData.winhandler = w.handler + w.sysData.close = func(b *bool) { + w.sysData.winhandler.Event(Closing, b) + } err := w.sysData.make(nil) if err != nil { panic(fmt.Errorf("error opening window: %v", err)) -- cgit v1.2.3