diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-20 15:26:48 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-20 15:26:48 -0400 |
| commit | 77ab7117057ea546427a094d6d6dfc3543139f01 (patch) | |
| tree | 1731296b58fbe39eb4bffa326fd28240cf3b45ae /redo/textfield_darwin.go | |
| parent | ac6d0429f1befcceb94bca7ad57b19bd11afd1b6 (diff) | |
Implemented TextField.OnChanged() on Mac OS X.
Diffstat (limited to 'redo/textfield_darwin.go')
| -rw-r--r-- | redo/textfield_darwin.go | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/redo/textfield_darwin.go b/redo/textfield_darwin.go index 22a97cf..3ea3997 100644 --- a/redo/textfield_darwin.go +++ b/redo/textfield_darwin.go @@ -10,13 +10,17 @@ import ( import "C" type textfield struct { - _id C.id + _id C.id + changed *event } func newTextField() *textfield { - return &textfield{ - _id: C.newTextField(), + t := &textfield{ + _id: C.newTextField(), + changed: newEvent(), } + C.textfieldSetDelegate(t._id, unsafe.Pointer(t)) + return t } func newPasswordField() *textfield { @@ -35,6 +39,21 @@ func (t *textfield) SetText(text string) { C.textFieldSetText(t._id, ctext) } +func (t *textfield) OnChanged(f func()) { + t.changed.set(f) +} + +func (t *textfield) Invalid(reason string) { + // TODO +} + +//export textfieldChanged +func textfieldChanged(data unsafe.Pointer) { + t := (*textfield)(data) +println("changed") + t.changed.fire() +} + func (t *textfield) id() C.id { return t._id } |
