diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-16 17:37:21 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-16 17:37:21 -0400 |
| commit | d5f9c237b7e81e54e91241d49d2a8ad718bd397c (patch) | |
| tree | ee7d4c75c05b1b2144f83f7f07c1e20bcea6eab3 /redo/table_windows.go | |
| parent | 5d69bc2534cd3a90a2c93c564c2fcfc5accd5fad (diff) | |
Added image lists to Tables and added them to the Windows backend... mostly. There are a few kinks to work out...
Diffstat (limited to 'redo/table_windows.go')
| -rw-r--r-- | redo/table_windows.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go index 93ff9c1..2f9155d 100644 --- a/redo/table_windows.go +++ b/redo/table_windows.go @@ -49,15 +49,28 @@ func (t *table) Unlock() { }() } -//export tableGetCellText -func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR) { +func (t *table) LoadImageList(il ImageList) { + il.apply(t._hwnd, C.LVM_SETIMAGELIST, C.LVSIL_SMALL) +} + +//export tableGetCell +func tableGetCell(data unsafe.Pointer, item *C.LVITEMW) { t := (*table)(data) t.RLock() defer t.RUnlock() d := reflect.Indirect(reflect.ValueOf(t.data)) - datum := d.Index(int(row)).Field(int(col)) - s := fmt.Sprintf("%v", datum) - *str = toUTF16(s) + datum := d.Index(int(item.iItem)).Field(int(item.iSubItem)) + switch d := datum.Interface().(type) { + case ImageIndex: + item.mask |= C.LVIF_IMAGE + item.mask &^= C.LVIF_TEXT + item.iImage = C.int(d) + default: + item.mask |= C.LVIF_TEXT + item.mask &^= C.LVIF_IMAGE + s := fmt.Sprintf("%v", datum) + item.pszText = toUTF16(s) + } } // the column autoresize policy is simple: |
