]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
Fix of memory leak with generic file dialog (Patch #1017938)
[wxWidgets.git] / src / msw / tbar95.cpp
index ef132e74089dd5bf299731150df7e4c50ce00fcc..944a1d0b27c530fbd1a25535edf872d403de76a0 100644 (file)
 
 #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;
 }