]> git.saurik.com Git - wxWidgets.git/commitdiff
Always set the background colour for XP, for consistent toolbar backgrounds
authorJulian Smart <julian@anthemion.co.uk>
Tue, 4 Sep 2007 13:47:05 +0000 (13:47 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 4 Sep 2007 13:47:05 +0000 (13:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/tbar95.cpp

index b7070ed90ae37b00dc0d104931bc3fc26ad7eb4c..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;
 }
 
@@ -1000,8 +1007,6 @@ bool wxToolBar::Realize()
     // Deal with the controls finally
     // ------------------------------
 
-    bool hasControls = false;
-
     // adjust the controls size to fit nicely in the toolbar
     int y = 0;
     size_t index = 0;
@@ -1033,8 +1038,6 @@ bool wxToolBar::Realize()
             continue;
         }
 
-        hasControls = true;
-
         wxControl *control = tool->GetControl();
         wxStaticText * const staticText = tool->GetStaticText();
 
@@ -1175,13 +1178,6 @@ bool wxToolBar::Realize()
     InvalidateBestSize();
     UpdateSize();
 
-    // 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 && hasControls && !UseBgCol())
-        SetBackgroundColour(GetBackgroundColour());
-
     return true;
 }