]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dcclient.cpp
Ensure that Enter key presses are never stolen from wxButton in wxMSW.
[wxWidgets.git] / src / gtk / dcclient.cpp
index a27b61ae1fbd653b7b1b247bfe876210b1b67810..f9a123a20f2caaf4810ddc73b483e409b7839b0a 100644 (file)
@@ -71,27 +71,42 @@ static GdkPixmap* GetHatch(int style)
     const int i = style - wxBRUSHSTYLE_FIRST_HATCH;
     if (hatches[i] == NULL)
     {
+        // This macro creates a bitmap from an XBM file included above. Notice
+        // the need for the cast because gdk_bitmap_create_from_data() doesn't
+        // accept unsigned data but the arrays in XBM need to be unsigned to
+        // avoid warnings (and even errors in C+0x mode) from g++.
+#define CREATE_FROM_XBM_DATA(name) \
+        gdk_bitmap_create_from_data \
+        ( \
+            NULL, \
+            reinterpret_cast<gchar *>(name ## _bits), \
+            name ## _width, \
+            name ## _height \
+        )
+
         switch (style)
         {
         case wxBRUSHSTYLE_BDIAGONAL_HATCH:
-            hatches[i] = gdk_bitmap_create_from_data(NULL, bdiag_bits, bdiag_width, bdiag_height);
+            hatches[i] = CREATE_FROM_XBM_DATA(bdiag);
             break;
         case wxBRUSHSTYLE_CROSSDIAG_HATCH:
-            hatches[i] = gdk_bitmap_create_from_data(NULL, cdiag_bits, cdiag_width, cdiag_height);
+            hatches[i] = CREATE_FROM_XBM_DATA(cdiag);
             break;
         case wxBRUSHSTYLE_CROSS_HATCH:
-            hatches[i] = gdk_bitmap_create_from_data(NULL, cross_bits, cross_width, cross_height);
+            hatches[i] = CREATE_FROM_XBM_DATA(cross);
             break;
         case wxBRUSHSTYLE_FDIAGONAL_HATCH:
-            hatches[i] = gdk_bitmap_create_from_data(NULL, fdiag_bits, fdiag_width, fdiag_height);
+            hatches[i] = CREATE_FROM_XBM_DATA(fdiag);
             break;
         case wxBRUSHSTYLE_HORIZONTAL_HATCH:
-            hatches[i] = gdk_bitmap_create_from_data(NULL, horiz_bits, horiz_width, horiz_height);
+            hatches[i] = CREATE_FROM_XBM_DATA(horiz);
             break;
         case wxBRUSHSTYLE_VERTICAL_HATCH:
-            hatches[i] = gdk_bitmap_create_from_data(NULL, verti_bits, verti_width, verti_height);
+            hatches[i] = CREATE_FROM_XBM_DATA(verti);
             break;
         }
+
+#undef CREATE_FROM_XBM_DATA
     }
     return hatches[i];
 }
@@ -280,7 +295,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
         wxCHECK_RET(widget, "DC needs a widget");
 
         m_gdkwindow = widget->window;
-        if (GTK_WIDGET_NO_WINDOW(widget))
+        if (!gtk_widget_get_has_window(widget))
             SetDeviceLocalOrigin(widget->allocation.x, widget->allocation.y);
     }
 
@@ -1477,7 +1492,7 @@ void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord
 
     wxCHECK_RET( IsOk(), wxT("invalid window dc") );
 
-#if __WXGTK26__
+#ifdef __WXGTK26__
     if (!gtk_check_version(2,6,0))
     {
         x = XLOG2DEV(x);