]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/renderer.cpp
implement wcsftime for versions of VS earlier than 2005
[wxWidgets.git] / src / msw / renderer.cpp
index bba35b0154993da8f3e7b6e7d17b4fd9a09bdd7a..e63c25ad8de706f76345fea4974aea83aa9b60ef 100644 (file)
@@ -33,8 +33,8 @@
 
 #include "wx/splitter.h"
 #include "wx/renderer.h"
-#include "wx/msw/uxtheme.h"
 #include "wx/msw/private.h"
+#include "wx/msw/uxtheme.h"
 
 // tmschema.h is in Win32 Platform SDK and might not be available with earlier
 // compilers
@@ -209,22 +209,30 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win),
 void
 wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win),
                               wxDC& dc,
-                              const wxRect& rect,
+                              const wxRect& rectOrig,
                               int flags)
 {
-    RECT r;
-    r.left = rect.GetLeft();
-    r.top = rect.GetTop();
-    r.bottom = rect.y + rect.height;
-    r.right = rect.x + rect.width;
+    wxRect rect(rectOrig);
 
     int style = DFCS_BUTTONPUSH;
     if ( flags & wxCONTROL_DISABLED )
         style |= DFCS_INACTIVE;
     if ( flags & wxCONTROL_PRESSED )
         style |= DFCS_PUSHED | DFCS_FLAT;
+    if ( flags & wxCONTROL_ISDEFAULT )
+    {
+        // DrawFrameControl() doesn't seem to support default buttons so we
+        // have to draw the border ourselves
+        wxDCPenChanger pen(dc, *wxBLACK_PEN);
+        wxDCBrushChanger brush(dc, *wxTRANSPARENT_BRUSH);
+        dc.DrawRectangle(rect);
+        rect.Deflate(1);
+    }
+
+    RECT rc;
+    wxCopyRectToRECT(rect, rc);
 
-    ::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style);
+    ::DrawFrameControl(GetHdcOf(dc), &rc, DFC_BUTTON, style);
 }
 
 // ============================================================================