Finished the implementation of Combobox on Mac OS X.
This commit is contained in:
parent
e20b468472
commit
4bc35e2db5
|
@ -31,6 +31,11 @@ id _objc_msgSend_uint(id obj, SEL sel, uintptr_t a)
|
|||
same as above, but for NSInteger
|
||||
*/
|
||||
|
||||
intptr_t objc_msgSend_intret_noargs(id obj, SEL sel)
|
||||
{
|
||||
return (intptr_t) ((NSInteger) objc_msgSend(obj, sel));
|
||||
}
|
||||
|
||||
id objc_msgSend_int(id obj, SEL sel, intptr_t a)
|
||||
{
|
||||
return objc_msgSend(obj, sel, (NSInteger) a);
|
||||
|
|
|
@ -44,6 +44,8 @@ struct xsize {
|
|||
|
||||
extern struct xsize objc_msgSend_stret_size_noargs(id obj, SEL sel);
|
||||
|
||||
extern intptr_t objc_msgSend_intret_noargs(id obj, SEL sel);
|
||||
|
||||
#define m1(name, type1) \
|
||||
inline id objc_msgSend_ ## name (id obj, SEL sel, type1 a) \
|
||||
{ \
|
||||
|
|
|
@ -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 {
|
||||
|
|
1
todo.md
1
todo.md
|
@ -28,6 +28,7 @@ important things:
|
|||
- Cocoa coordinates have (0,0) at the bottom left: need to fix this somehow
|
||||
- I think Cocoa NSButton text is not vertically aligned properly...?
|
||||
- resizing Cocoa windows does not redraw controls correctly
|
||||
- NSComboBox scans the entered text to see if it matches one of the items and returns the index of that item if it does; find out how to suppress this so that it returns -1 unless the item was chosen from the list (like the other platforms)
|
||||
- figure out what to do about deleting a nonexistent item; each backend responds differently by default
|
||||
- there's no GTK+ error handling whatsoever; we need to figure out how it works
|
||||
- make sure GTK+ documentation point differences don't matter
|
||||
|
|
Loading…
Reference in New Issue