comctl32/trackbar: Update control parts when style changed.

Fix trackbar draws incorrectly after changing style. For example, adding TBS_BOTH should cause a
total repaint.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-06-22 16:21:22 +08:00 committed by Alexandre Julliard
parent 8107462b8a
commit 6799667b71
1 changed files with 16 additions and 9 deletions

View File

@ -1502,6 +1502,19 @@ TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr)
return 0;
}
static void TRACKBAR_RecalculateAll (TRACKBAR_INFO *infoPtr)
{
if (infoPtr->dwStyle & TBS_FIXEDLENGTH)
{
TRACKBAR_CalcChannel(infoPtr);
TRACKBAR_UpdateThumb(infoPtr);
}
else
{
TRACKBAR_InitializeThumb(infoPtr);
}
TRACKBAR_AlignBuddies(infoPtr);
}
static LRESULT
TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
@ -1677,14 +1690,7 @@ TRACKBAR_SetFocus (TRACKBAR_INFO *infoPtr)
static LRESULT
TRACKBAR_Size (TRACKBAR_INFO *infoPtr)
{
if (infoPtr->dwStyle & TBS_FIXEDLENGTH)
{
TRACKBAR_CalcChannel(infoPtr);
TRACKBAR_UpdateThumb(infoPtr);
}
else
TRACKBAR_InitializeThumb(infoPtr);
TRACKBAR_AlignBuddies (infoPtr);
TRACKBAR_RecalculateAll(infoPtr);
TRACKBAR_InvalidateAll(infoPtr);
return 0;
@ -1697,7 +1703,8 @@ TRACKBAR_StyleChanged (TRACKBAR_INFO *infoPtr, WPARAM wStyleType,
if (wStyleType != GWL_STYLE) return 0;
infoPtr->dwStyle = lpss->styleNew;
TRACKBAR_RecalculateAll(infoPtr);
TRACKBAR_InvalidateAll(infoPtr);
return 0;
}