From: Vadim Zeitlin Date: Thu, 30 Aug 2012 20:21:29 +0000 (+0000) Subject: Virtualize showing/hiding the pages in wxBookCtrlBase. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2e18fe7139558b3cb592a04a4e4668319a966ebf?hp=9ed3454e3d06f99510cd203419c40c46a0370c08 Virtualize showing/hiding the pages in wxBookCtrlBase. No real changes, just make it possible to change how the pages are hidden and shown in the derived classes. This is not used by any of them yet, but will be used by wxSimplebook soon. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index 50087a2526..018d1200f6 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -277,6 +277,11 @@ protected: { wxFAIL_MSG(wxT("Override this function!")); } + // The derived class also may override the following method, also called + // from DoSetSelection(), to show/hide pages differently. + virtual void DoShowPage(wxWindow* page, bool show) { page->Show(show); } + + // Should we accept NULL page pointers in Add/InsertPage()? // // Default is no but derived classes may override it if they can treat NULL diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index d551d8bf2e..92846f30aa 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -476,11 +476,11 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags) if ( !(flags & SetSelection_SendEvent) || allowed) { if ( oldSel != wxNOT_FOUND ) - m_pages[oldSel]->Hide(); + DoShowPage(m_pages[oldSel], false); wxWindow *page = m_pages[n]; page->SetSize(GetPageRect()); - page->Show(); + DoShowPage(page, true); // change selection now to ignore the selection change event UpdateSelectedPage(n);