using GetFont calls instead of direct accessors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@57849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -157,7 +157,7 @@ wxSize wxButton::DoGetBestSize() const
|
||||
verify_noerr( err );
|
||||
|
||||
SInt16 baseline;
|
||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder str( m_label, GetFont().GetEncoding() );
|
||||
|
||||
#ifndef __LP64__
|
||||
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||
|
@@ -132,7 +132,7 @@ int wxChoice::DoAppend( const wxString& item )
|
||||
#endif
|
||||
|
||||
m_datas.Insert( NULL , index );
|
||||
UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, m_font.GetEncoding(), index );
|
||||
UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, GetFont().GetEncoding(), index );
|
||||
DoSetItemClientData( index, NULL );
|
||||
m_peer->SetMaximum( GetCount() );
|
||||
|
||||
@@ -147,7 +147,7 @@ int wxChoice::DoInsert( const wxString& item, unsigned int pos )
|
||||
if (pos == GetCount())
|
||||
return DoAppend( item );
|
||||
|
||||
UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, m_font.GetEncoding(), pos );
|
||||
UMAInsertMenuItem( MAC_WXHMENU( m_macPopUpMenuHandle ), item, GetFont().GetEncoding(), pos );
|
||||
m_strings.Insert( item, pos );
|
||||
m_datas.Insert( NULL, pos );
|
||||
DoSetItemClientData( pos, NULL );
|
||||
@@ -338,7 +338,7 @@ wxSize wxChoice::DoGetBestSize() const
|
||||
Point bounds = { 0, 0 } ;
|
||||
SInt16 baseline ;
|
||||
|
||||
::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) ,
|
||||
::GetThemeTextDimensions( wxMacCFStringHolder( str , GetFont().GetEncoding() ) ,
|
||||
kThemeCurrentPortFont,
|
||||
kThemeStateActive,
|
||||
false,
|
||||
|
@@ -87,7 +87,7 @@ int wxDirDialog::ShowModal()
|
||||
options.optionFlags &= ~kNavAllowMultipleFiles;
|
||||
if (err == noErr)
|
||||
{
|
||||
wxMacCFStringHolder message(m_message, m_font.GetEncoding());
|
||||
wxMacCFStringHolder message(m_message, GetFont().GetEncoding());
|
||||
options.message = message;
|
||||
err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog);
|
||||
if (err == noErr)
|
||||
|
@@ -287,10 +287,10 @@ int wxFileDialog::ShowModal()
|
||||
// this was always unset in the old code
|
||||
dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
|
||||
|
||||
wxMacCFStringHolder message(m_message, m_font.GetEncoding());
|
||||
wxMacCFStringHolder message(m_message, GetFont().GetEncoding());
|
||||
dialogCreateOptions.windowTitle = message;
|
||||
|
||||
wxMacCFStringHolder defaultFileName(m_fileName, m_font.GetEncoding());
|
||||
wxMacCFStringHolder defaultFileName(m_fileName, GetFont().GetEncoding());
|
||||
dialogCreateOptions.saveFileName = defaultFileName;
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ int wxFileDialog::ShowModal()
|
||||
myData.menuitems = dialogCreateOptions.popupExtension ;
|
||||
for ( size_t i = 0 ; i < numFilters ; ++i )
|
||||
{
|
||||
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] , m_font.GetEncoding() ) ) ;
|
||||
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] , GetFont().GetEncoding() ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -279,7 +279,7 @@ wxSize wxListBox::DoGetBestSize() const
|
||||
|
||||
// NB: what if m_font.Ok() == false ???
|
||||
::GetThemeTextDimensions(
|
||||
wxMacCFStringHolder( str, m_font.GetEncoding() ),
|
||||
wxMacCFStringHolder( str, GetFont().GetEncoding() ),
|
||||
kThemeCurrentPortFont,
|
||||
kThemeStateActive,
|
||||
false,
|
||||
|
@@ -59,13 +59,13 @@ int wxMessageDialog::ShowModal()
|
||||
CFStringRef alternateButtonTitle = NULL;
|
||||
CFStringRef otherButtonTitle = NULL;
|
||||
|
||||
wxMacCFStringHolder cfTitle( m_caption, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfText( m_message, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfTitle( m_caption, GetFont().GetEncoding() );
|
||||
wxMacCFStringHolder cfText( m_message, GetFont().GetEncoding() );
|
||||
|
||||
wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfOKString( _("OK") , m_font.GetEncoding()) ;
|
||||
wxMacCFStringHolder cfCancelString( _("Cancel"), m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfNoString( _("No"), GetFont().GetEncoding() );
|
||||
wxMacCFStringHolder cfYesString( _("Yes"), GetFont().GetEncoding() );
|
||||
wxMacCFStringHolder cfOKString( _("OK") , GetFont().GetEncoding()) ;
|
||||
wxMacCFStringHolder cfCancelString( _("Cancel"), GetFont().GetEncoding() );
|
||||
|
||||
int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
|
||||
|
||||
@@ -117,11 +117,11 @@ int wxMessageDialog::ShowModal()
|
||||
short result;
|
||||
|
||||
AlertStdCFStringAlertParamRec param;
|
||||
wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfNoString( _("No"), GetFont().GetEncoding() );
|
||||
wxMacCFStringHolder cfYesString( _("Yes"), GetFont().GetEncoding() );
|
||||
|
||||
wxMacCFStringHolder cfTitle( m_caption, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfText( m_message, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder cfTitle( m_caption, GetFont().GetEncoding() );
|
||||
wxMacCFStringHolder cfText( m_message, GetFont().GetEncoding() );
|
||||
|
||||
param.movable = true;
|
||||
param.flags = 0;
|
||||
|
@@ -404,7 +404,7 @@ void wxNotebook::MacSetupTabs()
|
||||
page = m_pages[ii];
|
||||
info.version = kControlTabInfoVersionOne;
|
||||
info.iconSuiteID = 0;
|
||||
wxMacCFStringHolder cflabel( page->GetLabel(), m_font.GetEncoding() ) ;
|
||||
wxMacCFStringHolder cflabel( page->GetLabel(), GetFont().GetEncoding() ) ;
|
||||
info.name = cflabel ;
|
||||
m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;
|
||||
|
||||
|
@@ -49,7 +49,7 @@ bool wxStaticText::Create( wxWindow *parent,
|
||||
return false;
|
||||
|
||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder str( m_label, GetFont().GetEncoding() );
|
||||
|
||||
m_peer = new wxMacControl( this );
|
||||
OSStatus err = CreateStaticTextControl(
|
||||
@@ -94,7 +94,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
||||
verify_noerr( err );
|
||||
|
||||
SInt16 baseline;
|
||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
||||
wxMacCFStringHolder str( m_label, GetFont().GetEncoding() );
|
||||
|
||||
#ifndef __LP64__
|
||||
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||
@@ -139,7 +139,7 @@ void wxStaticText::SetLabel( const wxString& st )
|
||||
{
|
||||
m_label = st;
|
||||
|
||||
wxMacCFStringHolder str( GetLabelText(m_label), m_font.GetEncoding() );
|
||||
wxMacCFStringHolder str( GetLabelText(m_label), GetFont().GetEncoding() );
|
||||
CFStringRef ref = str;
|
||||
OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, ref );
|
||||
verify_noerr( err );
|
||||
|
@@ -1561,7 +1561,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
||||
InstallEventHandler(
|
||||
HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(),
|
||||
GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL );
|
||||
HIToolbarItemSetLabel( item, wxMacCFStringHolder(tool->GetLabel(), m_font.GetEncoding()) );
|
||||
HIToolbarItemSetLabel( item, wxMacCFStringHolder(tool->GetLabel(), GetFont().GetEncoding()) );
|
||||
HIToolbarItemSetImage( item, info2.u.imageRef );
|
||||
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
|
||||
tool->SetToolbarItemRef( item );
|
||||
|
@@ -1036,9 +1036,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()
|
||||
@@ -1286,6 +1283,18 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
||||
SetFont( font ) ;
|
||||
}
|
||||
|
||||
wxVisualAttributes wxWindowMac::GetDefaultAttributes() const
|
||||
{
|
||||
if ( !m_peer )
|
||||
return wxWindowBase::GetDefaultAttributes();
|
||||
wxVisualAttributes attrs;
|
||||
attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||
attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); //white
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
||||
void wxWindowMac::MacUpdateControlFont()
|
||||
{
|
||||
if ( m_peer )
|
||||
@@ -2408,8 +2417,12 @@ void wxWindowMac::GetTextExtent(const wxString& string, int *x, int *y,
|
||||
int *descent, int *externalLeading, const wxFont *theFont ) const
|
||||
{
|
||||
const wxFont *fontToUse = theFont;
|
||||
wxFont tempFont;
|
||||
if ( !fontToUse )
|
||||
fontToUse = &m_font;
|
||||
{
|
||||
tempFont = GetFont();
|
||||
fontToUse = &tempFont;
|
||||
}
|
||||
|
||||
wxClientDC dc( (wxWindow*)this ) ;
|
||||
long lx,ly,ld,le ;
|
||||
|
Reference in New Issue
Block a user