Nikolay Sivov : comctl32: Update ticks on TBM_SETRANGEMAX.
Alexandre Julliard
julliard at winehq.org
Mon Feb 13 13:43:24 CST 2012
Module: wine
Branch: master
Commit: abde0c21e369b16f743290ac82a0d8bc594b2ab1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=abde0c21e369b16f743290ac82a0d8bc594b2ab1
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Feb 12 16:17:53 2012 +0300
comctl32: Update ticks on TBM_SETRANGEMAX.
---
dlls/comctl32/tests/trackbar.c | 38 ++++++++++++++++++++++++++++++++++++++
dlls/comctl32/trackbar.c | 9 +++++++--
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index eb320d5..7c16ae8 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -982,6 +982,43 @@ static void test_initial_state(void)
expect(-1, ret);
ret = SendMessage(hWnd, TBM_GETTICPOS, 0, 0);
expect(-1, ret);
+ ret = SendMessage(hWnd, TBM_GETRANGEMIN, 0, 0);
+ expect(0, ret);
+ ret = SendMessage(hWnd, TBM_GETRANGEMAX, 0, 0);
+ expect(100, ret);
+
+ ret = SendMessage(hWnd, TBM_SETRANGEMAX, TRUE, 200);
+ expect(0, ret);
+
+ ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0);
+ expect(2, ret);
+
+ DestroyWindow(hWnd);
+}
+
+static void test_TBS_AUTOTICKS(void)
+{
+ HWND hWnd;
+ int ret;
+
+ hWnd = create_trackbar(TBS_AUTOTICKS, hWndParent);
+
+ ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0);
+ expect(2, ret);
+ ret = SendMessage(hWnd, TBM_GETTIC, 0, 0);
+ expect(-1, ret);
+ ret = SendMessage(hWnd, TBM_GETTICPOS, 0, 0);
+ expect(-1, ret);
+ ret = SendMessage(hWnd, TBM_GETRANGEMIN, 0, 0);
+ expect(0, ret);
+ ret = SendMessage(hWnd, TBM_GETRANGEMAX, 0, 0);
+ expect(100, ret);
+
+ ret = SendMessage(hWnd, TBM_SETRANGEMAX, TRUE, 200);
+ expect(0, ret);
+
+ ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0);
+ expect(201, ret);
DestroyWindow(hWnd);
}
@@ -1031,6 +1068,7 @@ START_TEST(trackbar)
test_tic_placement(hWndTrackbar);
test_tool_tips(hWndTrackbar);
test_unicode(hWndTrackbar);
+ test_TBS_AUTOTICKS();
flush_sequences(sequences, NUM_MSG_SEQUENCE);
DestroyWindow(hWndTrackbar);
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 788e21f..667bff1 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -1176,8 +1176,10 @@ TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lRange)
static inline LRESULT
-TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMax)
+TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL redraw, LONG lMax)
{
+ BOOL changed = infoPtr->lRangeMax != lMax;
+
infoPtr->lRangeMax = lMax;
if (infoPtr->lPos > infoPtr->lRangeMax) {
infoPtr->lPos = infoPtr->lRangeMax;
@@ -1187,7 +1189,10 @@ TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMax)
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
- if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
+ if (changed && (infoPtr->dwStyle & TBS_AUTOTICKS))
+ TRACKBAR_RecalculateTics (infoPtr);
+
+ if (redraw) TRACKBAR_InvalidateAll(infoPtr);
return 0;
}
More information about the wine-cvs
mailing list