summaryrefslogtreecommitdiff
path: root/redo/table_windows.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-25 11:51:38 -0400
committerPietro Gagliardi <[email protected]>2014-08-25 11:51:38 -0400
commit774e4519673cb81c07d3f87f74e4a41755d83051 (patch)
treea5bf968c278540d3c367daa46e04e2ec451d1a1d /redo/table_windows.c
parentfe01ebbbcde9f4f058b3967851ccf2f4718710c1 (diff)
Switched the image list stuff to a static function/message pair.
Diffstat (limited to 'redo/table_windows.c')
-rw-r--r--redo/table_windows.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/redo/table_windows.c b/redo/table_windows.c
index be6e23c..28d606f 100644
--- a/redo/table_windows.c
+++ b/redo/table_windows.c
@@ -31,6 +31,19 @@ struct tableData {
HIMAGELIST checkboxImageList;
};
+static void tableSetCheckboxImageList(HWND hwnd, struct tableData *t)
+{
+ HIMAGELIST checkboxImageList;
+
+ checkboxImageList = makeCheckboxImageList(hwnd);
+ if (SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM) (checkboxImageList)) == (LRESULT) NULL)
+;//TODO xpanic("error setting image list", GetLastError());
+ // TODO free old one here if any/different
+ // thanks to Jonathan Potter (http://stackoverflow.com/questions/25354448/why-do-my-owner-data-list-view-state-images-come-up-as-blank-on-windows-xp)
+ if (SendMessageW(hwnd, LVM_SETCALLBACKMASK, LVIS_STATEIMAGEMASK, 0) == FALSE)
+ xpanic("error marking state image list as application-managed", GetLastError());
+}
+
static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data)
{
NMHDR *nmhdr = (NMHDR *) lParam;
@@ -72,6 +85,9 @@ static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
tablePushed(t->gotable, -1, -1); // in case button held as drag out
// and let the list view do its thing
return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
+ case msgTableMakeInitialImageList:
+ tableSetCheckboxImageList(hwnd, t);
+ return 0;
// see table.autoresize() in table_windows.go for the column autosize policy
case WM_NOTIFY: // from the contained header control
if (nmhdr->code == HDN_BEGINTRACK)
@@ -137,19 +153,6 @@ void tableAutosizeColumns(HWND hwnd, int nColumns)
xpanic("error resizing columns of results list view", GetLastError());
}
-void tableSetCheckboxImageList(HWND hwnd)
-{
- HIMAGELIST checkboxImageList;
-
- checkboxImageList = makeCheckboxImageList(hwnd);
- if (SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM) checkboxImageList) == (LRESULT) NULL)
-;//TODO xpanic("error setting image list", GetLastError());
- // TODO free old one here if any/different
- // thanks to Jonathan Potter (http://stackoverflow.com/questions/25354448/why-do-my-owner-data-list-view-state-images-come-up-as-blank-on-windows-xp)
- if (SendMessageW(hwnd, LVM_SETCALLBACKMASK, LVIS_STATEIMAGEMASK, 0) == FALSE)
- xpanic("error marking state image list as application-managed", GetLastError());
-}
-
// because Go won't let me do C.WPARAM(-1)
intptr_t tableSelectedItem(HWND hwnd)
{