]> git.saurik.com Git - wxWidgets.git/commitdiff
implement wxToolBarTool::SetLabel() for wxOSX_USE_NATIVE_TOOLBAR (#9746)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 3 Aug 2008 11:23:51 +0000 (11:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 3 Aug 2008 11:23:51 +0000 (11:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/toolbar.cpp

index ca73d5fd8987cf938e4186aef1642ee6c92ca80d..64a2201ccec6d80400e0c98255680c4a9b73cc2d 100644 (file)
@@ -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()