]> git.saurik.com Git - wxWidgets.git/commitdiff
compilation fixes after making wxFontRefData private (added wxFont::GetMacXXX())
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Sep 2003 23:10:35 +0000 (23:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 25 Sep 2003 23:10:35 +0000 (23:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
include/wx/mac/font.h
src/mac/carbon/checklst.cpp
src/mac/carbon/choice.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/font.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/pnghand.cpp
src/mac/checklst.cpp
src/mac/choice.cpp
src/mac/dc.cpp
src/mac/font.cpp
src/mac/listbox.cpp
src/mac/pnghand.cpp

index 08551a88bd167e9022f06fd378c749b5ddb9d980..78aa2f4d5f2f44eac7f0f700f60afa261a1da758 100644 (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();
index ee04357b8ff4d84b422cec76dd06e492cce412db..1e88ce34f6cce33300cbf0c4d472812253fd1105 100644 (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;
index c963dcad3271faf238ae96a51b3ea303e50c752a..55a9268e108486daed5eee2e83d1b3005e5b0921 100644 (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
         {
index d830f68a1ead45d355a469a3b03d7ee04d62e775..126dea09aa7a4b1382c23c84f76c152e0c0a583a 100644 (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[] =
index bb1c2b4939f4348b1b2b4e96335f40c3118ba916..f37cdbf9c72aace7b244ca3142d3cbdfd4bbd9b0 100644 (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") );
index b72970b0c2f6d585bb6a30fcce7d1d6ffebfc295..fe39a0a19fcea8baca9128e2129e718f949e055b 100644 (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
         {
index 583cbbab7a5c297247bf64d27aa70abf2e660ff8..f25141d7e9c50e559a4dc236b295b8888414835b 100644 (file)
@@ -902,4 +902,3 @@ bool wxPNGFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, in
     return FALSE;
 }
 
-
index ee04357b8ff4d84b422cec76dd06e492cce412db..1e88ce34f6cce33300cbf0c4d472812253fd1105 100644 (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;
index c963dcad3271faf238ae96a51b3ea303e50c752a..55a9268e108486daed5eee2e83d1b3005e5b0921 100644 (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
         {
index d830f68a1ead45d355a469a3b03d7ee04d62e775..126dea09aa7a4b1382c23c84f76c152e0c0a583a 100644 (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[] =
index bb1c2b4939f4348b1b2b4e96335f40c3118ba916..f37cdbf9c72aace7b244ca3142d3cbdfd4bbd9b0 100644 (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") );
index b72970b0c2f6d585bb6a30fcce7d1d6ffebfc295..fe39a0a19fcea8baca9128e2129e718f949e055b 100644 (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
         {
index 583cbbab7a5c297247bf64d27aa70abf2e660ff8..f25141d7e9c50e559a4dc236b295b8888414835b 100644 (file)
@@ -902,4 +902,3 @@ bool wxPNGFileHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, in
     return FALSE;
 }
 
-