]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
Each book control should say what its default orientation. Use this info
[wxWidgets.git] / src / msw / notebook.cpp
index 8405625fcc097d4e959b72a6dbffa1bc343e35a4..193bd61d6c8ae47ef199cd4602afeba72dff7b19 100644 (file)
 
 #if wxUSE_NOTEBOOK
 
-// wxWidgets
+#include  "wx/notebook.h"
+
 #ifndef WX_PRECOMP
-  #include  "wx/string.h"
-  #include  "wx/dc.h"
+    #include  "wx/string.h"
+    #include  "wx/dc.h"
+    #include  "wx/log.h"
+    #include  "wx/event.h"
+    #include  "wx/app.h"
+    #include  "wx/dcclient.h"
+    #include  "wx/dcmemory.h"
+    #include  "wx/control.h"
 #endif  // WX_PRECOMP
 
-#include  "wx/log.h"
 #include  "wx/imaglist.h"
-#include  "wx/event.h"
-#include  "wx/control.h"
-#include  "wx/notebook.h"
-#include  "wx/app.h"
 #include  "wx/sysopt.h"
-#include  "wx/dcclient.h"
-#include  "wx/dcmemory.h"
 
 #include  "wx/msw/private.h"
 
 #include  <windowsx.h>
-
-#include <commctrl.h>
-
 #include "wx/msw/winundef.h"
 
+// include <commctrl.h> "properly"
+#include "wx/msw/wrapcctl.h"
+
 #if wxUSE_UXTHEME
     #include "wx/msw/uxtheme.h"
 #endif
@@ -275,19 +275,16 @@ bool wxNotebook::Create(wxWindow *parent,
         style |= wxBORDER_SUNKEN;
 #endif
 
-    // comctl32.dll 6.0 doesn't support non-top tabs with visual styles (the
-    // control is simply not rendered correctly), so disable them in this case
+#if !wxUSE_UXTHEME
+    // ComCtl32 notebook tabs simply don't work unless they're on top if we have uxtheme, we can
+    // work around it later (after control creation), but if we don't have uxtheme, we have to clear
+    // those styles
     const int verComCtl32 = wxApp::GetComCtl32Version();
     if ( verComCtl32 == 600 )
     {
-        // check if we use themes at all -- if we don't, we're still ok
-#if wxUSE_UXTHEME
-        if ( wxUxThemeEngine::GetIfActive() )
-#endif
-        {
-            style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT);
-        }
+        style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT);
     }
+#endif //wxUSE_UXTHEME
 
     LPCTSTR className = WC_TABCONTROL;
 
@@ -348,6 +345,22 @@ bool wxNotebook::Create(wxWindow *parent,
         // create backing store
         UpdateBgBrush();
     }
+
+    // comctl32.dll 6.0 doesn't support non-top tabs with visual styles (the
+    // control is simply not rendered correctly), so we disable themes
+    // if possible, otherwise we simply clear the styles.
+    // It's probably not possible to have UXTHEME without ComCtl32 6 or better, but lets
+    // check it anyway.
+    const int verComCtl32 = wxApp::GetComCtl32Version();
+    if ( verComCtl32 == 600 )
+    {
+        // check if we use themes at all -- if we don't, we're still okay
+        if ( wxUxThemeEngine::GetIfActive() && (style & (wxBK_BOTTOM|wxBK_LEFT|wxBK_RIGHT)))
+        {
+            wxUxThemeEngine::GetIfActive()->SetWindowTheme((HWND)this->GetHandle(), L"", L"");
+            SetBackgroundColour(GetThemeBackgroundColour());    //correct the background color for the new non-themed control
+        }
+    }
 #endif // wxUSE_UXTHEME
 
     // Undocumented hack to get flat notebook style
@@ -848,7 +861,7 @@ void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
     HBRUSH hbr = (HBRUSH)m_hbrBackground;
 #else
     HBRUSH hbr = 0;
-#endif    
+#endif
     wxBrush brush;
     if ( !hbr )
     {