Added new Windows Table header columns (and this time we'll split out the dummy data).
This commit is contained in:
parent
26f7fc6a6b
commit
47a83a311d
|
@ -38,3 +38,17 @@ static void repositionHeader(struct table *t)
|
||||||
wp.flags | SWP_SHOWWINDOW) == 0)
|
wp.flags | SWP_SHOWWINDOW) == 0)
|
||||||
panic("error repositioning Table header");
|
panic("error repositioning Table header");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void headerAddColumn(struct table *t, WCHAR *name)
|
||||||
|
{
|
||||||
|
HDITEMW item;
|
||||||
|
|
||||||
|
ZeroMemory(&item, sizeof (HDITEMW));
|
||||||
|
item.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT;
|
||||||
|
item.cxy = 200; // TODO
|
||||||
|
item.pszText = name;
|
||||||
|
item.fmt = HDF_LEFT | HDF_STRING;
|
||||||
|
// TODO replace 100 with (t->nColumns - 1)
|
||||||
|
if (SendMessage(t->header, HDM_INSERTITEM, (WPARAM) (100), (LPARAM) (&item)) == (LRESULT) (-1))
|
||||||
|
panic("error adding column to Table header");
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,13 @@ static const handlerfunc handlers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void initDummyTableStuff(struct table *t)
|
||||||
|
{
|
||||||
|
headerAddColumn(t, L"Column 1");
|
||||||
|
headerAddColumn(t, L"Column 2");
|
||||||
|
headerAddColumn(t, L"Column 3");
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct table *t;
|
struct table *t;
|
||||||
|
@ -81,6 +88,7 @@ static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
t = (struct table *) tableAlloc(sizeof (struct table), "error allocating internal Table data structure");
|
t = (struct table *) tableAlloc(sizeof (struct table), "error allocating internal Table data structure");
|
||||||
t->hwnd = hwnd;
|
t->hwnd = hwnd;
|
||||||
makeHeader(t, cs->hInstance);
|
makeHeader(t, cs->hInstance);
|
||||||
|
initDummyTableStuff(t);
|
||||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) t);
|
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) t);
|
||||||
}
|
}
|
||||||
// even if we did the above, fall through
|
// even if we did the above, fall through
|
||||||
|
|
Loading…
Reference in New Issue