From 6143d3b61e311ae647577c284eaf41dded4e2b3c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 17 Jun 2005 21:25:16 +0000 Subject: [PATCH] don't try to subclass tab control using the same window proc for our class, this doesn't work (really fixes bug 1222187, thanks go to Dave Dribin) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/notebook.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 6d9f5b112a..fdef3d8cbf 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -93,6 +93,14 @@ // 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)) { -- 2.45.2