]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dcclient.cpp
don't let the user modify the contents of read-only control (modified patch 1463707)
[wxWidgets.git] / src / gtk / dcclient.cpp
index 90d74d7bc769d4227e830ef0e5a885931e6b43f4..78269d6bbed548d3b7dde331fc207e1442e717a6 100644 (file)
@@ -22,6 +22,7 @@
 #include "wx/fontutil.h"
 
 #include "wx/gtk/win_gtk.h"
+#include "wx/gtk/private.h"
 
 #include "wx/math.h" // for floating-point functions
 
@@ -171,7 +172,7 @@ static void wxCleanUpGCPool()
     for (int i = 0; i < wxGCPoolSize; i++)
     {
         if (wxGCPool[i].m_gc)
-            gdk_gc_unref( wxGCPool[i].m_gc );
+            g_object_unref (G_OBJECT (wxGCPool[i].m_gc));
     }
 
     free(wxGCPool);
@@ -1125,7 +1126,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
             gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
             gdk_gc_set_stipple( gc, mask );
             gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
-            gdk_gc_unref( gc );
+            g_object_unref (G_OBJECT (gc));
         }
 
         if (is_mono)
@@ -1159,7 +1160,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
         gdk_draw_drawable( m_window, m_textGC, bitmap2, 0, 0, xx, yy, -1, -1 );
 
         g_object_unref (G_OBJECT (bitmap2));
-        gdk_gc_unref( gc );
+        g_object_unref (G_OBJECT (gc));
     }
     else
     {
@@ -1368,7 +1369,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
                 gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
                 gdk_gc_set_stipple( gc, mask );
                 gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh );
-                gdk_gc_unref( gc );
+                g_object_unref (G_OBJECT (gc));
             }
 
             if (is_mono)
@@ -1413,7 +1414,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
             gdk_draw_drawable( m_window, m_textGC, bitmap, xsrc, ysrc, cx, cy, cw, ch );
 
             g_object_unref (G_OBJECT (bitmap));
-            gdk_gc_unref( gc );
+            g_object_unref (G_OBJECT (gc));
         }
         else
         {
@@ -1496,16 +1497,11 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
 
     bool underlined = m_font.Ok() && m_font.GetUnderlined();
 
-#if wxUSE_UNICODE
-    const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
-#else
-    const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
-    if ( !wdata )
+    const wxCharBuffer data = wxGTK_CONV( text );
+    if ( !data )
         return;
-    const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
-#endif
-    size_t datalen = strlen((const char*)data);
-    pango_layout_set_text( m_layout, (const char*) data, datalen);
+    const size_t datalen = strlen(data);
+    pango_layout_set_text( m_layout, data, datalen);
 
     if (underlined)
     {
@@ -1709,18 +1705,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
         pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
 
     // Set layout's text
-#if wxUSE_UNICODE
-    const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
-    const char *dataUTF8 = (const char *)data;
-#else
-    const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
-    if ( !wdata )
-        return;
-
-    const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
-    const char *dataUTF8 = (const char *)data;
-#endif
-
+    const wxCharBuffer dataUTF8 = wxGTK_CONV(string);
     if ( !dataUTF8 )
     {
         // hardly ideal, but what else can we do if conversion failed?