fixed some scrolling issues

svn path=/trunk/; revision=16407
This commit is contained in:
Thomas Bluemel 2005-07-04 11:52:16 +00:00
parent 48e0fe423b
commit 0140b609d9

View file

@ -310,17 +310,16 @@ PtToCheckItemBox(IN PCHECKLISTWND infoPtr,
if (DirectlyInCheckBox != NULL)
{
INT y = ppt->y % infoPtr->ItemHeight;
INT cxBox = infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT);
if ((y >= CI_TEXT_MARGIN_HEIGHT &&
y < infoPtr->ItemHeight - CI_TEXT_MARGIN_HEIGHT) &&
(((ppt->x >= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (infoPtr->ItemHeight / 2))) &&
(ppt->x < (infoPtr->CheckBoxLeft[CLB_ALLOW] - (infoPtr->ItemHeight / 2) +
infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT))))
(((ppt->x >= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (cxBox / 2))) &&
(ppt->x < (infoPtr->CheckBoxLeft[CLB_ALLOW] - (cxBox / 2) + cxBox)))
||
((ppt->x >= (infoPtr->CheckBoxLeft[CLB_DENY] - (infoPtr->ItemHeight / 2))) &&
(ppt->x < (infoPtr->CheckBoxLeft[CLB_DENY] - (infoPtr->ItemHeight / 2) +
infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT))))))
((ppt->x >= (infoPtr->CheckBoxLeft[CLB_DENY] - (cxBox / 2))) &&
(ppt->x < (infoPtr->CheckBoxLeft[CLB_DENY] - (cxBox / 2) + cxBox)))))
{
*DirectlyInCheckBox = TRUE;
}
@ -446,6 +445,7 @@ UpdateControl(IN PCHECKLISTWND infoPtr,
RECT rcClient;
SCROLLINFO ScrollInfo;
LONG Style;
INT VisibleItems;
GetClientRect(infoPtr->hSelf,
&rcClient);
@ -458,26 +458,11 @@ UpdateControl(IN PCHECKLISTWND infoPtr,
ScrollInfo.nPos = 0;
ScrollInfo.nTrackPos = 0;
if (AllowChangeStyle)
{
Style = GetWindowLong(infoPtr->hSelf,
GWL_STYLE);
VisibleItems = (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight;
/* determine whether the vertical scrollbar has to be visible or not */
if (ScrollInfo.nMax > ScrollInfo.nPage &&
!(Style & WS_VSCROLL))
if (ScrollInfo.nPage == VisibleItems && ScrollInfo.nMax > 0)
{
SetWindowLong(infoPtr->hSelf,
GWL_STYLE,
Style | WS_VSCROLL);
}
else if (ScrollInfo.nMax < ScrollInfo.nPage &&
Style & WS_VSCROLL)
{
SetWindowLong(infoPtr->hSelf,
GWL_STYLE,
Style & ~WS_VSCROLL);
}
ScrollInfo.nMax--;
}
SetScrollInfo(infoPtr->hSelf,
@ -485,6 +470,28 @@ UpdateControl(IN PCHECKLISTWND infoPtr,
&ScrollInfo,
TRUE);
if (AllowChangeStyle)
{
Style = GetWindowLong(infoPtr->hSelf,
GWL_STYLE);
/* determine whether the vertical scrollbar has to be visible or not */
if (ScrollInfo.nMax > VisibleItems &&
!(Style & WS_VSCROLL))
{
SetWindowLong(infoPtr->hSelf,
GWL_STYLE,
Style | WS_VSCROLL);
}
else if (ScrollInfo.nMax <= VisibleItems &&
(Style & WS_VSCROLL))
{
SetWindowLong(infoPtr->hSelf,
GWL_STYLE,
Style & ~WS_VSCROLL);
}
}
RedrawWindow(infoPtr->hSelf,
NULL,
NULL,