]> git.saurik.com Git - wxWidgets.git/commitdiff
use AllocExclusive
authorPaul Cornett <paulcor@bullseye.com>
Mon, 5 Mar 2007 06:41:04 +0000 (06:41 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Mon, 5 Mar 2007 06:41:04 +0000 (06:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/font.h
src/mac/carbon/font.cpp

index d7a69df50ea057d42e2036758cf989d1e49ec3ff..5df413ba3caa85b95ac12ddabaa06ebb47cea884 100644 (file)
@@ -99,9 +99,9 @@ public:
     void* MacGetATSUStyle() const ; 
     
 protected:
-    void Unshare();
+    virtual wxObjectRefData* CreateRefData() const;
+    virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
 
-private:
     DECLARE_DYNAMIC_CLASS(wxFont)
 };
 
index 3c63ecb23b8959a6df7a7339c1311b0b5208cf43..bd90c3bdf1ea5a0db12059eb8e0889bb326785de 100644 (file)
@@ -266,7 +266,7 @@ void wxFontRefData::MacFindFont()
                 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
                 if ( m_macFontFamily == kInvalidFontFamily )
                 {
-                    wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName );
+                    wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName.c_str() );
                     m_macFontFamily = GetAppFont();
                 }
 #endif
@@ -444,31 +444,26 @@ bool wxFont::RealizeResource()
 
 void wxFont::SetEncoding(wxFontEncoding encoding)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_encoding = encoding;
 
     RealizeResource();
 }
 
-void wxFont::Unshare()
+wxObjectRefData* wxFont::CreateRefData() const
 {
-    // Don't change shared data
-    if (!m_refData)
-    {
-        m_refData = new wxFontRefData();
-    }
-    else
-    {
-        wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
-        UnRef();
-        m_refData = ref;
-    }
+    return new wxFontRefData;
+}
+
+wxObjectRefData* wxFont::CloneRefData(const wxObjectRefData* data) const
+{
+    return new wxFontRefData(*wx_static_cast(const wxFontRefData*, data));
 }
 
 void wxFont::SetPointSize(int pointSize)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_pointSize = pointSize;
 
@@ -477,7 +472,7 @@ void wxFont::SetPointSize(int pointSize)
 
 void wxFont::SetFamily(int family)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_family = family;
 
@@ -486,7 +481,7 @@ void wxFont::SetFamily(int family)
 
 void wxFont::SetStyle(int style)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_style = style;
 
@@ -495,7 +490,7 @@ void wxFont::SetStyle(int style)
 
 void wxFont::SetWeight(int weight)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_weight = weight;
 
@@ -504,7 +499,7 @@ void wxFont::SetWeight(int weight)
 
 bool wxFont::SetFaceName(const wxString& faceName)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_faceName = faceName;
 
@@ -515,7 +510,7 @@ bool wxFont::SetFaceName(const wxString& faceName)
 
 void wxFont::SetUnderlined(bool underlined)
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->m_underlined = underlined;
 
@@ -524,7 +519,7 @@ void wxFont::SetUnderlined(bool underlined)
 
 void wxFont::SetNoAntiAliasing( bool no )
 {
-    Unshare();
+    AllocExclusive();
 
     M_FONTDATA->SetNoAntiAliasing( no );