Fixed up the whole horizontal scroll glitching mess. Now to tackle the twitchy text...
This commit is contained in:
parent
b73b5b2ed0
commit
38b7126449
|
@ -56,10 +56,15 @@ static void headerAddColumn(struct table *t, WCHAR *name)
|
||||||
panic("error adding column to Table header");
|
panic("error adding column to Table header");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO make a better name for this?
|
||||||
|
// TODO move to hscroll.h?
|
||||||
|
// TODO organize this in general...
|
||||||
|
// TODO because of this function's new extended functionality only hscrollto() is allowed to call repositionHeader()
|
||||||
static void updateTableWidth(struct table *t)
|
static void updateTableWidth(struct table *t)
|
||||||
{
|
{
|
||||||
HDITEMW item;
|
HDITEMW item;
|
||||||
intptr_t i;
|
intptr_t i;
|
||||||
|
RECT client;
|
||||||
|
|
||||||
t->width = 0;
|
t->width = 0;
|
||||||
// TODO count dividers?
|
// TODO count dividers?
|
||||||
|
@ -70,6 +75,16 @@ static void updateTableWidth(struct table *t)
|
||||||
panic("error getting Table column width for updateTableWidth()");
|
panic("error getting Table column width for updateTableWidth()");
|
||||||
t->width += item.cxy;
|
t->width += item.cxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GetClientRect(t->hwnd, &client) == 0)
|
||||||
|
panic("error getting Table client rect in updateTableWidth()");
|
||||||
|
t->hpagesize = client.right - client.left;
|
||||||
|
|
||||||
|
// this part is critical: if we resize the columns to less than the client area width, then the following hscrollby() will make t->hscrollpos negative, which does very bad things
|
||||||
|
// note to self: do this regardless of whether the table width or the client area width was changed
|
||||||
|
if (t->hpagesize > t->width)
|
||||||
|
t->hpagesize = t->width;
|
||||||
|
|
||||||
// do a dummy scroll to update the horizontal scrollbar to use the new width
|
// do a dummy scroll to update the horizontal scrollbar to use the new width
|
||||||
hscrollby(t, 0);
|
hscrollby(t, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
// TODO
|
// TODO
|
||||||
// - should tablePanic be CALLBACK or some other equivalent macro? and definitely export initTable somehow, but which alias macro to use?
|
// - should tablePanic be CALLBACK or some other equivalent macro? and definitely export initTable somehow, but which alias macro to use?
|
||||||
// - make panic messages grammatically correct ("Table error: adding...")
|
// - make panic messages grammatically correct ("Table error: adding...")
|
||||||
// - figure out how to handle the situation where we resize the table width to less than the width of the client rect...
|
|
||||||
|
|
||||||
#define tableWindowClass L"gouitable"
|
#define tableWindowClass L"gouitable"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue