summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-28 23:47:45 -0400
committerPietro Gagliardi <[email protected]>2014-07-28 23:47:45 -0400
commit84e04cdae1cc6cb000d70d08ff5c379cf83ea07e (patch)
tree04c9096103bcb42ec52db0051ef193e4f2516311
parent8fcadffeafe106d20f69259ac7277a89bb12e71e (diff)
Set up some extended styles on Windows Tables for consistency and future features.
-rw-r--r--redo/table_windows.c6
-rw-r--r--redo/table_windows.go3
-rw-r--r--redo/winapi_windows.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/redo/table_windows.c b/redo/table_windows.c
index 151fe06..319aaaa 100644
--- a/redo/table_windows.c
+++ b/redo/table_windows.c
@@ -55,3 +55,9 @@ void tableUpdate(HWND hwnd, int nItems)
if (SendMessageW(hwnd, LVM_SETITEMCOUNT, (WPARAM) nItems, 0) == 0)
xpanic("error setting number of items in Table", GetLastError());
}
+
+void tableAddExtendedStyles(HWND hwnd, LPARAM styles)
+{
+ /* the bits of WPARAM specify which bits of LPARAM to look for; having WPARAM == LPARAM ensures that only the bits we want to add are affected */
+ SendMessageW(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, (WPARAM) styles, styles);
+}
diff --git a/redo/table_windows.go b/redo/table_windows.go
index 6839be0..c3e0453 100644
--- a/redo/table_windows.go
+++ b/redo/table_windows.go
@@ -24,6 +24,9 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
tablebase: b,
}
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)
for i := 0; i < ty.NumField(); i++ {
C.tableAppendColumn(t.hwnd, C.int(i), toUTF16(ty.Field(i).Name))
}
diff --git a/redo/winapi_windows.h b/redo/winapi_windows.h
index c8726e7..51bbe0e 100644
--- a/redo/winapi_windows.h
+++ b/redo/winapi_windows.h
@@ -92,5 +92,6 @@ extern LPCWSTR xWC_LISTVIEW;
extern void setTableSubclass(HWND, void *);
extern void tableAppendColumn(HWND, int, LPCWSTR);
extern void tableUpdate(HWND, int);
+extern void tableAddExtendedStyles(HWND, LPARAM);
#endif