]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dcclient.cpp
added stabs for missing wxNativeFontInfo methods when using Pango
[wxWidgets.git] / src / gtk1 / dcclient.cpp
index a0edbd5c1a6be5e41cd8804c64e0787bfb6a7a66..92ae53ff9d9b6af8ce7754fb08d46ec8733c45aa 100644 (file)
@@ -7,10 +7,13 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "dcclient.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #ifdef __VMS
 #define XCopyPlane XCOPYPLANE
 #endif
@@ -1451,6 +1454,8 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
 #endif
     pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
 
+    int w,h;
+    
     if (m_scaleY != 1.0)
     {
          // If there is a user or actually any scale applied to
@@ -1464,6 +1469,14 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
          
          // actually apply scaled font
          pango_layout_set_font_description( m_layout, m_fontdesc );
+        
+         pango_layout_get_pixel_size( m_layout, &w, &h );
+         if ( m_backgroundMode == wxSOLID )
+         {
+            gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
+            gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
+            gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
+         }
          
          // Draw layout.
          gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
@@ -1476,19 +1489,17 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
     }
     else
     {
-         // Draw layout.
-         gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
+        pango_layout_get_pixel_size( m_layout, &w, &h );
+        if ( m_backgroundMode == wxSOLID )
+        {
+            gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
+            gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
+            gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
+        }
+        // Draw layout.
+        gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
     }
     
-#if 0
-    // Measure layout
-    int w,h;
-    pango_layout_get_pixel_size( m_layout, &w, &h );
-#else
-    int w = 10;
-    int h = 10;
-#endif
-
     wxCoord width = w;
     wxCoord height = h;
     
@@ -1827,6 +1838,12 @@ void wxWindowDC::SetPen( const wxPen &pen )
                    ( fabs((double) XLOG2DEVREL(width)) +
                      fabs((double) YLOG2DEVREL(width)) ) / 2.0;
         width = (int)w;
+        if ( !width )
+        {
+            // width can't be 0 or an internal GTK error occurs inside
+            // gdk_gc_set_dashes() below
+            width = 1;
+        }
     }
 
     static const wxGTKDash dotted[] = {1, 1};