Added the other Combobox modification functions to the Mac OS X backend. Before continuing, I'll get messageboxes working...
This commit is contained in:
parent
01e5871741
commit
234b724403
|
@ -36,6 +36,11 @@ id objc_msgSend_int(id obj, SEL sel, intptr_t a)
|
|||
return objc_msgSend(obj, sel, (NSInteger) a);
|
||||
}
|
||||
|
||||
id objc_msgSend_id_int(id obj, SEL sel, id a, intptr_t b)
|
||||
{
|
||||
return objc_msgSend(obj, sel, a, (NSInteger) b);
|
||||
}
|
||||
|
||||
/*
|
||||
These are the objc_msgSend() wrappers around NSRect. The problem is that while on 32-bit systems, NSRect is a concrete structure, on 64-bit systems it's just a typedef to CGRect. While in practice just using CGRect everywhere seems to work, better to be safe than sorry.
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ extern id objc_msgSend_int(id obj, SEL sel, intptr_t a);
|
|||
|
||||
m2(id_id, id, id)
|
||||
extern id _objc_msgSend_rect_bool(id obj, SEL sel, int64_t x, int64_t y, int64_t w, int64_t h, BOOL b);
|
||||
extern id objc_msgSend_id_int(id obj, SEL sel, id a, intptr_t b);
|
||||
|
||||
m3(id_id_id, id, id, id)
|
||||
m3(sel_id_bool, SEL, id, BOOL)
|
||||
|
|
|
@ -25,6 +25,9 @@ type classData struct {
|
|||
textsel C.SEL
|
||||
alttextsel C.SEL
|
||||
append func(id C.id, what string, alternate bool)
|
||||
insertBefore func(id C.id, what string, before int, alternate bool)
|
||||
// TODO others
|
||||
delete func(id C.id, index int)
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -169,6 +172,17 @@ var classTypes = [nctypes]*classData{
|
|||
C.objc_msgSend_id(id, _addItemWithTitle, str)
|
||||
}
|
||||
},
|
||||
insertBefore: func(id C.id, what string, before int, alternate bool) {
|
||||
str := toNSString(what)
|
||||
if alternate {
|
||||
C.objc_msgSend_id_int(id, _insertItemWithObjectValueAtIndex, str, C.intptr_t(before))
|
||||
} else {
|
||||
C.objc_msgSend_id_int(id, _insertItemWithTitleAtIndex, str, C.intptr_t(before))
|
||||
}
|
||||
},
|
||||
delete: func(id C.id, index int) {
|
||||
C.objc_msgSend_int(id, _removeItemAtIndex, C.intptr_t(index))
|
||||
},
|
||||
},
|
||||
c_lineedit: &classData{
|
||||
},
|
||||
|
@ -315,7 +329,14 @@ if classTypes[s.ctype].append == nil { return nil }
|
|||
}
|
||||
|
||||
func (s *sysData) insertBefore(what string, before int) error {
|
||||
// TODO
|
||||
if classTypes[s.ctype].insertBefore == nil { return nil }
|
||||
ret := make(chan struct{})
|
||||
defer close(ret)
|
||||
uitask <- func() {
|
||||
classTypes[s.ctype].insertBefore(s.id, what, before, s.alternate)
|
||||
ret <- struct{}{}
|
||||
}
|
||||
<-ret
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -350,7 +371,14 @@ func (s *sysData) setWindowSize(width int, height int) error {
|
|||
}
|
||||
|
||||
func (s *sysData) delete(index int) error {
|
||||
// TODO
|
||||
if classTypes[s.ctype].delete == nil { return nil }
|
||||
ret := make(chan struct{})
|
||||
defer close(ret)
|
||||
uitask <- func() {
|
||||
classTypes[s.ctype].delete(s.id, index)
|
||||
ret <- struct{}{}
|
||||
}
|
||||
<-ret
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
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
|
||||
- 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
|
||||
- button sizes and LineEdit sizes on Windows seem too big; Comboboxes have margins
|
||||
|
|
Loading…
Reference in New Issue