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
virtual void SetNoAntiAliasing( bool noAA = TRUE ) ;
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:
// common part of all ctors
void Init();

View File

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

View File

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

View File

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

View File

@@ -370,6 +370,8 @@ void wxFont::SetNoAntiAliasing( bool no )
// accessors
// ----------------------------------------------------------------------------
// TODO: insert checks everywhere for M_FONTDATA == NULL!
int wxFont::GetPointSize() const
{
return M_FONTDATA->m_pointSize;
@@ -413,6 +415,26 @@ bool wxFont::GetNoAntiAliasing()
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
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -370,6 +370,8 @@ void wxFont::SetNoAntiAliasing( bool no )
// accessors
// ----------------------------------------------------------------------------
// TODO: insert checks everywhere for M_FONTDATA == NULL!
int wxFont::GetPointSize() const
{
return M_FONTDATA->m_pointSize;
@@ -413,6 +415,26 @@ bool wxFont::GetNoAntiAliasing()
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
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );

View File

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

View File

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