Merge branch 'vert_toolbar_buttons' of https://github.com/a-wi/wxWidgets

Don't use TBSTYLE_AUTOSIZE with vertical toolbars.

Closes #17263.
This commit is contained in:
Vadim Zeitlin
2015-12-13 16:07:09 +01:00

View File

@@ -469,9 +469,7 @@ wxSize wxToolBar::DoGetBestSize() const
// reverse horz and vertical components if necessary // reverse horz and vertical components if necessary
if ( IsVertical() ) if ( IsVertical() )
{ {
int t = sizeBest.x; wxSwap(sizeBest.x, sizeBest.y);
sizeBest.x = sizeBest.y;
sizeBest.y = t;
} }
} }
else // TB_GETMAXSIZE succeeded else // TB_GETMAXSIZE succeeded
@@ -921,7 +919,7 @@ bool wxToolBar::Realize()
button.iBitmap = IsVertical() ? sizeControl.y : sizeControl.x; button.iBitmap = IsVertical() ? sizeControl.y : sizeControl.x;
} }
// Fall through wxFALLTHROUGH;
case wxTOOL_STYLE_SEPARATOR: case wxTOOL_STYLE_SEPARATOR:
if ( tool->IsStretchableSpace() ) if ( tool->IsStretchableSpace() )
@@ -1020,13 +1018,15 @@ bool wxToolBar::Realize()
break; 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 // automatically according to the size of their bitmap and text
// label, if present. This particularly matters for toolbars // label, if present. They look hideously ugly without autosizing
// with the wxTB_HORZ_LAYOUT style: they look hideously ugly // when the labels have even slightly different lengths.
// without autosizing when the labels have even slightly if ( !IsVertical() )
// different lengths. {
button.fsStyle |= TBSTYLE_AUTOSIZE; button.fsStyle |= TBSTYLE_AUTOSIZE;
}
bitmapId++; bitmapId++;
break; break;