Fix missing item labels in wxToolBar overflow menu under macOS

Always set the label, even when not using wxTB_TEXT style, as otherwise
the items shown in the native "overflow" menu use empty strings as
labels and so can't be distinguished at all.

This undoes part of the changes of 1f7cd4807f (Don't show labels for
toolbars showing icons only in wxOSX, 2016-02-23), but they don't seem
necessary any longer, i.e. calling SetToolShortHelp() doesn't show the
toolbar label when using non-native toolbars, so #16669 remains fixed.

Closes #19226.
This commit is contained in:
Vadim Zeitlin
2021-08-06 21:17:51 +02:00
parent d8fe06891e
commit ce48d01e8a

View File

@@ -175,14 +175,10 @@ public:
void UpdateLabel()
{
// Use an empty string if we're not displaying text
wxString labelStr;
wxToolBar *tbar = (wxToolBar*) GetToolBar();
int style = (tbar ? tbar->GetWindowStyleFlag() : 0);
if ( (style & (wxTB_NOICONS | wxTB_TEXT)) != 0 )
labelStr = wxStripMenuCodes(m_label);
wxCFStringRef l(labelStr, GetToolBarFontEncoding());
wxCFStringRef l(wxStripMenuCodes(m_label), GetToolBarFontEncoding());
wxCFStringRef sh( GetShortHelp(), GetToolBarFontEncoding() );
#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_toolbarItem )