Huw Davies : comctl32: Remove button wrap states when TBSTYLE_WRAPABLE is cleared.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Apr 30 07:19:29 CDT 2015
Module: wine
Branch: master
Commit: eb8df37a696317bf4f067071fd351a1737da41b8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb8df37a696317bf4f067071fd351a1737da41b8
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Apr 29 16:49:49 2015 +0100
comctl32: Remove button wrap states when TBSTYLE_WRAPABLE is cleared.
---
dlls/comctl32/tests/toolbar.c | 10 ++++++++++
dlls/comctl32/toolbar.c | 11 +++++++++++
2 files changed, 21 insertions(+)
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 365bfe2..4bbffd3 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -1085,6 +1085,7 @@ static void test_sizes(void)
HWND hToolbar = NULL;
HIMAGELIST himl, himl2;
TBBUTTONINFOA tbinfo;
+ TBBUTTON button;
int style;
int i;
int fontheight = system_font_height();
@@ -1100,9 +1101,13 @@ static void test_sizes(void)
check_sizes();
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0);
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 */
SetWindowLongA(hToolbar, GWL_STYLE, style|TBSTYLE_WRAPABLE);
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 */
SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1);
check_sizes();
@@ -1111,6 +1116,11 @@ static void test_sizes(void)
for (i=0; i<15; i++)
SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1);
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);
SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons1);
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index b2f13c5..b86ae9f 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -4918,6 +4918,13 @@ TOOLBAR_SetState (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
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
TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style)
@@ -4935,7 +4942,11 @@ TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, DWORD style)
TOOLBAR_CheckStyle(infoPtr);
if ((dwOldStyle ^ style) & TBSTYLE_WRAPABLE)
+ {
+ if (dwOldStyle & TBSTYLE_WRAPABLE)
+ unwrap(infoPtr);
TOOLBAR_CalcToolbar(infoPtr);
+ }
else if ((dwOldStyle ^ style) & CCS_VERT)
TOOLBAR_LayoutToolbar(infoPtr);
More information about the wine-cvs
mailing list