]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/utilsgtk.cpp
fixed bug with not taking background colour into account introduced in 1.24
[wxWidgets.git] / src / gtk / utilsgtk.cpp
index 4b321c358f415a75abe6bb9ead4b72eba3a3c4e4..cb2455bbcd8abe3cc4649d37f17606e843af3348 100644 (file)
@@ -180,6 +180,34 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
     return wxGenericFindWindowAtPoint(pt);
 }
 
+#if !wxUSE_UNICODE
+
+wxCharBuffer wxConvertToGTK(const wxString& s, wxFontEncoding enc)
+{
+    if ( enc == wxFONTENCODING_UTF8 )
+    {
+        // no need for conversion at all
+        return wxCharBuffer(s);
+    }
+
+    wxWCharBuffer wbuf;
+    if ( enc == wxFONTENCODING_SYSTEM || enc == wxFONTENCODING_DEFAULT )
+    {
+        wbuf = wxConvUI->cMB2WC(s);
+    }
+    else // another encoding, use generic conversion class
+    {
+        wbuf = wxCSConv(enc).cMB2WC(s);
+    }
+
+    wxCharBuffer buf;
+    if ( wbuf )
+        buf = wxConvUTF8.cWC2MB(wbuf);
+
+    return buf;
+}
+
+#endif // !wxUSE_UNICODE
 
 // ----------------------------------------------------------------------------
 // subprocess routines