summaryrefslogtreecommitdiff
path: root/wintable/api.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-11-29 18:29:50 -0500
committerPietro Gagliardi <[email protected]>2014-11-29 18:29:50 -0500
commitd23cdd76827728a4f7eb6b0afa9b6e572aab964c (patch)
tree71cb46d964c339d5a8f8b179ad0d8e2f102dcc72 /wintable/api.h
parent6cce68074a84e903b42032e2e972d551205c147f (diff)
Started splitting the new Windows Table code into more manageable chunks.
Diffstat (limited to 'wintable/api.h')
-rw-r--r--wintable/api.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/wintable/api.h b/wintable/api.h
new file mode 100644
index 0000000..a933df7
--- /dev/null
+++ b/wintable/api.h
@@ -0,0 +1,25 @@
+// 29 november 2014
+
+static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
+{
+ HDITEMW item;
+
+ if (((int) wParam) >= nTableColumnTypes)
+ abort();
+
+ t->nColumns++;
+ t->columnTypes = (int *) realloc(t->columnTypes, t->nColumns * sizeof (int));
+ if (t->columnTypes == NULL)
+ abort();
+ t->columnTypes[t->nColumns - 1] = (int) wParam;
+
+ ZeroMemory(&item, sizeof (HDITEMW));
+ item.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT;
+ item.cxy = 200; // TODO
+ item.pszText = (WCHAR *) lParam;
+ item.fmt = HDF_LEFT | HDF_STRING;
+ if (SendMessage(t->header, HDM_INSERTITEM, (WPARAM) (t->nColumns - 1), (LPARAM) (&item)) == (LRESULT) (-1))
+ abort();
+ // TODO resize(t)?
+ redrawAll(t);
+}