From: Václav Slavík Date: Sun, 2 Mar 2008 10:52:33 +0000 (+0000) Subject: don't set m_font upfront in wxMac, let the GetDefaultAttributes mechanism used by... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/34a3ed019b89012199e1a88f540010653bec90d0 don't set m_font upfront in wxMac, let the GetDefaultAttributes mechanism used by other ports pick the right font if m_font is wxNullFont git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 1c04183a78..87fa56c82b 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -152,7 +152,7 @@ wxSize wxButton::DoGetBestSize() const OSStatus err = m_peer->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); verify_noerr( err ); - wxCFStringRef str( m_label, m_font.GetEncoding() ); + wxCFStringRef str( m_label, GetFont().GetEncoding() ); #if wxMAC_USE_ATSU_TEXT SInt16 baseline; diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index 0e9fdcba58..c395a39d19 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -139,7 +139,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, UMAInsertMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ), items[i], - m_font.GetEncoding(), + GetFont().GetEncoding(), idx); m_datas.Insert( NULL, idx ); AssignNewItemClientData(idx, clientData, i, type); diff --git a/src/mac/carbon/combobxc.cpp b/src/mac/carbon/combobxc.cpp index 6bb1dd4b48..c494f9fada 100644 --- a/src/mac/carbon/combobxc.cpp +++ b/src/mac/carbon/combobxc.cpp @@ -422,7 +422,7 @@ wxString wxComboBox::GetValue() const #if USE_HICOMBOBOX CFStringRef myString; HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)GetSelection(), &myString ); - return wxMacCFStringHolder( myString, m_font.GetEncoding() ).AsString(); + return wxMacCFStringHolder( myString, GetFont().GetEncoding() ).AsString(); #else wxString result; @@ -547,7 +547,7 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, HIComboBoxInsertTextItemAtIndex(m_peer->GetControlRef(), (CFIndex)pos, wxMacCFStringHolder(items[i], - m_font.GetEncoding())); + GetFont().GetEncoding())); AssignNewItemClientData(pos, clientData, i, type); } @@ -670,7 +670,7 @@ void wxComboBox::SetString(unsigned int n, const wxString& s) { #if USE_HICOMBOBOX verify_noerr ( HIComboBoxInsertTextItemAtIndex( m_peer->GetControlRef(), (CFIndex) n, - wxMacCFStringHolder(s, m_font.GetEncoding()) ) ); + wxMacCFStringHolder(s, GetFont().GetEncoding()) ) ); verify_noerr ( HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), (CFIndex) n + 1 ) ); #else m_choice->SetString( n , s ); diff --git a/src/mac/carbon/dataview.cpp b/src/mac/carbon/dataview.cpp index e8b8a9374a..c3ee3ab5c7 100644 --- a/src/mac/carbon/dataview.cpp +++ b/src/mac/carbon/dataview.cpp @@ -1028,9 +1028,9 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr) wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(this->m_peer)); #if wxCHECK_VERSION(2,9,0) - wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()); + wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()); #else - wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()); + wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()); #endif @@ -1148,9 +1148,9 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr) wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(this->m_peer)); #if wxCHECK_VERSION(2,9,0) - wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()); + wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()); #else - wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()); + wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()); #endif diff --git a/src/mac/carbon/dirdlg.cpp b/src/mac/carbon/dirdlg.cpp index 57e384eaff..5caa7f6b4b 100644 --- a/src/mac/carbon/dirdlg.cpp +++ b/src/mac/carbon/dirdlg.cpp @@ -87,7 +87,7 @@ int wxDirDialog::ShowModal() options.optionFlags &= ~kNavAllowMultipleFiles; if (err == noErr) { - wxCFStringRef message(m_message, m_font.GetEncoding()); + wxCFStringRef message(m_message, GetFont().GetEncoding()); options.message = message; err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog); if (err == noErr) diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index 96c365408d..6e43845335 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -301,10 +301,10 @@ int wxFileDialog::ShowModal() // this was always unset in the old code dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation; - wxCFStringRef message(m_message, m_font.GetEncoding()); + wxCFStringRef message(m_message, GetFont().GetEncoding()); dialogCreateOptions.windowTitle = message; - wxCFStringRef defaultFileName(m_fileName, m_font.GetEncoding()); + wxCFStringRef defaultFileName(m_fileName, GetFont().GetEncoding()); dialogCreateOptions.saveFileName = defaultFileName; @@ -324,7 +324,7 @@ int wxFileDialog::ShowModal() myData.menuitems = dialogCreateOptions.popupExtension ; for ( size_t i = 0 ; i < numFilters ; ++i ) { - CFArrayAppendValue( popup , (CFStringRef) wxCFStringRef( myData.name[i] , m_font.GetEncoding() ) ) ; + CFArrayAppendValue( popup , (CFStringRef) wxCFStringRef( myData.name[i] , GetFont().GetEncoding() ) ) ; } } diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index ed4e0dbc2a..f3ad7d37e2 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -979,7 +979,7 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item) { wxFontEncoding enc; if ( m_font.Ok() ) - enc = m_font.GetEncoding(); + enc = GetFont().GetEncoding(); else enc = wxLocale::GetSystemEncoding(); wxCFStringRef cfTitle; diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index 23e288ea88..bc16a338c5 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -864,7 +864,7 @@ void wxMenuBar::MacInstallMenuBar() } else { - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], m_font.GetEncoding() ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], GetFont().GetEncoding() ) ; menu->MacBeforeDisplay(false) ; ::InsertMenu(MAC_WXHMENU(_wxMenuAt(m_menus, i)->GetHMenu()), 0); @@ -979,7 +979,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ; menu->MacBeforeDisplay( false ) ; - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , GetFont().GetEncoding() ) ; if ( pos == m_menus.GetCount() - 1) ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; else @@ -1002,7 +1002,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) m_titles.Insert(title, pos); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , GetFont().GetEncoding() ) ; if ( IsAttached() && s_macInstalledMenuBar == this ) { @@ -1054,7 +1054,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) m_titles.Add(title); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , GetFont().GetEncoding() ) ; if ( IsAttached() ) { diff --git a/src/mac/carbon/msgdlg.cpp b/src/mac/carbon/msgdlg.cpp index 4faaa6e3aa..830efb6f27 100644 --- a/src/mac/carbon/msgdlg.cpp +++ b/src/mac/carbon/msgdlg.cpp @@ -110,13 +110,13 @@ int wxMessageDialog::ShowModal() CFStringRef alternateButtonTitle = NULL; CFStringRef otherButtonTitle = NULL; - wxCFStringRef cfTitle( msgtitle, m_font.GetEncoding() ); - wxCFStringRef cfText( msgtext, m_font.GetEncoding() ); + wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); + wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); - wxCFStringRef cfNoString( m_no.c_str(), m_font.GetEncoding() ); - wxCFStringRef cfYesString( m_yes.c_str(), m_font.GetEncoding() ); - wxCFStringRef cfOKString( m_ok.c_str() , m_font.GetEncoding()) ; - wxCFStringRef cfCancelString( m_cancel.c_str(), m_font.GetEncoding() ); + wxCFStringRef cfNoString( m_no.c_str(), GetFont().GetEncoding() ); + wxCFStringRef cfYesString( m_yes.c_str(), GetFont().GetEncoding() ); + wxCFStringRef cfOKString( m_ok.c_str() , GetFont().GetEncoding()) ; + wxCFStringRef cfCancelString( m_cancel.c_str(), GetFont().GetEncoding() ); int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; @@ -167,13 +167,13 @@ int wxMessageDialog::ShowModal() short result; AlertStdCFStringAlertParamRec param; - wxCFStringRef cfNoString( m_no.c_str(), m_font.GetEncoding() ); - wxCFStringRef cfYesString( m_yes.c_str(), m_font.GetEncoding() ); - wxCFStringRef cfOKString( m_ok.c_str(), m_font.GetEncoding() ); - wxCFStringRef cfCancelString( m_cancel.c_str(), m_font.GetEncoding() ); + wxCFStringRef cfNoString( m_no.c_str(), GetFont().GetEncoding() ); + wxCFStringRef cfYesString( m_yes.c_str(), GetFont().GetEncoding() ); + wxCFStringRef cfOKString( m_ok.c_str(), GetFont().GetEncoding() ); + wxCFStringRef cfCancelString( m_cancel.c_str(), GetFont().GetEncoding() ); - wxCFStringRef cfTitle( msgtitle, m_font.GetEncoding() ); - wxCFStringRef cfText( msgtext, m_font.GetEncoding() ); + wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); + wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); param.movable = true; param.flags = 0; diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index 925e652b43..7f82d490f7 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -399,7 +399,7 @@ void wxNotebook::MacSetupTabs() page = m_pages[ii]; info.version = kControlTabInfoVersionOne; info.iconSuiteID = 0; - wxCFStringRef cflabel( page->GetLabel(), m_font.GetEncoding() ) ; + wxCFStringRef cflabel( page->GetLabel(), GetFont().GetEncoding() ) ; info.name = cflabel ; m_peer->SetData( ii + 1, kControlTabInfoTag, &info ) ; diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index a4e5cd951d..d2f9fd1cea 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -92,7 +92,7 @@ wxSize wxStaticText::DoGetBestSize() const OSStatus err = m_peer->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); verify_noerr( err ); - wxCFStringRef str( m_label, m_font.GetEncoding() ); + wxCFStringRef str( m_label, GetFont().GetEncoding() ); #if wxMAC_USE_ATSU_TEXT SInt16 baseline; @@ -179,7 +179,7 @@ void wxStaticText::DoSetLabel(const wxString& label) m_labelOrig = label; m_label = RemoveMnemonics(label); - wxCFStringRef str( m_label, m_font.GetEncoding() ); + wxCFStringRef str( m_label, GetFont().GetEncoding() ); OSStatus err = m_peer->SetData(kControlEntireControl, kControlStaticTextCFStringTag, str); verify_noerr( err ); } diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index 627cb2aa1f..665abf5518 100644 --- a/src/mac/carbon/toolbar.cpp +++ b/src/mac/carbon/toolbar.cpp @@ -1526,7 +1526,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) InstallEventHandler( HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(), GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL ); - HIToolbarItemSetLabel( item, wxCFStringRef(label, m_font.GetEncoding()) ); + HIToolbarItemSetLabel( item, wxCFStringRef(label, GetFont().GetEncoding()) ); HIToolbarItemSetImage( item, info2.u.imageRef ); HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction ); tool->SetToolbarItemRef( item ); diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 740c8c3a77..89151b721e 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -1209,7 +1209,7 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow( SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; - SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , m_font.GetEncoding() ) ); + SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) ); m_peer = new wxMacControl(this , true /*isRootControl*/) ; // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of @@ -1306,7 +1306,7 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool WXUNUSED(inIsActiva void wxTopLevelWindowMac::SetTitle(const wxString& title) { wxWindow::SetLabel( title ) ; - SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , m_font.GetEncoding() ) ) ; + SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) ) ; } wxString wxTopLevelWindowMac::GetTitle() const diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index d8de6e9f55..a568f33d28 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -885,9 +885,6 @@ void wxWindowMac::Init() m_macIsUserPane = true; m_clipChildren = false ; m_cachedClippedRectValid = false ; - - // we need a valid font for the encodings - wxWindowBase::SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); } wxWindowMac::~wxWindowMac()