Change logic of listbox resizing for 16 bits apps for lists without

LBS_NOINTEGRALHEIGHT style.
This commit is contained in:
Gerard Patel 2000-08-01 20:48:40 +00:00 committed by Alexandre Julliard
parent 3c41fabc6a
commit cef12530eb
1 changed files with 12 additions and 5 deletions

View File

@ -348,16 +348,23 @@ static void LISTBOX_UpdateSize( WND *wnd, LB_DESCR *descr )
descr->height = rect.bottom - rect.top; descr->height = rect.bottom - rect.top;
if (!(descr->style & LBS_NOINTEGRALHEIGHT) && !(descr->style & LBS_OWNERDRAWVARIABLE)) if (!(descr->style & LBS_NOINTEGRALHEIGHT) && !(descr->style & LBS_OWNERDRAWVARIABLE))
{ {
if ((descr->height > descr->item_height) && UINT remaining = descr->height % descr->item_height;
(descr->height % descr->item_height)) if ((descr->height > descr->item_height) && remaining)
{ {
if (!(wnd->flags & WIN_ISWIN32))
{ /* give a margin for error to 16 bits programs - if we need
less than the height of the nonclient area, round to the
*next* number of items */
int ncheight = wnd->rectWindow.bottom - wnd->rectWindow.top - descr->height;
if ((descr->item_height - remaining) <= ncheight)
remaining = remaining - descr->item_height;
}
TRACE("[%04x]: changing height %d -> %d\n", TRACE("[%04x]: changing height %d -> %d\n",
wnd->hwndSelf, descr->height, wnd->hwndSelf, descr->height,
descr->height - descr->height%descr->item_height ); descr->height - remaining );
SetWindowPos( wnd->hwndSelf, 0, 0, 0, SetWindowPos( wnd->hwndSelf, 0, 0, 0,
wnd->rectWindow.right - wnd->rectWindow.left, wnd->rectWindow.right - wnd->rectWindow.left,
wnd->rectWindow.bottom - wnd->rectWindow.top - wnd->rectWindow.bottom - wnd->rectWindow.top - remaining,
(descr->height % descr->item_height),
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE ); SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE );
return; return;
} }