diff options
Diffstat (limited to 'redo/table_windows.c')
| -rw-r--r-- | redo/table_windows.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/redo/table_windows.c b/redo/table_windows.c new file mode 100644 index 0000000..a9039f0 --- /dev/null +++ b/redo/table_windows.c @@ -0,0 +1,51 @@ +/* 28 july 2014 */ + +#include "winapi_windows.h" + +/* provided for cgo's benefit */ +LPCWSTR xWC_LISTVIEW = WC_LISTVIEW; + +static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data) +{ + switch (uMsg) { + case msgCOMMAND: + /* TODO */ + return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam); + case msgNOTIFY: + /* TODO */ + return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam); + case WM_NCDESTROY: + if ((*fv_RemoveWindowSubclass)(hwnd, tableSubProc, id) == FALSE) + xpanic("error removing Table subclass (which was for its own event handler)", GetLastError()); + return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam); + default: + return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam); + } + xmissedmsg("Button", "tableSubProc()", uMsg); + return 0; /* unreached */ +} + +void setTableSubclass(HWND hwnd, void *data) +{ + if ((*fv_SetWindowSubclass)(hwnd, tableSubProc, 0, (DWORD_PTR) data) == FALSE) + xpanic("error subclassing Table to give it its own event handler", GetLastError()); +} + +void tableAppendColumn(HWND hwnd, int index, LPCWSTR name) +{ + LVCOLUMNW col; + + ZeroMemory(&col, sizeof (LVCOLUMNW)); + col.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER; + col.fmt = LVCFMT_LEFT; + col.pszText = name; + col.iSubItem = index; + col.iOrder = index; + if (SendMessageW(hwnd, LVM_INSERTCOLUMN, (WPARAM) index, (LPARAM) (&col)) == (LRESULT) -1) + xpanic("error adding column to Table", GetLastError()); +} + +void tableUpdate(HWND table, int nItems) +{ + /* TODO */ +} |
