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
This commit is contained in:
Vadim Zeitlin 2012-08-30 20:21:29 +00:00
parent 9ed3454e3d
commit 2e18fe7139
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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);