2014-12-08 14:04:43 -06:00
|
|
|
// 8 december 2014
|
|
|
|
|
2014-12-09 19:32:49 -06:00
|
|
|
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);
|
2014-12-09 19:47:03 -06:00
|
|
|
recomputeHScroll(t);
|
2014-12-09 19:32:49 -06:00
|
|
|
}
|
|
|
|
|
2014-12-08 14:04:43 -06:00
|
|
|
HANDLER(apiHandlers)
|
|
|
|
{
|
|
|
|
switch (uMsg) {
|
|
|
|
case WM_SETFONT:
|
2014-12-08 14:11:42 -06:00
|
|
|
// don't free the old font; see http://blogs.msdn.com/b/oldnewthing/archive/2008/09/12/8945692.aspx
|
2014-12-08 14:04:43 -06:00
|
|
|
t->font = (HFONT) wParam;
|
|
|
|
SendMessageW(t->header, WM_SETFONT, wParam, lParam);
|
|
|
|
// TODO reposition header?
|
|
|
|
// TODO how to properly handle LOWORD(lParam) != FALSE?
|
|
|
|
*lResult = 0;
|
|
|
|
return TRUE;
|
|
|
|
case WM_GETFONT:
|
|
|
|
*lResult = (LRESULT) (t->font);
|
|
|
|
return TRUE;
|
|
|
|
case tableAddColumn:
|
2014-12-09 19:32:49 -06:00
|
|
|
addColumn(t, wParam, lParam);
|
|
|
|
*lResult = 0;
|
|
|
|
return TRUE;
|
2014-12-08 14:04:43 -06:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|