]> git.saurik.com Git - wxWidgets.git/commitdiff
add support for wxCONTROL_ISDEFAULT to wxRendererMSW::DrawPushButton() (modified...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Oct 2006 15:49:52 +0000 (15:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Oct 2006 15:49:52 +0000 (15:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41726 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/renderer.cpp

index bba35b0154993da8f3e7b6e7d17b4fd9a09bdd7a..9a6fb82c73da803cf7a06b729e969a8b93709044 100644 (file)
@@ -209,22 +209,30 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win),
 void
 wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win),
                               wxDC& dc,
 void
 wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win),
                               wxDC& dc,
-                              const wxRect& rect,
+                              const wxRect& rectOrig,
                               int flags)
 {
                               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;
 
     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.Inflate(1);
+    }
+
+    RECT rc;
+    wxCopyRectToRECT(rect, rc);
 
 
-    ::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style);
+    ::DrawFrameControl(GetHdcOf(dc), &rc, DFC_BUTTON, style);
 }
 
 // ============================================================================
 }
 
 // ============================================================================