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
This commit is contained in:
Václav Slavík
2008-03-02 10:52:33 +00:00
parent 4bff335abe
commit 34a3ed019b
14 changed files with 36 additions and 39 deletions

View File

@@ -152,7 +152,7 @@ wxSize wxButton::DoGetBestSize() const
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont ); OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
verify_noerr( err ); verify_noerr( err );
wxCFStringRef str( m_label, m_font.GetEncoding() ); wxCFStringRef str( m_label, GetFont().GetEncoding() );
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
SInt16 baseline; SInt16 baseline;

View File

@@ -139,7 +139,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
UMAInsertMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ), UMAInsertMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ),
items[i], items[i],
m_font.GetEncoding(), GetFont().GetEncoding(),
idx); idx);
m_datas.Insert( NULL, idx ); m_datas.Insert( NULL, idx );
AssignNewItemClientData(idx, clientData, i, type); AssignNewItemClientData(idx, clientData, i, type);

View File

@@ -422,7 +422,7 @@ wxString wxComboBox::GetValue() const
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
CFStringRef myString; CFStringRef myString;
HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)GetSelection(), &myString ); HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)GetSelection(), &myString );
return wxMacCFStringHolder( myString, m_font.GetEncoding() ).AsString(); return wxMacCFStringHolder( myString, GetFont().GetEncoding() ).AsString();
#else #else
wxString result; wxString result;
@@ -547,7 +547,7 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
HIComboBoxInsertTextItemAtIndex(m_peer->GetControlRef(), HIComboBoxInsertTextItemAtIndex(m_peer->GetControlRef(),
(CFIndex)pos, (CFIndex)pos,
wxMacCFStringHolder(items[i], wxMacCFStringHolder(items[i],
m_font.GetEncoding())); GetFont().GetEncoding()));
AssignNewItemClientData(pos, clientData, i, type); AssignNewItemClientData(pos, clientData, i, type);
} }
@@ -670,7 +670,7 @@ void wxComboBox::SetString(unsigned int n, const wxString& s)
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
verify_noerr ( HIComboBoxInsertTextItemAtIndex( m_peer->GetControlRef(), (CFIndex) n, 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 ) ); verify_noerr ( HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), (CFIndex) n + 1 ) );
#else #else
m_choice->SetString( n , s ); m_choice->SetString( n , s );

View File

@@ -1028,9 +1028,9 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr)
wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer)); wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
#if wxCHECK_VERSION(2,9,0) #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 #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 #endif
@@ -1148,9 +1148,9 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer)); wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
#if wxCHECK_VERSION(2,9,0) #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 #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 #endif

View File

@@ -87,7 +87,7 @@ int wxDirDialog::ShowModal()
options.optionFlags &= ~kNavAllowMultipleFiles; options.optionFlags &= ~kNavAllowMultipleFiles;
if (err == noErr) if (err == noErr)
{ {
wxCFStringRef message(m_message, m_font.GetEncoding()); wxCFStringRef message(m_message, GetFont().GetEncoding());
options.message = message; options.message = message;
err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog); err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog);
if (err == noErr) if (err == noErr)

View File

@@ -301,10 +301,10 @@ int wxFileDialog::ShowModal()
// this was always unset in the old code // this was always unset in the old code
dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation; dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
wxCFStringRef message(m_message, m_font.GetEncoding()); wxCFStringRef message(m_message, GetFont().GetEncoding());
dialogCreateOptions.windowTitle = message; dialogCreateOptions.windowTitle = message;
wxCFStringRef defaultFileName(m_fileName, m_font.GetEncoding()); wxCFStringRef defaultFileName(m_fileName, GetFont().GetEncoding());
dialogCreateOptions.saveFileName = defaultFileName; dialogCreateOptions.saveFileName = defaultFileName;
@@ -324,7 +324,7 @@ int wxFileDialog::ShowModal()
myData.menuitems = dialogCreateOptions.popupExtension ; myData.menuitems = dialogCreateOptions.popupExtension ;
for ( size_t i = 0 ; i < numFilters ; ++i ) 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() ) ) ;
} }
} }

View File

@@ -979,7 +979,7 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item)
{ {
wxFontEncoding enc; wxFontEncoding enc;
if ( m_font.Ok() ) if ( m_font.Ok() )
enc = m_font.GetEncoding(); enc = GetFont().GetEncoding();
else else
enc = wxLocale::GetSystemEncoding(); enc = wxLocale::GetSystemEncoding();
wxCFStringRef cfTitle; wxCFStringRef cfTitle;

View File

@@ -864,7 +864,7 @@ void wxMenuBar::MacInstallMenuBar()
} }
else 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) ; menu->MacBeforeDisplay(false) ;
::InsertMenu(MAC_WXHMENU(_wxMenuAt(m_menus, i)->GetHMenu()), 0); ::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() */ ) ; ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
menu->MacBeforeDisplay( false ) ; 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) if ( pos == m_menus.GetCount() - 1)
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
else else
@@ -1002,7 +1002,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
m_titles.Insert(title, pos); 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 ) if ( IsAttached() && s_macInstalledMenuBar == this )
{ {
@@ -1054,7 +1054,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
m_titles.Add(title); m_titles.Add(title);
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , GetFont().GetEncoding() ) ;
if ( IsAttached() ) if ( IsAttached() )
{ {

View File

@@ -110,13 +110,13 @@ int wxMessageDialog::ShowModal()
CFStringRef alternateButtonTitle = NULL; CFStringRef alternateButtonTitle = NULL;
CFStringRef otherButtonTitle = NULL; CFStringRef otherButtonTitle = NULL;
wxCFStringRef cfTitle( msgtitle, m_font.GetEncoding() ); wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() );
wxCFStringRef cfText( msgtext, m_font.GetEncoding() ); wxCFStringRef cfText( msgtext, GetFont().GetEncoding() );
wxCFStringRef cfNoString( m_no.c_str(), m_font.GetEncoding() ); wxCFStringRef cfNoString( m_no.c_str(), GetFont().GetEncoding() );
wxCFStringRef cfYesString( m_yes.c_str(), m_font.GetEncoding() ); wxCFStringRef cfYesString( m_yes.c_str(), GetFont().GetEncoding() );
wxCFStringRef cfOKString( m_ok.c_str() , m_font.GetEncoding()) ; wxCFStringRef cfOKString( m_ok.c_str() , GetFont().GetEncoding()) ;
wxCFStringRef cfCancelString( m_cancel.c_str(), m_font.GetEncoding() ); wxCFStringRef cfCancelString( m_cancel.c_str(), GetFont().GetEncoding() );
int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
@@ -167,13 +167,13 @@ int wxMessageDialog::ShowModal()
short result; short result;
AlertStdCFStringAlertParamRec param; AlertStdCFStringAlertParamRec param;
wxCFStringRef cfNoString( m_no.c_str(), m_font.GetEncoding() ); wxCFStringRef cfNoString( m_no.c_str(), GetFont().GetEncoding() );
wxCFStringRef cfYesString( m_yes.c_str(), m_font.GetEncoding() ); wxCFStringRef cfYesString( m_yes.c_str(), GetFont().GetEncoding() );
wxCFStringRef cfOKString( m_ok.c_str(), m_font.GetEncoding() ); wxCFStringRef cfOKString( m_ok.c_str(), GetFont().GetEncoding() );
wxCFStringRef cfCancelString( m_cancel.c_str(), m_font.GetEncoding() ); wxCFStringRef cfCancelString( m_cancel.c_str(), GetFont().GetEncoding() );
wxCFStringRef cfTitle( msgtitle, m_font.GetEncoding() ); wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() );
wxCFStringRef cfText( msgtext, m_font.GetEncoding() ); wxCFStringRef cfText( msgtext, GetFont().GetEncoding() );
param.movable = true; param.movable = true;
param.flags = 0; param.flags = 0;

View File

@@ -399,7 +399,7 @@ void wxNotebook::MacSetupTabs()
page = m_pages[ii]; page = m_pages[ii];
info.version = kControlTabInfoVersionOne; info.version = kControlTabInfoVersionOne;
info.iconSuiteID = 0; info.iconSuiteID = 0;
wxCFStringRef cflabel( page->GetLabel(), m_font.GetEncoding() ) ; wxCFStringRef cflabel( page->GetLabel(), GetFont().GetEncoding() ) ;
info.name = cflabel ; info.name = cflabel ;
m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ; m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;

View File

@@ -92,7 +92,7 @@ wxSize wxStaticText::DoGetBestSize() const
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont ); OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
verify_noerr( err ); verify_noerr( err );
wxCFStringRef str( m_label, m_font.GetEncoding() ); wxCFStringRef str( m_label, GetFont().GetEncoding() );
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
SInt16 baseline; SInt16 baseline;
@@ -179,7 +179,7 @@ void wxStaticText::DoSetLabel(const wxString& label)
m_labelOrig = label; m_labelOrig = label;
m_label = RemoveMnemonics(label); m_label = RemoveMnemonics(label);
wxCFStringRef str( m_label, m_font.GetEncoding() ); wxCFStringRef str( m_label, GetFont().GetEncoding() );
OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, str); OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, str);
verify_noerr( err ); verify_noerr( err );
} }

View File

@@ -1526,7 +1526,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
InstallEventHandler( InstallEventHandler(
HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(), HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(),
GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL ); GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL );
HIToolbarItemSetLabel( item, wxCFStringRef(label, m_font.GetEncoding()) ); HIToolbarItemSetLabel( item, wxCFStringRef(label, GetFont().GetEncoding()) );
HIToolbarItemSetImage( item, info2.u.imageRef ); HIToolbarItemSetImage( item, info2.u.imageRef );
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction ); HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
tool->SetToolbarItemRef( item ); tool->SetToolbarItemRef( item );

View File

@@ -1209,7 +1209,7 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow(
SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ;
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; 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*/) ; m_peer = new wxMacControl(this , true /*isRootControl*/) ;
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of // 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) void wxTopLevelWindowMac::SetTitle(const wxString& title)
{ {
wxWindow::SetLabel( 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 wxString wxTopLevelWindowMac::GetTitle() const

View File

@@ -885,9 +885,6 @@ void wxWindowMac::Init()
m_macIsUserPane = true; m_macIsUserPane = true;
m_clipChildren = false ; m_clipChildren = false ;
m_cachedClippedRectValid = false ; m_cachedClippedRectValid = false ;
// we need a valid font for the encodings
wxWindowBase::SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
} }
wxWindowMac::~wxWindowMac() wxWindowMac::~wxWindowMac()