blob: a933df76059488e713f476e2d20e6300682baeb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
}
|