Weekly updates.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -212,19 +212,33 @@ int wxNotebook::SetSelection(
|
||||
)
|
||||
{
|
||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") );
|
||||
int nOldPage = GetSelection();
|
||||
|
||||
ChangePage( m_nSelection
|
||||
,nPage
|
||||
);
|
||||
if (nPage != m_nSelection)
|
||||
{
|
||||
wxNotebookEvent event( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
|
||||
,m_windowId
|
||||
);
|
||||
vEvent.SetSelection(nPage);
|
||||
vEvent.SetOldSelection(m_nSelection);
|
||||
vEvent.SetEventObject(this);
|
||||
if (!GetEventHandler()->ProcessEvent(vEvent) || vEvent.IsAllowed())
|
||||
{
|
||||
|
||||
//
|
||||
// Program allows the page change
|
||||
//
|
||||
vEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
|
||||
GetEventHandler()->ProcessEvent(vEvent);
|
||||
|
||||
ULONG ulPageId = (ULONG)m_alPageId[nPage];
|
||||
ULONG ulPageId = (ULONG)m_alPageId[nPage];
|
||||
|
||||
::WinSendMsg( GetHWND()
|
||||
,BKM_TURNTOPAGE
|
||||
,MPFROMLONG((ULONG)m_alPageId[nPage])
|
||||
,(MPARAM)0
|
||||
);
|
||||
::WinSendMsg( GetHWND()
|
||||
,BKM_TURNTOPAGE
|
||||
,MPFROMLONG((ULONG)m_alPageId[nPage])
|
||||
,(MPARAM)0
|
||||
);
|
||||
}
|
||||
}
|
||||
m_nSelection = nPage;
|
||||
return nPage;
|
||||
} // end of wxNotebook::SetSelection
|
||||
@@ -891,56 +905,5 @@ bool wxNotebook::OS2OnScroll (
|
||||
);
|
||||
} // end of wxNotebook::OS2OnScroll
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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
|
||||
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
|
Reference in New Issue
Block a user