]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
Patch to use high printer resolution instead of Cairo's 72dpi
[wxWidgets.git] / src / msw / tbar95.cpp
index 54547adf94dd05eeacdf9ca3e7c4fec151bca5a3..b653a821d828e2474dde20d7bd6c3788543bcba5 100644 (file)
@@ -308,6 +308,13 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size)
         ::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
 #endif
 
+    // Fix a bug on e.g. the Silver theme on WinXP where control backgrounds
+    // are incorrectly drawn, by forcing the background to a specific colour.
+    int majorVersion, minorVersion;
+    wxGetOsVersion(& majorVersion, & minorVersion);
+    if (majorVersion < 6)
+        SetBackgroundColour(GetBackgroundColour());
+
     return true;
 }
 
@@ -405,8 +412,16 @@ wxSize wxToolBar::DoGetBestSize() const
         sizeBest.y = size.cy;
     }
 
-    if (!IsVertical() && !(GetWindowStyle() & wxTB_NODIVIDER))
-        sizeBest.y += 1;
+    if (!IsVertical())
+    {
+        // Without the extra height, DoGetBestSize can report a size that's
+        // smaller than the actual window, causing windows to overlap slightly
+        // in some circumstances, leading to missing borders (especially noticeable
+        // in AUI layouts).
+        if (!(GetWindowStyle() & wxTB_NODIVIDER))
+            sizeBest.y += 2;
+        sizeBest.y ++;
+    }
 
     CacheBestSize(sizeBest);
 
@@ -932,7 +947,7 @@ bool wxToolBar::Realize()
                                 DoToggleTool(tool, true);
                             }
                         }
-                        else if (tool->IsToggled())
+                        else if ( tool->IsToggled() )
                         {
                             wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious();
                             int prevIndex = i - 1;
@@ -946,7 +961,7 @@ bool wxToolBar::Realize()
                                 if ( tool->Toggle(false) )
                                     DoToggleTool(tool, false);
 
-                                prevButton.fsState = TBSTATE_ENABLED;
+                                prevButton.fsState &= TBSTATE_CHECKED;
                                 nodePrev = nodePrev->GetPrevious();
                                 prevIndex--;
                             }
@@ -1772,7 +1787,7 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
                     // Necessary in case we use a no-paint-on-size
                     // style in the parent: the controls can disappear
                     control->Refresh(false);
-                               }
+                }
 
                 if ( staticText && rectStaticText.Intersects(rectItem) )
                 {