no real changes, just refactor to remove some code duplication in wxToolBarTool

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-08-03 11:27:03 +00:00
parent e3e061ee13
commit 402c3347d2

View File

@ -178,14 +178,7 @@ public:
m_toolbarItemRef = ref;
if ( m_toolbarItemRef )
{
wxFont f;
wxFontEncoding enc;
if ( GetToolBar() )
f = GetToolBar()->GetFont();
if ( f.IsOk() )
enc = f.GetEncoding();
else
enc = wxFont::GetDefaultEncoding();
wxFontEncoding enc = GetToolBarFontEncoding();
HIToolbarItemSetHelpText(
m_toolbarItemRef,
@ -215,25 +208,29 @@ public:
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) );
HIToolbarItemSetLabel(
m_toolbarItemRef,
wxCFStringRef(labelStr, GetToolBarFontEncoding()) );
}
}
#endif // wxOSX_USE_NATIVE_TOOLBAR
private:
#if wxOSX_USE_NATIVE_TOOLBAR
wxFontEncoding GetToolBarFontEncoding() const
{
wxFont f;
wxFontEncoding enc;
if ( GetToolBar() )
f = GetToolBar()->GetFont();
return f.IsOk() ? f.GetEncoding() : wxFont::GetDefaultEncoding();
}
#endif // wxOSX_USE_NATIVE_TOOLBAR
void Init()
{
m_controlHandle = NULL;