diff --git a/interface/wx/toolbar.h b/interface/wx/toolbar.h index 03d7ba16c4..42a0c4996e 100644 --- a/interface/wx/toolbar.h +++ b/interface/wx/toolbar.h @@ -333,10 +333,6 @@ public: @param label Text to be displayed near the control. - @remarks - wxMSW: the label is only displayed if there is enough space - available below the embedded control. - @remarks wxMac: labels are only displayed if wxWidgets is built with @c wxMAC_USE_NATIVE_TOOLBAR set to 1 diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 85d56eb2f5..456ab0424e 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -194,39 +194,32 @@ public: { if ( m_staticText ) { - if ( !label.empty() ) - { + if ( !label.empty() ) + { m_staticText->SetLabel(label); - } - else - { + } + else + { delete m_staticText; m_staticText = NULL; - } + } } else { - if ( !label.empty() ) - { - // Create a control to render the control's label. - // It has the same witdh as the control. - wxSize size(m_control->GetSize().GetWidth(), wxDefaultCoord); - m_staticText = new wxStaticText(m_tbar, wxID_ANY, label, - wxDefaultPosition, size, - wxALIGN_CENTRE | wxST_NO_AUTORESIZE); - } + if ( !label.empty() ) + { + m_staticText = new wxStaticText(m_tbar, wxID_ANY, label); + } } } - else if ( IsButton() ) - { - // Because new label can have different length than the old one - // so updating button's label with TB_SETBUTTONINFO would require - // also manual re-positionining items in the control tools located - // to the right in the toolbar and recalculation of stretchable - // spacers so it is easier just to recreate the toolbar with - // Realize(). Performance penalty should be negligible. - m_tbar->Realize(); - } + + // Because new label can have different length than the old one + // so updating button's label with TB_SETBUTTONINFO would require + // also manual re-positionining items in the control tools located + // to the right in the toolbar and recalculation of stretchable + // spacers so it is easier just to recreate the toolbar with + // Realize(). Performance penalty should be negligible. + m_tbar->Realize(); } wxStaticText* GetStaticText()