]> git.saurik.com Git - wxWidgets.git/commitdiff
don't try to subclass tab control using the same window proc for our class, this...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 17 Jun 2005 21:25:16 +0000 (21:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 17 Jun 2005 21:25:16 +0000 (21:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/notebook.cpp

index 6d9f5b112ae798a054e138e24cc6abb81bde24bb..fdef3d8cbfa13158ecb733387cb6de20fe17836b 100644 (file)
 // the pointer to standard spin button wnd proc
 static WXFARPROC gs_wndprocNotebookSpinBtn = (WXFARPROC)NULL;
 
+// the pointer to standard tab control wnd proc
+static WXFARPROC gs_wndprocNotebook = (WXFARPROC)NULL; 
+
+LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
+                                           UINT message,
+                                           WPARAM wParam,
+                                           LPARAM lParam);
+
 #endif // USE_NOTEBOOK_ANTIFLICKER
 
 // ----------------------------------------------------------------------------
@@ -285,6 +293,7 @@ bool wxNotebook::Create(wxWindow *parent,
 
     LPCTSTR className = WC_TABCONTROL;
 
+#if USE_NOTEBOOK_ANTIFLICKER
     // SysTabCtl32 class has natively CS_HREDRAW and CS_VREDRAW enabled and it
     // causes horrible flicker when resizing notebook, so get rid of it by
     // using a class without these styles (but otherwise identical to it)
@@ -296,11 +305,14 @@ bool wxNotebook::Create(wxWindow *parent,
             // get a copy of standard class and modify it
             WNDCLASS wc;
 
-            if ( ::GetClassInfo(::GetModuleHandle(NULL), WC_TABCONTROL, &wc) )
+            if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) )
             {
+                gs_wndprocNotebook =
+                    wx_reinterpret_cast(WXFARPROC, wc.lpfnWndProc);
                 wc.lpszClassName = wxT("_wx_SysTabCtl32");
                 wc.style &= ~(CS_HREDRAW | CS_VREDRAW);
-
+                wc.hInstance = wxGetInstance();
+                wc.lpfnWndProc = wxNotebookWndProc;
                 s_clsNotebook.Register(wc);
             }
             else
@@ -318,6 +330,7 @@ bool wxNotebook::Create(wxWindow *parent,
             className = s_clsNotebook.GetName().c_str();
         }
     }
+#endif // USE_NOTEBOOK_ANTIFLICKER
 
     if ( !CreateControl(parent, id, pos, size, style | wxTAB_TRAVERSAL,
                         wxDefaultValidator, name) )
@@ -789,6 +802,16 @@ LRESULT APIENTRY _EXPORT wxNotebookSpinBtnWndProc(HWND hwnd,
                             hwnd, message, wParam, lParam);
 }
 
+LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
+                                           UINT message,
+                                           WPARAM wParam,
+                                           LPARAM lParam)
+{
+    return ::CallWindowProc(CASTWNDPROC gs_wndprocNotebook,
+                            hwnd, message, wParam, lParam);
+}
+
 
 void wxNotebook::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
 {