]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/renderg.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / generic / renderg.cpp
index 0601a60f381e090d56a9919657fde2a1c1bde35b..4d411dd12d39ed2efbbf2079a7ebde4aa75b296e 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     20.07.2003
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     20.07.2003
-// RCS-ID:      $Id$
 // Copyright:   (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -468,12 +467,20 @@ wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win),
 
     dc.DrawRectangle(rect);
 
 
     dc.DrawRectangle(rect);
 
+    // Make sure that the sign is properly centered by always using an
+    // odd-sized rectangle for it.
+    wxRect signRect(rect);
+    if ( !(signRect.x % 2) )
+        signRect.x--;
+    if ( !(signRect.y % 2) )
+        signRect.y--;
+
     // black lines
     // black lines
-    const wxCoord xMiddle = rect.x + rect.width/2;
-    const wxCoord yMiddle = rect.y + rect.height/2;
+    const wxCoord xMiddle = signRect.x + signRect.width/2;
+    const wxCoord yMiddle = signRect.y + signRect.height/2;
 
     // half of the length of the horz lines in "-" and "+"
 
     // half of the length of the horz lines in "-" and "+"
-    const wxCoord halfWidth = rect.width/2 - 2;
+    const wxCoord halfWidth = signRect.width/2 - 2;
     dc.SetPen(*wxBLACK_PEN);
     dc.DrawLine(xMiddle - halfWidth, yMiddle,
                 xMiddle + halfWidth + 1, yMiddle);
     dc.SetPen(*wxBLACK_PEN);
     dc.DrawLine(xMiddle - halfWidth, yMiddle,
                 xMiddle + halfWidth + 1, yMiddle);
@@ -481,7 +488,7 @@ wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win),
     if ( !(flags & wxCONTROL_EXPANDED) )
     {
         // turn "-" into "+"
     if ( !(flags & wxCONTROL_EXPANDED) )
     {
         // turn "-" into "+"
-        const wxCoord halfHeight = rect.height/2 - 2;
+        const wxCoord halfHeight = signRect.height/2 - 2;
         dc.DrawLine(xMiddle, yMiddle - halfHeight,
                     xMiddle, yMiddle + halfHeight + 1);
     }
         dc.DrawLine(xMiddle, yMiddle - halfHeight,
                     xMiddle, yMiddle + halfHeight + 1);
     }