]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
added WX_CHECK_BUILD_OPTIONS
[wxWidgets.git] / src / msw / notebook.cpp
index 2594af1c814fbcedf99bc8a4ae96dcce5ea3ca31..cb9d37a5736c46c47bb176ea1256a360fc5c3f0b 100644 (file)
 #include "wx/panel.h"
 #endif
 
+/*
+       notebookpage
+               object
+               object_ref
+               label
+               selected
+               style
+               usenotebooksizer
+*/
+
 // ----------------------------------------------------------------------------
 // macros
 // ----------------------------------------------------------------------------
@@ -485,11 +495,21 @@ bool wxNotebook::InsertPage(int nPage,
                     _T("notebook pages must have notebook as parent") );
 
 #if wxUSE_UXTHEME && wxUSE_UXTHEME_AUTO
+    static bool g_TestedForTheme = FALSE;
+    static bool g_UseTheme = FALSE;
+    if (!g_TestedForTheme)
+    {
+        int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
+        
+        g_UseTheme = (commCtrlVersion >= 600);
+        g_TestedForTheme = TRUE;
+    }
+    
     // Automatically apply the theme background,
     // changing the colour of the panel to match the
     // tab page colour. This won't work well with all
     // themes but it's a start.
-    if (wxUxThemeEngine::Get() && pPage->IsKindOf(CLASSINFO(wxPanel)))
+    if (g_UseTheme && wxUxThemeEngine::Get() && pPage->IsKindOf(CLASSINFO(wxPanel)))
     {
         ApplyThemeBackground(pPage, GetThemeBackgroundColour());
     }
@@ -812,7 +832,11 @@ wxColour wxNotebook::GetThemeBackgroundColour()
 }
 
 // Windows only: attempts to apply the UX theme page background to this page
+#if wxUSE_UXTHEME
 void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour)
+#else
+void wxNotebook::ApplyThemeBackground(wxWindow*, const wxColour&)
+#endif
 {
 #if wxUSE_UXTHEME
     // Don't set the background for buttons since this will
@@ -842,10 +866,34 @@ void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour)
         wxWindow *child = node->GetData();
         ApplyThemeBackground(child, colour);
     }
-#else
-    window;
-    colour;
 #endif
 }
 
+long wxNotebook::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+    static bool g_TestedForTheme = FALSE;
+    static bool g_UseTheme = FALSE;
+    switch ( nMsg )
+    {
+        case WM_ERASEBKGND:
+        {
+            if (!g_TestedForTheme)
+            {
+                int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
+
+                g_UseTheme = (commCtrlVersion >= 600);
+                g_TestedForTheme = TRUE;
+            }
+
+            // If using XP themes, it seems we can get away
+            // with not drawing a background, which reduces flicker.
+            if (g_UseTheme)            
+                return TRUE;
+        }
+    }
+
+    return wxControl::MSWWindowProc(nMsg, wParam, lParam);
+}
+
+
 #endif // wxUSE_NOTEBOOK