diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-02 18:38:45 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-02 18:38:45 -0500 |
| commit | 4bc35e2db57476c5faf40e971e5f91e497ac3f0a (patch) | |
| tree | 563511157770c59f70b1499a3888418f7c657546 /sysdata_darwin.go | |
| parent | e20b4684729f6278bfb7fe60c68f2b80626fe062 (diff) | |
Finished the implementation of Combobox on Mac OS X.
Diffstat (limited to 'sysdata_darwin.go')
| -rw-r--r-- | sysdata_darwin.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sysdata_darwin.go b/sysdata_darwin.go index 88d9ddb..137bd42 100644 --- a/sysdata_darwin.go +++ b/sysdata_darwin.go @@ -26,6 +26,7 @@ type classData struct { alttextsel C.SEL append func(id C.id, what string, alternate bool) insertBefore func(id C.id, what string, before int, alternate bool) + selIndex func(id C.id) int // TODO others delete func(id C.id, index int) } @@ -180,6 +181,9 @@ var classTypes = [nctypes]*classData{ C.objc_msgSend_id_int(id, _insertItemWithTitleAtIndex, str, C.intptr_t(before)) } }, + selIndex: func(id C.id) int { + return int(C.objc_msgSend_intret_noargs(id, _indexOfSelectedItem)) + }, delete: func(id C.id, index int) { C.objc_msgSend_int(id, _removeItemAtIndex, C.intptr_t(index)) }, @@ -341,8 +345,13 @@ if classTypes[s.ctype].insertBefore == nil { return nil } } func (s *sysData) selectedIndex() int { - // TODO - return -1 +if classTypes[s.ctype].selIndex == nil { return -1 } + ret := make(chan int) + defer close(ret) + uitask <- func() { + ret <- classTypes[s.ctype].selIndex(s.id) + } + return <-ret } func (s *sysData) selectedIndices() []int { |
