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 );
|
verify_noerr( err );
|
||||||
|
|
||||||
SInt16 baseline;
|
SInt16 baseline;
|
||||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
wxMacCFStringHolder str( m_label, GetFont().GetEncoding() );
|
||||||
|
|
||||||
#ifndef __LP64__
|
#ifndef __LP64__
|
||||||
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||||
|
@@ -132,7 +132,7 @@ int wxChoice::DoAppend( const wxString& item )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_datas.Insert( NULL , index );
|
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 );
|
DoSetItemClientData( index, NULL );
|
||||||
m_peer->SetMaximum( GetCount() );
|
m_peer->SetMaximum( GetCount() );
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ int wxChoice::DoInsert( const wxString& item, unsigned int pos )
|
|||||||
if (pos == GetCount())
|
if (pos == GetCount())
|
||||||
return DoAppend( item );
|
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_strings.Insert( item, pos );
|
||||||
m_datas.Insert( NULL, pos );
|
m_datas.Insert( NULL, pos );
|
||||||
DoSetItemClientData( pos, NULL );
|
DoSetItemClientData( pos, NULL );
|
||||||
@@ -338,7 +338,7 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
Point bounds = { 0, 0 } ;
|
Point bounds = { 0, 0 } ;
|
||||||
SInt16 baseline ;
|
SInt16 baseline ;
|
||||||
|
|
||||||
::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) ,
|
::GetThemeTextDimensions( wxMacCFStringHolder( str , GetFont().GetEncoding() ) ,
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
false,
|
false,
|
||||||
|
@@ -87,7 +87,7 @@ int wxDirDialog::ShowModal()
|
|||||||
options.optionFlags &= ~kNavAllowMultipleFiles;
|
options.optionFlags &= ~kNavAllowMultipleFiles;
|
||||||
if (err == noErr)
|
if (err == noErr)
|
||||||
{
|
{
|
||||||
wxMacCFStringHolder message(m_message, m_font.GetEncoding());
|
wxMacCFStringHolder 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)
|
||||||
|
@@ -287,10 +287,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;
|
||||||
|
|
||||||
wxMacCFStringHolder message(m_message, m_font.GetEncoding());
|
wxMacCFStringHolder message(m_message, GetFont().GetEncoding());
|
||||||
dialogCreateOptions.windowTitle = message;
|
dialogCreateOptions.windowTitle = message;
|
||||||
|
|
||||||
wxMacCFStringHolder defaultFileName(m_fileName, m_font.GetEncoding());
|
wxMacCFStringHolder defaultFileName(m_fileName, GetFont().GetEncoding());
|
||||||
dialogCreateOptions.saveFileName = defaultFileName;
|
dialogCreateOptions.saveFileName = defaultFileName;
|
||||||
|
|
||||||
|
|
||||||
@@ -310,7 +310,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) 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 ???
|
// NB: what if m_font.Ok() == false ???
|
||||||
::GetThemeTextDimensions(
|
::GetThemeTextDimensions(
|
||||||
wxMacCFStringHolder( str, m_font.GetEncoding() ),
|
wxMacCFStringHolder( str, GetFont().GetEncoding() ),
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
false,
|
false,
|
||||||
|
@@ -59,13 +59,13 @@ int wxMessageDialog::ShowModal()
|
|||||||
CFStringRef alternateButtonTitle = NULL;
|
CFStringRef alternateButtonTitle = NULL;
|
||||||
CFStringRef otherButtonTitle = NULL;
|
CFStringRef otherButtonTitle = NULL;
|
||||||
|
|
||||||
wxMacCFStringHolder cfTitle( m_caption, m_font.GetEncoding() );
|
wxMacCFStringHolder cfTitle( m_caption, GetFont().GetEncoding() );
|
||||||
wxMacCFStringHolder cfText( m_message, m_font.GetEncoding() );
|
wxMacCFStringHolder cfText( m_message, GetFont().GetEncoding() );
|
||||||
|
|
||||||
wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfNoString( _("No"), GetFont().GetEncoding() );
|
||||||
wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfYesString( _("Yes"), GetFont().GetEncoding() );
|
||||||
wxMacCFStringHolder cfOKString( _("OK") , m_font.GetEncoding()) ;
|
wxMacCFStringHolder cfOKString( _("OK") , GetFont().GetEncoding()) ;
|
||||||
wxMacCFStringHolder cfCancelString( _("Cancel"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfCancelString( _("Cancel"), GetFont().GetEncoding() );
|
||||||
|
|
||||||
int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
|
int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
|
||||||
|
|
||||||
@@ -117,11 +117,11 @@ int wxMessageDialog::ShowModal()
|
|||||||
short result;
|
short result;
|
||||||
|
|
||||||
AlertStdCFStringAlertParamRec param;
|
AlertStdCFStringAlertParamRec param;
|
||||||
wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfNoString( _("No"), GetFont().GetEncoding() );
|
||||||
wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfYesString( _("Yes"), GetFont().GetEncoding() );
|
||||||
|
|
||||||
wxMacCFStringHolder cfTitle( m_caption, m_font.GetEncoding() );
|
wxMacCFStringHolder cfTitle( m_caption, GetFont().GetEncoding() );
|
||||||
wxMacCFStringHolder cfText( m_message, m_font.GetEncoding() );
|
wxMacCFStringHolder cfText( m_message, GetFont().GetEncoding() );
|
||||||
|
|
||||||
param.movable = true;
|
param.movable = true;
|
||||||
param.flags = 0;
|
param.flags = 0;
|
||||||
|
@@ -404,7 +404,7 @@ void wxNotebook::MacSetupTabs()
|
|||||||
page = m_pages[ii];
|
page = m_pages[ii];
|
||||||
info.version = kControlTabInfoVersionOne;
|
info.version = kControlTabInfoVersionOne;
|
||||||
info.iconSuiteID = 0;
|
info.iconSuiteID = 0;
|
||||||
wxMacCFStringHolder cflabel( page->GetLabel(), m_font.GetEncoding() ) ;
|
wxMacCFStringHolder 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 ) ;
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ bool wxStaticText::Create( wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
||||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
wxMacCFStringHolder str( m_label, GetFont().GetEncoding() );
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
m_peer = new wxMacControl( this );
|
||||||
OSStatus err = CreateStaticTextControl(
|
OSStatus err = CreateStaticTextControl(
|
||||||
@@ -94,7 +94,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
SInt16 baseline;
|
SInt16 baseline;
|
||||||
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
|
wxMacCFStringHolder str( m_label, GetFont().GetEncoding() );
|
||||||
|
|
||||||
#ifndef __LP64__
|
#ifndef __LP64__
|
||||||
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
|
||||||
@@ -139,7 +139,7 @@ void wxStaticText::SetLabel( const wxString& st )
|
|||||||
{
|
{
|
||||||
m_label = st;
|
m_label = st;
|
||||||
|
|
||||||
wxMacCFStringHolder str( GetLabelText(m_label), m_font.GetEncoding() );
|
wxMacCFStringHolder str( GetLabelText(m_label), GetFont().GetEncoding() );
|
||||||
CFStringRef ref = str;
|
CFStringRef ref = str;
|
||||||
OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, ref );
|
OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, ref );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
@@ -1561,7 +1561,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, wxMacCFStringHolder(tool->GetLabel(), m_font.GetEncoding()) );
|
HIToolbarItemSetLabel( item, wxMacCFStringHolder(tool->GetLabel(), GetFont().GetEncoding()) );
|
||||||
HIToolbarItemSetImage( item, info2.u.imageRef );
|
HIToolbarItemSetImage( item, info2.u.imageRef );
|
||||||
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
|
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
|
||||||
tool->SetToolbarItemRef( item );
|
tool->SetToolbarItemRef( item );
|
||||||
|
@@ -1036,9 +1036,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()
|
||||||
@@ -1286,6 +1283,18 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
|||||||
SetFont( font ) ;
|
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()
|
void wxWindowMac::MacUpdateControlFont()
|
||||||
{
|
{
|
||||||
if ( m_peer )
|
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
|
int *descent, int *externalLeading, const wxFont *theFont ) const
|
||||||
{
|
{
|
||||||
const wxFont *fontToUse = theFont;
|
const wxFont *fontToUse = theFont;
|
||||||
|
wxFont tempFont;
|
||||||
if ( !fontToUse )
|
if ( !fontToUse )
|
||||||
fontToUse = &m_font;
|
{
|
||||||
|
tempFont = GetFont();
|
||||||
|
fontToUse = &tempFont;
|
||||||
|
}
|
||||||
|
|
||||||
wxClientDC dc( (wxWindow*)this ) ;
|
wxClientDC dc( (wxWindow*)this ) ;
|
||||||
long lx,ly,ld,le ;
|
long lx,ly,ld,le ;
|
||||||
|
Reference in New Issue
Block a user