diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-03 21:52:21 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-03 21:52:21 -0400 |
| commit | 2c107d7057fec9d8c6fc1b694e28cea824668a3d (patch) | |
| tree | 9b7cd1f2d0d7df1f7af8f179fc23f9ab21b8db8e /redo/table_windows.go | |
| parent | 0fb45ba84d7a948508b30e0b140910ae906b4d9d (diff) | |
Converted the new Windows Control code to use interfaces instead of controlbase, just like the GTK+ and Mac OS X backends do now.
Diffstat (limited to 'redo/table_windows.go')
| -rw-r--r-- | redo/table_windows.go | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go index 60b8fe0..3fef105 100644 --- a/redo/table_windows.go +++ b/redo/table_windows.go @@ -12,23 +12,23 @@ import ( import "C" type table struct { - *controlbase *tablebase + _hwnd C.HWND } func finishNewTable(b *tablebase, ty reflect.Type) Table { t := &table{ - controlbase: newControl(C.xWC_LISTVIEW, + _hwnd: C.newControl(C.xWC_LISTVIEW, C.LVS_REPORT | C.LVS_OWNERDATA | C.LVS_NOSORTHEADER | C.LVS_SHOWSELALWAYS | C.WS_HSCROLL | C.WS_VSCROLL, C.WS_EX_CLIENTEDGE), // WS_EX_CLIENTEDGE without WS_BORDER will show the canonical visual styles border (thanks to MindChild in irc.efnet.net/#winprog) tablebase: b, } - C.setTableSubclass(t.hwnd, unsafe.Pointer(t)) + C.setTableSubclass(t._hwnd, unsafe.Pointer(t)) // LVS_EX_FULLROWSELECT gives us selection across the whole row, not just the leftmost column; this makes the list view work like on other platforms // LVS_EX_SUBITEMIMAGES gives us images in subitems, which will be important when both images and checkboxes are added - C.tableAddExtendedStyles(t.hwnd, C.LVS_EX_FULLROWSELECT | C.LVS_EX_SUBITEMIMAGES) + C.tableAddExtendedStyles(t._hwnd, C.LVS_EX_FULLROWSELECT | C.LVS_EX_SUBITEMIMAGES) for i := 0; i < ty.NumField(); i++ { - C.tableAppendColumn(t.hwnd, C.int(i), toUTF16(ty.Field(i).Name)) + C.tableAppendColumn(t._hwnd, C.int(i), toUTF16(ty.Field(i).Name)) } return t } @@ -39,7 +39,7 @@ func (t *table) Unlock() { // I think there's a way to set the item count without causing a refetch of data that works around this... t.RLock() defer t.RUnlock() - C.tableUpdate(t.hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len())) + C.tableUpdate(t._hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len())) } //export tableGetCellText @@ -53,16 +53,20 @@ func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR) *str = toUTF16(s) } +func (t *table) hwnd() C.HWND { + return t._hwnd +} + func (t *table) setParent(p *controlParent) { - basesetParent(t.controlbase, p) + basesetParent(t, p) } func (t *table) containerShow() { - basecontainerShow(t.controlbase) + basecontainerShow(t) } func (t *table) containerHide() { - basecontainerHide(t.controlbase) + basecontainerHide(t) } func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation { @@ -80,7 +84,7 @@ func (t *table) preferredSize(d *sizing) (width, height int) { } func (t *table) commitResize(a *allocation, d *sizing) { - basecommitResize(t.controlbase, a, d) + basecommitResize(t, a, d) } func (t *table) getAuxResizeInfo(d *sizing) { |
