winefile: Clarify header width calculations.

Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Lauri Kenttä 2016-05-30 20:42:54 +03:00 committed by Alexandre Julliard
parent c1ab903f22
commit a3547a1359
1 changed files with 9 additions and 18 deletions

View File

@ -3163,30 +3163,21 @@ static void set_header(Pane* pane)
{
HDITEMW item;
int scroll_pos = GetScrollPos(pane->hwnd, SB_HORZ);
int i=0, x=0;
int i;
item.mask = HDI_WIDTH;
item.cxy = 0;
for(; (i < COLUMNS) && (x+pane->widths[i] < scroll_pos); i++) {
x += pane->widths[i];
for (i = 0; i < COLUMNS; ++i) {
if (pane->positions[i] >= scroll_pos) {
item.cxy = pane->widths[i];
} else if (pane->positions[i+1] <= scroll_pos) {
item.cxy = 0;
} else {
item.cxy = pane->positions[i+1] - scroll_pos;
}
pane->widths_shown[i] = item.cxy;
SendMessageW(pane->hwndHeader, HDM_SETITEMW, i, (LPARAM)&item);
}
if (i < COLUMNS) {
x += pane->widths[i];
item.cxy = x - scroll_pos;
pane->widths_shown[i] = item.cxy;
SendMessageW(pane->hwndHeader, HDM_SETITEMW, i++, (LPARAM)&item);
for(; i < COLUMNS; i++) {
item.cxy = pane->widths[i];
x += pane->widths[i];
pane->widths_shown[i] = item.cxy;
SendMessageW(pane->hwndHeader, HDM_SETITEMW, i, (LPARAM)&item);
}
}
}
static LRESULT pane_notify(Pane* pane, NMHDR* pnmh)