Nikolay Sivov : comctl32: Return previously set colors for PBM_SETBKCOLOR and PBM_SETBARCOLOR.
Alexandre Julliard
julliard at winehq.org
Mon May 27 13:46:54 CDT 2013
Module: wine
Branch: master
Commit: 65a47e3df65159a34fc67f35d14958e9ad831069
URL: http://source.winehq.org/git/wine.git/?a=commit;h=65a47e3df65159a34fc67f35d14958e9ad831069
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sat May 25 20:12:12 2013 +0400
comctl32: Return previously set colors for PBM_SETBKCOLOR and PBM_SETBARCOLOR.
---
dlls/comctl32/progress.c | 14 +++++++++++---
dlls/comctl32/tests/progress.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index aba5302..989c61e 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -544,7 +544,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
case WM_CREATE:
{
DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
-
+
theme = OpenThemeData (hwnd, themeClass);
dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_WINDOWEDGE);
@@ -690,17 +690,25 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
return infoPtr->CurVal;
case PBM_SETBARCOLOR:
+ {
+ COLORREF clr = infoPtr->ColorBar;
+
infoPtr->ColorBar = (COLORREF)lParam;
InvalidateRect(hwnd, NULL, TRUE);
- return 0;
+ return clr;
+ }
case PBM_GETBARCOLOR:
return infoPtr->ColorBar;
case PBM_SETBKCOLOR:
+ {
+ COLORREF clr = infoPtr->ColorBk;
+
infoPtr->ColorBk = (COLORREF)lParam;
InvalidateRect(hwnd, NULL, TRUE);
- return 0;
+ return clr;
+ }
case PBM_GETBKCOLOR:
return infoPtr->ColorBk;
diff --git a/dlls/comctl32/tests/progress.c b/dlls/comctl32/tests/progress.c
index 3083e8b..59a4b00 100644
--- a/dlls/comctl32/tests/progress.c
+++ b/dlls/comctl32/tests/progress.c
@@ -32,6 +32,11 @@
static HWND hProgressParentWnd, hProgressWnd;
static const char progressTestClass[] = "ProgressBarTestClass";
+static HWND create_progress(DWORD style)
+{
+ return CreateWindowExA(0, PROGRESS_CLASSA, "", WS_VISIBLE | style,
+ 0, 0, 100, 20, NULL, NULL, GetModuleHandleA(NULL), 0);
+}
/* try to make sure pending X events have been processed before continuing */
static void flush_events(void)
@@ -224,12 +229,40 @@ static void test_redraw(void)
ok(erased, "Progress bar should have erased the background\n");
}
+static void test_setcolors(void)
+{
+ HWND progress;
+ COLORREF clr;
+
+ progress = create_progress(PBS_SMOOTH);
+
+ clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, 0);
+ ok(clr == CLR_DEFAULT, "got %x\n", clr);
+
+ clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, RGB(0, 255, 0));
+ ok(clr == 0, "got %x\n", clr);
+
+ clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, CLR_DEFAULT);
+ ok(clr == RGB(0, 255, 0), "got %x\n", clr);
+
+ clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, 0);
+ ok(clr == CLR_DEFAULT, "got %x\n", clr);
+
+ clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, RGB(255, 0, 0));
+ ok(clr == 0, "got %x\n", clr);
+
+ clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, CLR_DEFAULT);
+ ok(clr == RGB(255, 0, 0), "got %x\n", clr);
+
+ DestroyWindow(progress);
+}
START_TEST(progress)
{
init();
test_redraw();
-
+ test_setcolors();
+
cleanup();
}
More information about the wine-cvs
mailing list