From: Julian Smart Date: Thu, 16 Jun 2005 15:36:48 +0000 (+0000) Subject: Applied patch [ 1218833 ] [wxMSW] wxListBox optimisation for XP X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ce0e1aacbc0d79a06a570d598327dff1cfe38fb9 Applied patch [ 1218833 ] [wxMSW] wxListBox optimisation for XP Also removed temporary fix to hardwire listbox background colour git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index 5104928429..43350ba8aa 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -151,6 +151,13 @@ protected: virtual wxSize DoGetBestSize() const; + // under XP when using "transition effect for menus and tooltips" if we + // return true for WM_PRINTCLIENT here then it causes noticable slowdown + virtual bool MSWShouldPropagatePrintChild() + { + return false; + } + #if wxUSE_OWNER_DRAWN // control items wxListBoxItemsArray m_aItems; diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 218bd938bd..39ba4694f7 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -391,6 +391,14 @@ public: return false; } + // some controls (e.g. wxListBox) need to set the return value themselves + // + // return true to let parent handle it if we don't, false otherwise + virtual bool MSWShouldPropagatePrintChild() + { + return true; + } + // Responds to colour changes: passes event on to children. void OnSysColourChanged(wxSysColourChangedEvent& event); diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index ffe24da141..c799cf3479 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -174,10 +174,6 @@ bool wxListBox::Create(wxWindow *parent, return false; } - // Necessary to prevent scroll problems within a notebook with Windows - // effects enabled - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - // initialize the contents for ( int i = 0; i < n; i++ ) { diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 3c94a80359..315f7bdd6d 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -4150,6 +4150,11 @@ bool wxWindowMSW::HandlePrintClient(WXHDC hDC) if ( IsTopLevel() || InheritsBackgroundColour() ) return false; + // sometimes we don't want the parent to handle it at all, instead + // return whatever value this window wants + if ( !MSWShouldPropagatePrintChild() ) + return MSWPrintChild(hDC, (wxWindow *)this); + for ( wxWindow *win = GetParent(); win; win = win->GetParent() ) { if ( win->MSWPrintChild(hDC, (wxWindow *)this) )