Implemented Table.Selected()/Select() on Mac OS X. Also more TODOs.
This commit is contained in:
parent
a8f711dfad
commit
570f08a49c
|
@ -68,3 +68,4 @@ gtk+, mac os x
|
|||
- once that is done, document the behavior of Areas
|
||||
all
|
||||
- make spaced settable somehow
|
||||
- rename Selected to Selection?
|
||||
|
|
|
@ -93,6 +93,8 @@ extern void tableAppendColumn(id, intptr_t, char *, int, BOOL);
|
|||
extern void tableUpdate(id);
|
||||
extern void tableMakeDataSource(id, void *);
|
||||
extern struct xsize tablePreferredSize(id);
|
||||
extern intptr_t tableSelected(id);
|
||||
extern void tableSelect(id, intptr_t);
|
||||
|
||||
/* control_darwin.m */
|
||||
extern void parent(id, id);
|
||||
|
|
|
@ -62,6 +62,18 @@ func (t *table) LoadImageList(i ImageList) {
|
|||
i.apply(&t.images)
|
||||
}
|
||||
|
||||
func (t *table) Selected() int {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
return int(C.tableSelected(t._id))
|
||||
}
|
||||
|
||||
func (t *table) Select(index int) {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
C.tableSelect(t._id, C.intptr_t(index))
|
||||
}
|
||||
|
||||
//export goTableDataSource_getValue
|
||||
func goTableDataSource_getValue(data unsafe.Pointer, row C.intptr_t, col C.intptr_t, outtype *C.int) unsafe.Pointer {
|
||||
t := (*table)(data)
|
||||
|
|
|
@ -173,3 +173,15 @@ struct xsize tablePreferredSize(id control)
|
|||
s.height += (intptr_t) [[t headerView] frame].size.height;
|
||||
return s;
|
||||
}
|
||||
|
||||
intptr_t tableSelected(id table)
|
||||
{
|
||||
return (intptr_t) [toNSTableView(table) selectedRow];
|
||||
}
|
||||
|
||||
void tableSelect(id table, intptr_t row)
|
||||
{
|
||||
[toNSTableView(table) deselectAll:table];
|
||||
if (row != -1)
|
||||
[toNSTableView(table) selectRowIndexes:[NSIndexSet indexSetWithIndex:((NSUInteger) row)] byExtendingSelection:NO];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue