Commit 31b44fb6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Fix TB_SETEXTENDEDSTYLE to use mask passed in wParam.

parent 4db6d184
...@@ -1840,6 +1840,76 @@ static void test_create(void) ...@@ -1840,6 +1840,76 @@ static void test_create(void)
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
typedef struct {
DWORD mask;
DWORD style;
DWORD style_set;
} extended_style_t;
static const extended_style_t extended_style_test[] = {
{
TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_DOUBLEBUFFER,
TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_DOUBLEBUFFER,
TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_DOUBLEBUFFER
},
{
TBSTYLE_EX_MIXEDBUTTONS, TBSTYLE_EX_MIXEDBUTTONS,
TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_DOUBLEBUFFER | TBSTYLE_EX_MIXEDBUTTONS
},
{ 0, TBSTYLE_EX_MIXEDBUTTONS, TBSTYLE_EX_MIXEDBUTTONS },
{ 0, 0, 0 },
{ 0, TBSTYLE_EX_DRAWDDARROWS, TBSTYLE_EX_DRAWDDARROWS },
{ 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS, TBSTYLE_EX_HIDECLIPPEDBUTTONS },
{ 0, 0, 0 },
{ TBSTYLE_EX_HIDECLIPPEDBUTTONS, TBSTYLE_EX_MIXEDBUTTONS, 0 },
{ TBSTYLE_EX_MIXEDBUTTONS, TBSTYLE_EX_HIDECLIPPEDBUTTONS, 0 },
{ TBSTYLE_EX_DOUBLEBUFFER, TBSTYLE_EX_MIXEDBUTTONS, 0 },
{
TBSTYLE_EX_DOUBLEBUFFER | TBSTYLE_EX_MIXEDBUTTONS,
TBSTYLE_EX_MIXEDBUTTONS, TBSTYLE_EX_MIXEDBUTTONS
},
{
TBSTYLE_EX_DOUBLEBUFFER | TBSTYLE_EX_MIXEDBUTTONS,
TBSTYLE_EX_DOUBLEBUFFER, TBSTYLE_EX_DOUBLEBUFFER
}
};
static void test_TB_GET_SET_EXTENDEDSTYLE(void)
{
DWORD style, oldstyle, oldstyle2;
const extended_style_t *ptr;
HWND hwnd;
int i;
rebuild_toolbar(&hwnd);
SendMessageA(hwnd, TB_SETEXTENDEDSTYLE, TBSTYLE_EX_DOUBLEBUFFER, TBSTYLE_EX_MIXEDBUTTONS);
style = SendMessageA(hwnd, TB_GETEXTENDEDSTYLE, 0, 0);
if (style == TBSTYLE_EX_MIXEDBUTTONS)
{
win_skip("Some extended style bits are not supported\n");
DestroyWindow(hwnd);
return;
}
for (i = 0; i < sizeof(extended_style_test)/sizeof(extended_style_t); i++)
{
ptr = &extended_style_test[i];
oldstyle2 = SendMessageA(hwnd, TB_GETEXTENDEDSTYLE, 0, 0);
oldstyle = SendMessageA(hwnd, TB_SETEXTENDEDSTYLE, ptr->mask, ptr->style);
ok(oldstyle == oldstyle2, "%d: got old style 0x%08x, expected 0x%08x\n", i, oldstyle, oldstyle2);
style = SendMessageA(hwnd, TB_GETEXTENDEDSTYLE, 0, 0);
ok(style == ptr->style_set, "%d: got style 0x%08x, expected 0x%08x\n", i, style, ptr->style_set);
}
DestroyWindow(hwnd);
}
START_TEST(toolbar) START_TEST(toolbar)
{ {
WNDCLASSA wc; WNDCLASSA wc;
...@@ -1881,6 +1951,7 @@ START_TEST(toolbar) ...@@ -1881,6 +1951,7 @@ START_TEST(toolbar)
test_tooltip(); test_tooltip();
test_get_set_style(); test_get_set_style();
test_create(); test_create();
test_TB_GET_SET_EXTENDEDSTYLE();
PostQuitMessage(0); PostQuitMessage(0);
while(GetMessageA(&msg,0,0,0)) { while(GetMessageA(&msg,0,0,0)) {
......
...@@ -4481,20 +4481,22 @@ TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) ...@@ -4481,20 +4481,22 @@ TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
* (MSDN says that this parameter is reserved) * (MSDN says that this parameter is reserved)
*/ */
static LRESULT static LRESULT
TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, LPARAM lParam) TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, DWORD mask, DWORD style)
{ {
DWORD dwOldStyle; DWORD old_style = infoPtr->dwExStyle;
dwOldStyle = infoPtr->dwExStyle; TRACE("mask=0x%08x, style=0x%08x\n", mask, style);
infoPtr->dwExStyle = (DWORD)lParam;
TRACE("new style 0x%08x\n", infoPtr->dwExStyle); if (mask)
infoPtr->dwExStyle = (old_style & ~mask) | (style & mask);
else
infoPtr->dwExStyle = style;
if (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL) if (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)
FIXME("Unknown Toolbar Extended Style 0x%08x. Please report.\n", FIXME("Unknown Toolbar Extended Style 0x%08x. Please report.\n",
(infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)); (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
if ((dwOldStyle ^ infoPtr->dwExStyle) & TBSTYLE_EX_MIXEDBUTTONS) if ((old_style ^ infoPtr->dwExStyle) & TBSTYLE_EX_MIXEDBUTTONS)
TOOLBAR_CalcToolbar(infoPtr); TOOLBAR_CalcToolbar(infoPtr);
else else
TOOLBAR_LayoutToolbar(infoPtr); TOOLBAR_LayoutToolbar(infoPtr);
...@@ -4502,7 +4504,7 @@ TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, LPARAM lParam) ...@@ -4502,7 +4504,7 @@ TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, LPARAM lParam)
TOOLBAR_AutoSize(infoPtr); TOOLBAR_AutoSize(infoPtr);
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return (LRESULT)dwOldStyle; return old_style;
} }
...@@ -6629,7 +6631,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -6629,7 +6631,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TOOLBAR_SetDrawTextFlags (infoPtr, wParam, lParam); return TOOLBAR_SetDrawTextFlags (infoPtr, wParam, lParam);
case TB_SETEXTENDEDSTYLE: case TB_SETEXTENDEDSTYLE:
return TOOLBAR_SetExtendedStyle (infoPtr, lParam); return TOOLBAR_SetExtendedStyle (infoPtr, wParam, lParam);
case TB_SETHOTIMAGELIST: case TB_SETHOTIMAGELIST:
return TOOLBAR_SetHotImageList (infoPtr, wParam, (HIMAGELIST)lParam); return TOOLBAR_SetHotImageList (infoPtr, wParam, (HIMAGELIST)lParam);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment