added wxBookCtrl::ChangeSelection() which is the same as SetSelection() but doesn't send the page change events (second part of patch 1553551)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -245,39 +245,10 @@ int wxToolbook::GetSelection() const
|
||||
return m_selection;
|
||||
}
|
||||
|
||||
int wxToolbook::SetSelection(size_t n)
|
||||
int wxToolbook::DoSetSelection(size_t n, int flags)
|
||||
{
|
||||
wxCHECK_MSG( IS_VALID_PAGE(n), wxNOT_FOUND,
|
||||
wxT("invalid page index in wxToolbook::SetSelection()") );
|
||||
|
||||
const int oldSel = m_selection;
|
||||
|
||||
if ( int(n) != m_selection )
|
||||
{
|
||||
wxToolbookEvent event(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId);
|
||||
event.SetSelection(n);
|
||||
event.SetOldSelection(m_selection);
|
||||
event.SetEventObject(this);
|
||||
if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
|
||||
{
|
||||
if ( m_selection != wxNOT_FOUND )
|
||||
m_pages[m_selection]->Hide();
|
||||
|
||||
wxWindow *page = m_pages[n];
|
||||
page->SetSize(GetPageRect());
|
||||
page->Show();
|
||||
|
||||
// change m_selection now to ignore the selection change event
|
||||
m_selection = n;
|
||||
GetToolBar()->ToggleTool(n + 1, true);
|
||||
|
||||
// program allows the page change
|
||||
event.SetEventType(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED);
|
||||
(void)GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
return oldSel;
|
||||
wxToolbookEvent event(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId);
|
||||
return wxBookCtrlBase::DoSetSelection(n, flags, event);
|
||||
}
|
||||
|
||||
// Not part of the wxBookctrl API, but must be called in OnIdle or
|
||||
|
||||
Reference in New Issue
Block a user