diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index e36d96eccf..18c889dcf5 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -437,6 +437,12 @@ void wxToolBarBase::ClearTools() void wxToolBarBase::AdjustToolBitmapSize() { + if ( HasFlag(wxTB_NOICONS) ) + { + SetToolBitmapSize(wxSize(0, 0)); + return; + } + const wxSize sizeOrig(m_defaultWidth, m_defaultHeight); wxSize sizeActual(sizeOrig); diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 600ff8cd4b..e4926639b5 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -974,6 +974,16 @@ bool wxToolBar::Realize() switch ( tool->GetStyle() ) { case wxTOOL_STYLE_CONTROL: + if ( wxStaticText *staticText = tool->GetStaticText() ) + { + // Display control and its label only if buttons have icons + // and texts as otherwise there is not enough room on the + // toolbar to fit the label. + staticText-> + Show(HasFlag(wxTB_TEXT) && !HasFlag(wxTB_NOICONS)); + } + // Fall through + case wxTOOL_STYLE_SEPARATOR: if ( tool->IsStretchableSpace() ) { @@ -1127,7 +1137,7 @@ bool wxToolBar::Realize() wxSize size = control->GetSize(); wxSize staticTextSize; - if ( staticText ) + if ( staticText && staticText->IsShown() ) { staticTextSize = staticText->GetSize(); staticTextSize.y += 3; // margin between control and its label @@ -1464,6 +1474,12 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), void wxToolBar::SetToolBitmapSize(const wxSize& size) { + // Leave the effective size as (0, 0) if we are not showing bitmaps at all. + wxSize effectiveSize; + + if ( !HasFlag(wxTB_NOICONS) ) + effectiveSize = size; + wxToolBarBase::SetToolBitmapSize(size); ::SendMessage(GetHwnd(), TB_SETBITMAPSIZE, 0, MAKELONG(size.x, size.y));