summaryrefslogtreecommitdiff
path: root/wintable/new/api.h
diff options
context:
space:
mode:
Diffstat (limited to 'wintable/new/api.h')
-rw-r--r--wintable/new/api.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/wintable/new/api.h b/wintable/new/api.h
index f066a19..6ebf800 100644
--- a/wintable/new/api.h
+++ b/wintable/new/api.h
@@ -1,5 +1,16 @@
// 8 december 2014
+static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
+{
+ t->nColumns++;
+ t->columnTypes = tableRealloc(t->columnTypes, t->nColumns * sizeof (int), "adding the new column type to the current Table's list of column types");
+ t->columnTypes[t->nColumns - 1] = (int) wParam;
+ // TODO make a panicNoErrCode() or panicArg() for this
+ if (t->columnTypes[t->nColumns - 1] >= nTableColumnTypes)
+ panic("invalid column type passed to tableAddColumn");
+ headerAddColumn(t, (WCHAR *) lParam);
+}
+
HANDLER(apiHandlers)
{
switch (uMsg) {
@@ -15,8 +26,9 @@ HANDLER(apiHandlers)
*lResult = (LRESULT) (t->font);
return TRUE;
case tableAddColumn:
- // TODO
- return FALSE;
+ addColumn(t, wParam, lParam);
+ *lResult = 0;
+ return TRUE;
}
return FALSE;
}