diff options
| author | Pietro Gagliardi <[email protected]> | 2014-10-31 19:57:48 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-10-31 19:57:48 -0400 |
| commit | 7c96841392d64e611d1d99f1c5a241b92e95f4d3 (patch) | |
| tree | 485118c7fb8c6300deed6fe7660ca04993916614 /spinbox_darwin.go | |
| parent | 68af61435e793337276119f4795fd4c3e537d691 (diff) | |
Added Spinbox.OnChanged() and implemented it on GTK+ and Mac OS X. Implementing it on Windows is going to be a pain...
Diffstat (limited to 'spinbox_darwin.go')
| -rw-r--r-- | spinbox_darwin.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spinbox_darwin.go b/spinbox_darwin.go index 0d0d858..65274bd 100644 --- a/spinbox_darwin.go +++ b/spinbox_darwin.go @@ -21,12 +21,14 @@ import "C" // - proper spacing between edit and spinner: Interface Builder isn't clear; NSDatePicker doesn't spill the beans type spinbox struct { - id C.id + id C.id + changed *event } func newSpinbox(min int, max int) Spinbox { s := new(spinbox) s.id = C.newSpinbox(unsafe.Pointer(s), C.intmax_t(min), C.intmax_t(max)) + s.changed = newEvent() return s } @@ -38,6 +40,16 @@ func (s *spinbox) SetValue(value int) { C.spinboxSetValue(s.id, C.intmax_t(value)) } +func (s *spinbox) OnChanged(e func()) { + s.changed.set(e) +} + +//export spinboxChanged +func spinboxChanged(data unsafe.Pointer) { + s := (*spinbox)(data) + s.changed.fire() +} + func (s *spinbox) textfield() C.id { return C.spinboxTextField(s.id) } |
