]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/font.cpp
Fixed coding of a switch statement that had RETURN statements before the BREAK statem...
[wxWidgets.git] / src / gtk / font.cpp
index a4e761d20cabac877ff64b24a237bdc293f28231..74864d18822b5334d479230c011e47b3c6723592 100644 (file)
@@ -152,13 +152,29 @@ wxFontRefData::~wxFontRefData()
 
 bool wxNativeFontInfo::FromString(const wxString& s)
 {
 
 bool wxNativeFontInfo::FromString(const wxString& s)
 {
-    xFontName = s;
+    wxStringTokenizer tokenizer(s, _T(";"));
+
+    wxString token = tokenizer.GetNextToken();
+    //
+    //  Ignore the version for now
+    //
+
+    xFontName = tokenizer.GetNextToken();
+    if(!xFontName)
+        return FALSE;
+
     return TRUE;
 }
 
 wxString wxNativeFontInfo::ToString() const
 {
     return TRUE;
 }
 
 wxString wxNativeFontInfo::ToString() const
 {
-    return xFontName;
+    wxString s;
+
+    s.Printf(_T("%d;%s"),
+             0,                         // version
+             xFontName.c_str());
+
+    return s;
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -169,15 +185,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
 
 void wxFont::Init()
 {
 
 void wxFont::Init()
 {
-    if (wxTheFontList)
-        wxTheFontList->Append( this );
 }
 
 wxFont::wxFont(const wxNativeFontInfo& info)
 {
     Init();
 
 }
 
 wxFont::wxFont(const wxNativeFontInfo& info)
 {
     Init();
 
-    Create(info.ToString());
+    Create(info.xFontName);
 }
 
 bool wxFont::Create(const wxNativeFontInfo& info)
 }
 
 bool wxFont::Create(const wxNativeFontInfo& info)
@@ -318,8 +332,6 @@ void wxFont::Unshare()
 
 wxFont::~wxFont()
 {
 
 wxFont::~wxFont()
 {
-    if (wxTheFontList)
-        wxTheFontList->DeleteObject( this );
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -477,6 +489,12 @@ GdkFont *GtkGetDefaultGuiFont()
         }
         gtk_widget_destroy( widget );
     }
         }
         gtk_widget_destroy( widget );
     }
+    else
+    {
+        // already have it, but ref it once more before returning
+        gdk_font_ref(g_systemDefaultGuiFont);
+    }
+
     return g_systemDefaultGuiFont;
 }
 
     return g_systemDefaultGuiFont;
 }