Commit eb8df37a authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

comctl32: Remove button wrap states when TBSTYLE_WRAPABLE is cleared.

parent 8633fd62
...@@ -1085,6 +1085,7 @@ static void test_sizes(void) ...@@ -1085,6 +1085,7 @@ static void test_sizes(void)
HWND hToolbar = NULL; HWND hToolbar = NULL;
HIMAGELIST himl, himl2; HIMAGELIST himl, himl2;
TBBUTTONINFOA tbinfo; TBBUTTONINFOA tbinfo;
TBBUTTON button;
int style; int style;
int i; int i;
int fontheight = system_font_height(); int fontheight = system_font_height();
...@@ -1100,9 +1101,13 @@ static void test_sizes(void) ...@@ -1100,9 +1101,13 @@ static void test_sizes(void)
check_sizes(); check_sizes();
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0); SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0);
check_sizes(); check_sizes();
SendMessageA(hToolbar, TB_GETBUTTON, 5, (LPARAM)&button);
ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "got %08x\n", button.fsState);
/* after setting the TBSTYLE_WRAPABLE the TBSTATE_WRAP is ignored */ /* after setting the TBSTYLE_WRAPABLE the TBSTATE_WRAP is ignored */
SetWindowLongA(hToolbar, GWL_STYLE, style|TBSTYLE_WRAPABLE); SetWindowLongA(hToolbar, GWL_STYLE, style|TBSTYLE_WRAPABLE);
check_sizes(); check_sizes();
SendMessageA(hToolbar, TB_GETBUTTON, 5, (LPARAM)&button);
ok(button.fsState == TBSTATE_ENABLED, "got %08x\n", button.fsState);
/* adding new buttons with TBSTYLE_WRAPABLE doesn't add a new row */ /* adding new buttons with TBSTYLE_WRAPABLE doesn't add a new row */
SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1); SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1);
check_sizes(); check_sizes();
...@@ -1111,6 +1116,11 @@ static void test_sizes(void) ...@@ -1111,6 +1116,11 @@ static void test_sizes(void)
for (i=0; i<15; i++) for (i=0; i<15; i++)
SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1); SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1);
check_sizes_todo(0x4); check_sizes_todo(0x4);
SendMessageA(hToolbar, TB_GETBUTTON, 31, (LPARAM)&button);
ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "got %08x\n", button.fsState);
SetWindowLongA(hToolbar, GWL_STYLE, style);
SendMessageA(hToolbar, TB_GETBUTTON, 31, (LPARAM)&button);
ok(button.fsState == TBSTATE_ENABLED, "got %08x\n", button.fsState);
rebuild_toolbar_with_buttons(&hToolbar); rebuild_toolbar_with_buttons(&hToolbar);
SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1); SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1);
......
...@@ -4918,6 +4918,13 @@ TOOLBAR_SetState (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam) ...@@ -4918,6 +4918,13 @@ TOOLBAR_SetState (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
return TRUE; return TRUE;
} }
static inline void unwrap(TOOLBAR_INFO *info)
{
int i;
for (i = 0; i < info->nNumButtons; i++)
info->buttons[i].fsState &= ~TBSTATE_WRAP;
}
static LRESULT static LRESULT
TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style) TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style)
...@@ -4935,7 +4942,11 @@ TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style) ...@@ -4935,7 +4942,11 @@ TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style)
TOOLBAR_CheckStyle(infoPtr); TOOLBAR_CheckStyle(infoPtr);
if ((dwOldStyle ^ style) & TBSTYLE_WRAPABLE) if ((dwOldStyle ^ style) & TBSTYLE_WRAPABLE)
{
if (dwOldStyle & TBSTYLE_WRAPABLE)
unwrap(infoPtr);
TOOLBAR_CalcToolbar(infoPtr); TOOLBAR_CalcToolbar(infoPtr);
}
else if ((dwOldStyle ^ style) & CCS_VERT) else if ((dwOldStyle ^ style) & CCS_VERT)
TOOLBAR_LayoutToolbar(infoPtr); TOOLBAR_LayoutToolbar(infoPtr);
......
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