From d8ff3189e277a50a8a78e7df47de42649d161de5 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 9 Dec 2015 21:04:43 +0100 Subject: [PATCH 1/3] Adding wxFALLTHROUGH instead of comment. For code-analysis support. --- src/msw/toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index af56c305d0..ebdd261a82 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -921,7 +921,7 @@ bool wxToolBar::Realize() button.iBitmap = IsVertical() ? sizeControl.y : sizeControl.x; } - // Fall through + wxFALLTHROUGH; case wxTOOL_STYLE_SEPARATOR: if ( tool->IsStretchableSpace() ) From 757117ab2aa6b587ea8b4c761b9a77342cf3f740 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 9 Dec 2015 21:05:28 +0100 Subject: [PATCH 2/3] Use wxSwap() function to swap values. --- src/msw/toolbar.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index ebdd261a82..3cfee08579 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -469,9 +469,7 @@ wxSize wxToolBar::DoGetBestSize() const // reverse horz and vertical components if necessary if ( IsVertical() ) { - int t = sizeBest.x; - sizeBest.x = sizeBest.y; - sizeBest.y = t; + wxSwap(sizeBest.x, sizeBest.y); } } else // TB_GETMAXSIZE succeeded From 9b56c41c6a10b7d64e358e6713c01b6143e11ed6 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 9 Dec 2015 21:06:05 +0100 Subject: [PATCH 3/3] Size toolbar buttons automatically only for horizontal toolbars. Buttons with fixed width look better for vertical toolbars so apply TBSTYLE_AUTOSIZE style to the buttons only for horizontal toolbars. --- src/msw/toolbar.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 3cfee08579..6875263f90 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -1018,13 +1018,15 @@ bool wxToolBar::Realize() break; } - // Instead of using fixed widths for all buttons, size them + // When toolbar has wxTB_HORZ_LAYOUT style then + // instead of using fixed widths for all buttons, size them // automatically according to the size of their bitmap and text - // label, if present. This particularly matters for toolbars - // with the wxTB_HORZ_LAYOUT style: they look hideously ugly - // without autosizing when the labels have even slightly - // different lengths. - button.fsStyle |= TBSTYLE_AUTOSIZE; + // label, if present. They look hideously ugly without autosizing + // when the labels have even slightly different lengths. + if ( !IsVertical() ) + { + button.fsStyle |= TBSTYLE_AUTOSIZE; + } bitmapId++; break;