comctl32: Fix TB_SETEXTENDEDSTYLE to use mask passed in wParam.

This commit is contained in:
Nikolay Sivov 2012-02-16 12:59:16 +03:00 committed by Alexandre Julliard
parent 4db6d184b3
commit 31b44fb6e8
2 changed files with 81 additions and 8 deletions

View File

@ -1840,6 +1840,76 @@ static void test_create(void)
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)
{
WNDCLASSA wc;
@ -1881,6 +1951,7 @@ START_TEST(toolbar)
test_tooltip();
test_get_set_style();
test_create();
test_TB_GET_SET_EXTENDEDSTYLE();
PostQuitMessage(0);
while(GetMessageA(&msg,0,0,0)) {

View File

@ -4481,20 +4481,22 @@ TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
* (MSDN says that this parameter is reserved)
*/
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;
infoPtr->dwExStyle = (DWORD)lParam;
TRACE("mask=0x%08x, style=0x%08x\n", mask, style);
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)
FIXME("Unknown Toolbar Extended Style 0x%08x. Please report.\n",
(infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
if ((dwOldStyle ^ infoPtr->dwExStyle) & TBSTYLE_EX_MIXEDBUTTONS)
if ((old_style ^ infoPtr->dwExStyle) & TBSTYLE_EX_MIXEDBUTTONS)
TOOLBAR_CalcToolbar(infoPtr);
else
TOOLBAR_LayoutToolbar(infoPtr);
@ -4502,7 +4504,7 @@ TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, LPARAM lParam)
TOOLBAR_AutoSize(infoPtr);
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return (LRESULT)dwOldStyle;
return old_style;
}
@ -6629,7 +6631,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TOOLBAR_SetDrawTextFlags (infoPtr, wParam, lParam);
case TB_SETEXTENDEDSTYLE:
return TOOLBAR_SetExtendedStyle (infoPtr, lParam);
return TOOLBAR_SetExtendedStyle (infoPtr, wParam, lParam);
case TB_SETHOTIMAGELIST:
return TOOLBAR_SetHotImageList (infoPtr, wParam, (HIMAGELIST)lParam);