]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fontutil.cpp
Initialize m_isShown correctly in wxGenericDragImage::BeginDrag().
[wxWidgets.git] / src / unix / fontutil.cpp
index aa47c514c46946913e98af2a129fe931545ea489..4cb8399cedf5627618a381ac3aad1835c0c8331b 100644 (file)
@@ -53,8 +53,8 @@
     #include "wx/x11/private.h"
     #include "wx/gtk/private/string.h"
 
     #include "wx/x11/private.h"
     #include "wx/gtk/private/string.h"
 
-    #define wxPANGO_CONV(s) (wxConvUTF8.cWX2MB((s)))
-    #define wxPANGO_CONV_BACK(s) (wxConvUTF8.cMB2WX((s)))
+    #define wxPANGO_CONV(s) s.utf8_str()
+    #define wxPANGO_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
 #endif
 
 // ----------------------------------------------------------------------------
 #endif
 
 // ----------------------------------------------------------------------------
@@ -133,6 +133,11 @@ bool wxNativeFontInfo::GetUnderlined() const
     return false;
 }
 
     return false;
 }
 
+bool wxNativeFontInfo::GetStrikethrough() const
+{
+    return false;
+}
+
 wxString wxNativeFontInfo::GetFaceName() const
 {
     // the Pango "family" is the wx "face name"
 wxString wxNativeFontInfo::GetFaceName() const
 {
     // the Pango "family" is the wx "face name"
@@ -154,15 +159,12 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
 
     // Check for some common fonts, to salvage what we can from the current
     // win32 centric wxFont API:
 
     // Check for some common fonts, to salvage what we can from the current
     // win32 centric wxFont API:
-    if (strncasecmp( family_text, "monospace", 9 ) == 0)
+    if (wxStrnicmp( family_text, "monospace", 9 ) == 0)
         ret = wxFONTFAMILY_TELETYPE;    // begins with "Monospace"
         ret = wxFONTFAMILY_TELETYPE;    // begins with "Monospace"
-    else if (strncasecmp( family_text, "courier", 7 ) == 0)
+    else if (wxStrnicmp( family_text, "courier", 7 ) == 0)
         ret = wxFONTFAMILY_TELETYPE;    // begins with "Courier"
 #if defined(__WXGTK20__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
     else
         ret = wxFONTFAMILY_TELETYPE;    // begins with "Courier"
 #if defined(__WXGTK20__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
     else
-#ifdef __WXGTK20__
-    if (!gtk_check_version(2,4,0))
-#endif
     {
         PangoFontFamily **families;
         PangoFontFamily  *family = NULL;
     {
         PangoFontFamily **families;
         PangoFontFamily  *family = NULL;
@@ -204,9 +206,9 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
             ret = wxFONTFAMILY_SWISS;       // contains "Sans"
         else if (strstr( family_text, "serif" ) != NULL || strstr( family_text, "Serif" ) != NULL)
             ret = wxFONTFAMILY_ROMAN;       // contains "Serif"
             ret = wxFONTFAMILY_SWISS;       // contains "Sans"
         else if (strstr( family_text, "serif" ) != NULL || strstr( family_text, "Serif" ) != NULL)
             ret = wxFONTFAMILY_ROMAN;       // contains "Serif"
-        else if (strncasecmp( family_text, "times", 5 ) == 0)
+        else if (wxStrnicmp( family_text, "times", 5 ) == 0)
             ret = wxFONTFAMILY_ROMAN;       // begins with "Times"
             ret = wxFONTFAMILY_ROMAN;       // begins with "Times"
-        else if (strncasecmp( family_text, "old", 3 ) == 0)
+        else if (wxStrnicmp( family_text, "old", 3 ) == 0)
             ret = wxFONTFAMILY_DECORATIVE;  // begins with "Old" - "Old English", "Old Town"
     }
 
             ret = wxFONTFAMILY_DECORATIVE;  // begins with "Old" - "Old English", "Old Town"
     }
 
@@ -267,6 +269,11 @@ void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
     wxFAIL_MSG( "not implemented" );
 }
 
     wxFAIL_MSG( "not implemented" );
 }
 
+void wxNativeFontInfo::SetStrikethrough(bool WXUNUSED(strikethrough))
+{
+    wxFAIL_MSG( "not implemented" );
+}
+
 bool wxNativeFontInfo::SetFaceName(const wxString& facename)
 {
     pango_font_description_set_family(description, wxPANGO_CONV(facename));
 bool wxNativeFontInfo::SetFaceName(const wxString& facename)
 {
     pango_font_description_set_family(description, wxPANGO_CONV(facename));
@@ -581,8 +588,7 @@ wxString wxNativeFontInfo::GetXFontComponent(wxXLFDField field) const
 
     if ( !HasElements() )
     {
 
     if ( !HasElements() )
     {
-        // const_cast
-        if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) )
+        if ( !const_cast<wxNativeFontInfo *>(this)->FromXFontName(xFontName) )
             return wxEmptyString;
     }
 
             return wxEmptyString;
     }
 
@@ -639,8 +645,7 @@ wxString wxNativeFontInfo::GetXFontName() const
                 elt = wxT('*');
             }
 
                 elt = wxT('*');
             }
 
-            // const_cast
-            ((wxNativeFontInfo *)this)->xFontName << wxT('-') << elt;
+            const_cast<wxNativeFontInfo *>(this)->xFontName << wxT('-') << elt;
         }
     }
 
         }
     }
 
@@ -658,8 +663,7 @@ wxNativeFontInfo::SetXFontComponent(wxXLFDField field, const wxString& value)
 
     if ( !HasElements() )
     {
 
     if ( !HasElements() )
     {
-        // const_cast
-        if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) )
+        if ( !const_cast<wxNativeFontInfo *>(this)->FromXFontName(xFontName) )
         {
             wxFAIL_MSG( wxT("can't set font element for invalid XLFD") );
 
         {
             wxFAIL_MSG( wxT("can't set font element for invalid XLFD") );
 
@@ -818,6 +822,11 @@ void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
     // can't do this under X
 }
 
     // can't do this under X
 }
 
+void wxNativeFontInfo::SetStrikethrough(bool WXUNUSED(strikethrough))
+{
+    // this is not supported by Pango fonts neither
+}
+
 bool wxNativeFontInfo::SetFaceName(const wxString& facename)
 {
     SetXFontComponent(wxXLFD_FAMILY, facename);
 bool wxNativeFontInfo::SetFaceName(const wxString& facename)
 {
     SetXFontComponent(wxXLFD_FAMILY, facename);
@@ -1465,9 +1474,7 @@ bool wxFontModule::OnInit()
 
 void wxFontModule::OnExit()
 {
 
 void wxFontModule::OnExit()
 {
-    delete g_fontHash;
-
-    g_fontHash = NULL;
+    wxDELETE(g_fontHash);
 }
 
 #endif // GTK 2.0/1.x
 }
 
 #endif // GTK 2.0/1.x