From d679df70f06174bffd18e1a7db098f76ecb82991 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Mon, 2 Aug 2004 09:50:03 +0000
Subject: [PATCH] Fix for toolbar workaround (mustn't set flag unless we're in
 Classic mode or we get separators showing)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/msw/tbar95.cpp | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp
index ef132e7408..944a1d0b27 100644
--- a/src/msw/tbar95.cpp
+++ b/src/msw/tbar95.cpp
@@ -46,6 +46,10 @@
 
 #include "wx/msw/private.h"
 
+#if wxUSE_UXTHEME
+#include "wx/msw/uxtheme.h"
+#endif
+
 // include <commctrl.h> "properly"
 #include "wx/msw/wrapcctl.h"
 
@@ -247,18 +251,25 @@ bool wxToolBar::Create(wxWindow *parent,
     SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
 
     // workaround for flat toolbar on Windows XP classic style
+#if wxUSE_UXTHEME
     if ( style & wxTB_FLAT )
     {
-        DWORD dwToolbarStyle;
+        wxUxThemeEngine *p = wxUxThemeEngine::Get();
+        if ( !p || !p->IsThemeActive() )
+        {
+            DWORD dwToolbarStyle;
 
-        dwToolbarStyle = (DWORD)::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L );
+            dwToolbarStyle = (DWORD)::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L );
         
-        if ((dwToolbarStyle & TBSTYLE_FLAT) == 0)
-        {
-            dwToolbarStyle |= TBSTYLE_FLAT;
-            ::SendMessage(GetHwnd(), TB_SETSTYLE, 0, (LPARAM)dwToolbarStyle );
+            if ((dwToolbarStyle & TBSTYLE_FLAT) == 0)
+            {
+                dwToolbarStyle |= TBSTYLE_FLAT;
+                ::SendMessage(GetHwnd(), TB_SETSTYLE, 0, (LPARAM)dwToolbarStyle );
+            }
         }
     }
+#endif
+    
     return TRUE;
 }
 
-- 
2.47.2