-// ----------------------------------------------------------------------------
-// wxNotebook helper functions
-// ----------------------------------------------------------------------------
-
-//
-// Generate the page changing and changed events, hide the currently active
-// panel and show the new one
-//
-void wxNotebook::ChangePage (
- int nOldSel
-, int nSel
-)
-{
- static bool sbInsideChangePage = FALSE;
-
- //
- // When we call ProcessEvent(), our own OnSelChange() is called which calls
- // this function - break the infinite loop
- //
- if (sbInsideChangePage)
- return;
-
- //
- // It's not an error (the message may be generated by the tab control itself)
- // and it may happen - just do nothing
- //
- if (nSel == nOldSel)
- return;
-
- sbInsideChangePage = TRUE;
-
- wxNotebookEvent rEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
- ,m_windowId
- );
-
- rEvent.SetSelection(nSel);
- rEvent.SetOldSelection(nOldSel);
- rEvent.SetEventObject(this);
- if (GetEventHandler()->ProcessEvent(rEvent) && !rEvent.IsAllowed())
- {
- //
- // Program doesn't allow the page change
- //
- sbInsideChangePage = FALSE;
- return;
- }
- rEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
- GetEventHandler()->ProcessEvent(rEvent);
- sbInsideChangePage = FALSE;
-} // end of wxNotebook::ChangePage
-