Implemented the new events in the portable code.

This commit is contained in:
Pietro Gagliardi 2014-06-28 01:57:07 -04:00
parent d13e398e90
commit c8ae74cf26
3 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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))