compilation fixes after making wxFontRefData private (added wxFont::GetMacXXX())

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-25 23:10:35 +00:00
parent 978f48c648
commit fcb35beb94
13 changed files with 109 additions and 72 deletions

View File

@@ -95,6 +95,13 @@ public:
// Unofficial API, don't use // Unofficial API, don't use
virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; virtual void SetNoAntiAliasing( bool noAA = TRUE ) ;
virtual bool GetNoAntiAliasing() ; virtual bool GetNoAntiAliasing() ;
// Mac-specific, risks to change, don't use in portable code
short GetMacFontNum() const;
short GetMacFontSize() const;
wxByte GetMacFontStyle() const;
wxUint32 GetMacATSUFontID() const;
protected: protected:
// common part of all ctors // common part of all ctors
void Init(); void Init();

View File

@@ -102,13 +102,12 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
ClipRect( drawRect ); ClipRect( drawRect );
EraseRect( drawRect ); EraseRect( drawRect );
wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ; const wxFont& font = list->GetFont();
if ( font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( font.GetMacFontNum() ) ;
::TextSize( font->m_macFontSize) ; ::TextSize( font.GetMacFontSize()) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( font.GetMacFontStyle() ) ;
} }
ThemeButtonDrawInfo info ; ThemeButtonDrawInfo info ;
@@ -198,10 +197,11 @@ bool wxCheckListBox::Create(wxWindow *parent,
GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth); GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);
GetThemeMetric(kThemeMetricCheckBoxHeight,&h); GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
#endif #endif
wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
const wxFont& font = GetFont();
FontInfo finfo; FontInfo finfo;
FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo); FetchFontInfo(font.GetMacFontNum(),font.GetMacFontSize(),font.GetMacFontStyle(),&finfo);
m_TextBaseLineOffset= finfo.leading+finfo.ascent; m_TextBaseLineOffset= finfo.leading+finfo.ascent;
m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent; m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;

View File

@@ -245,12 +245,11 @@ wxSize wxChoice::DoGetBestSize() const
#endif #endif
{ {
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; if ( m_font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( m_font.GetMacFontNum() ) ;
::TextSize( short(font->m_macFontSize) ) ; ::TextSize( m_font.GetMacFontSize() ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( m_font.GetMacFontStyle() ) ;
} }
else else
{ {

View File

@@ -1371,11 +1371,10 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
wxMacFastPortSetter helper(this) ; wxMacFastPortSetter helper(this) ;
MacInstallFont() ; MacInstallFont() ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( 0 ) if ( 0 )
{ {
m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize); m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
SetAntiAliasedTextEnabled(true, SInt16(m_scaleY * font->m_macFontSize)); SetAntiAliasedTextEnabled(true, SInt16(m_scaleY * m_font.GetMacFontSize()));
m_macAliasWasEnabled = true ; m_macAliasWasEnabled = true ;
} }
OSStatus status = noErr ; OSStatus status = noErr ;
@@ -1735,12 +1734,11 @@ void wxDC::MacInstallFont() const
// return ; // return ;
Pattern blackColor ; Pattern blackColor ;
MacSetupBackgroundForCurrentPort(m_backgroundBrush) ; MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; if ( m_font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( m_font.GetMacFontNum() ) ;
::TextSize( short(m_scaleY * font->m_macFontSize) ) ; ::TextSize( (short)(m_scaleY * m_font.GetMacFontSize()) ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( m_font.GetMacFontStyle() ) ;
m_macFontInstalled = true ; m_macFontInstalled = true ;
m_macBrushInstalled = false ; m_macBrushInstalled = false ;
m_macPenInstalled = false ; m_macPenInstalled = false ;
@@ -1809,9 +1807,9 @@ void wxDC::MacInstallFont() const
} }
::PenMode( mode ) ; ::PenMode( mode ) ;
OSStatus status = noErr ; OSStatus status = noErr ;
Fixed atsuSize = IntToFixed( int(m_scaleY * font->m_macFontSize) ) ; Fixed atsuSize = IntToFixed( int(m_scaleY * m_font.GetMacFontSize()) ) ;
Style qdStyle = font->m_macFontStyle ; Style qdStyle = m_font.GetMacFontStyle() ;
ATSUFontID atsuFont = font->m_macATSUFontID ; ATSUFontID atsuFont = m_font.GetMacATSUFontID() ;
status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUIStyle) ; status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUIStyle) ;
wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") ) ; wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") ) ;
ATSUAttributeTag atsuTags[] = ATSUAttributeTag atsuTags[] =

View File

@@ -370,6 +370,8 @@ void wxFont::SetNoAntiAliasing( bool no )
// accessors // accessors
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// TODO: insert checks everywhere for M_FONTDATA == NULL!
int wxFont::GetPointSize() const int wxFont::GetPointSize() const
{ {
return M_FONTDATA->m_pointSize; return M_FONTDATA->m_pointSize;
@@ -413,6 +415,26 @@ bool wxFont::GetNoAntiAliasing()
return M_FONTDATA->m_noAA; return M_FONTDATA->m_noAA;
} }
short wxFont::GetMacFontNum() const
{
return M_FONTDATA->m_macFontNum;
}
short wxFont::GetMacFontSize() const
{
return M_FONTDATA->m_macFontSize;
}
wxByte wxFont::GetMacFontStyle() const
{
return M_FONTDATA->m_macFontStyle;
}
wxUint32 wxFont::GetMacATSUFontID() const
{
return M_FONTDATA->m_macATSUFontID;
}
const wxNativeFontInfo *wxFont::GetNativeFontInfo() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
{ {
wxCHECK_MSG( Ok(), NULL, wxT("invalid font") ); wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );

View File

@@ -105,13 +105,12 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
ClipRect( drawRect ); ClipRect( drawRect );
EraseRect( drawRect ); EraseRect( drawRect );
wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ; const wxFont& font = list->GetFont();
if ( font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( font.GetMacFontNum() ) ;
::TextSize( short(font->m_macFontSize) ) ; ::TextSize( font.GetMacFontSize() ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( font.GetMacFontStyle() ) ;
} }
else else
{ {
@@ -604,13 +603,11 @@ wxSize wxListBox::DoGetBestSize() const
{ {
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; if ( m_font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( m_font.GetMacFontNum() ) ;
::TextSize( short(font->m_macFontSize) ) ; ::TextSize( m_font.GetMacFontSize() ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( m_font.GetMacFontStyle() ) ;
} }
else else
{ {

View File

@@ -902,4 +902,3 @@ bool wxPNGFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, in
return FALSE; return FALSE;
} }

View File

@@ -102,13 +102,12 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
ClipRect( drawRect ); ClipRect( drawRect );
EraseRect( drawRect ); EraseRect( drawRect );
wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ; const wxFont& font = list->GetFont();
if ( font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( font.GetMacFontNum() ) ;
::TextSize( font->m_macFontSize) ; ::TextSize( font.GetMacFontSize()) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( font.GetMacFontStyle() ) ;
} }
ThemeButtonDrawInfo info ; ThemeButtonDrawInfo info ;
@@ -198,10 +197,11 @@ bool wxCheckListBox::Create(wxWindow *parent,
GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth); GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);
GetThemeMetric(kThemeMetricCheckBoxHeight,&h); GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
#endif #endif
wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
const wxFont& font = GetFont();
FontInfo finfo; FontInfo finfo;
FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo); FetchFontInfo(font.GetMacFontNum(),font.GetMacFontSize(),font.GetMacFontStyle(),&finfo);
m_TextBaseLineOffset= finfo.leading+finfo.ascent; m_TextBaseLineOffset= finfo.leading+finfo.ascent;
m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent; m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;

View File

@@ -245,12 +245,11 @@ wxSize wxChoice::DoGetBestSize() const
#endif #endif
{ {
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; if ( m_font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( m_font.GetMacFontNum() ) ;
::TextSize( short(font->m_macFontSize) ) ; ::TextSize( m_font.GetMacFontSize() ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( m_font.GetMacFontStyle() ) ;
} }
else else
{ {

View File

@@ -1371,11 +1371,10 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
wxMacFastPortSetter helper(this) ; wxMacFastPortSetter helper(this) ;
MacInstallFont() ; MacInstallFont() ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( 0 ) if ( 0 )
{ {
m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize); m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
SetAntiAliasedTextEnabled(true, SInt16(m_scaleY * font->m_macFontSize)); SetAntiAliasedTextEnabled(true, SInt16(m_scaleY * m_font.GetMacFontSize()));
m_macAliasWasEnabled = true ; m_macAliasWasEnabled = true ;
} }
OSStatus status = noErr ; OSStatus status = noErr ;
@@ -1735,12 +1734,11 @@ void wxDC::MacInstallFont() const
// return ; // return ;
Pattern blackColor ; Pattern blackColor ;
MacSetupBackgroundForCurrentPort(m_backgroundBrush) ; MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; if ( m_font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( m_font.GetMacFontNum() ) ;
::TextSize( short(m_scaleY * font->m_macFontSize) ) ; ::TextSize( (short)(m_scaleY * m_font.GetMacFontSize()) ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( m_font.GetMacFontStyle() ) ;
m_macFontInstalled = true ; m_macFontInstalled = true ;
m_macBrushInstalled = false ; m_macBrushInstalled = false ;
m_macPenInstalled = false ; m_macPenInstalled = false ;
@@ -1809,9 +1807,9 @@ void wxDC::MacInstallFont() const
} }
::PenMode( mode ) ; ::PenMode( mode ) ;
OSStatus status = noErr ; OSStatus status = noErr ;
Fixed atsuSize = IntToFixed( int(m_scaleY * font->m_macFontSize) ) ; Fixed atsuSize = IntToFixed( int(m_scaleY * m_font.GetMacFontSize()) ) ;
Style qdStyle = font->m_macFontStyle ; Style qdStyle = m_font.GetMacFontStyle() ;
ATSUFontID atsuFont = font->m_macATSUFontID ; ATSUFontID atsuFont = m_font.GetMacATSUFontID() ;
status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUIStyle) ; status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUIStyle) ;
wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") ) ; wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") ) ;
ATSUAttributeTag atsuTags[] = ATSUAttributeTag atsuTags[] =

View File

@@ -370,6 +370,8 @@ void wxFont::SetNoAntiAliasing( bool no )
// accessors // accessors
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// TODO: insert checks everywhere for M_FONTDATA == NULL!
int wxFont::GetPointSize() const int wxFont::GetPointSize() const
{ {
return M_FONTDATA->m_pointSize; return M_FONTDATA->m_pointSize;
@@ -413,6 +415,26 @@ bool wxFont::GetNoAntiAliasing()
return M_FONTDATA->m_noAA; return M_FONTDATA->m_noAA;
} }
short wxFont::GetMacFontNum() const
{
return M_FONTDATA->m_macFontNum;
}
short wxFont::GetMacFontSize() const
{
return M_FONTDATA->m_macFontSize;
}
wxByte wxFont::GetMacFontStyle() const
{
return M_FONTDATA->m_macFontStyle;
}
wxUint32 wxFont::GetMacATSUFontID() const
{
return M_FONTDATA->m_macATSUFontID;
}
const wxNativeFontInfo *wxFont::GetNativeFontInfo() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
{ {
wxCHECK_MSG( Ok(), NULL, wxT("invalid font") ); wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );

View File

@@ -105,13 +105,12 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
ClipRect( drawRect ); ClipRect( drawRect );
EraseRect( drawRect ); EraseRect( drawRect );
wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ; const wxFont& font = list->GetFont();
if ( font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( font.GetMacFontNum() ) ;
::TextSize( short(font->m_macFontSize) ) ; ::TextSize( font.GetMacFontSize() ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( font.GetMacFontStyle() ) ;
} }
else else
{ {
@@ -604,13 +603,11 @@ wxSize wxListBox::DoGetBestSize() const
{ {
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; if ( m_font.Ok() )
if ( font )
{ {
::TextFont( font->m_macFontNum ) ; ::TextFont( m_font.GetMacFontNum() ) ;
::TextSize( short(font->m_macFontSize) ) ; ::TextSize( m_font.GetMacFontSize() ) ;
::TextFace( font->m_macFontStyle ) ; ::TextFace( m_font.GetMacFontStyle() ) ;
} }
else else
{ {

View File

@@ -902,4 +902,3 @@ bool wxPNGFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, in
return FALSE; return FALSE;
} }