From e3e061ee13588c0aa29640436e1b895b929c1c04 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Aug 2008 11:23:51 +0000 Subject: [PATCH] implement wxToolBarTool::SetLabel() for wxOSX_USE_NATIVE_TOOLBAR (#9746) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/toolbar.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index ca73d5fd89..64a2201cce 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -208,7 +208,30 @@ public: { return m_index; } -#endif + + virtual void SetLabel(const wxString& label) + { + wxToolBarToolBase::SetLabel(label); + + if ( m_toolbarItemRef ) + { + wxFont f; + wxFontEncoding enc; + if ( GetToolBar() ) + f = GetToolBar()->GetFont(); + if ( f.IsOk() ) + enc = f.GetEncoding(); + else + enc = wxFont::GetDefaultEncoding(); + + // strip mnemonics from the label for compatibility with the usual + // labels in wxStaticText sense + wxString labelStr = wxStripMenuCodes(label); + + HIToolbarItemSetLabel( m_toolbarItemRef, wxCFStringRef(labelStr, enc) ); + } + } +#endif // wxOSX_USE_NATIVE_TOOLBAR private: void Init() -- 2.45.2