merged 2.4 branch into the trunk
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -161,7 +161,7 @@ WXDWORD wxNotebook::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||
|
||||
tabStyle |= WS_TABSTOP | TCS_TABS;
|
||||
|
||||
if ( style & wxTC_MULTILINE )
|
||||
if ( style & wxNB_MULTILINE )
|
||||
tabStyle |= TCS_MULTILINE;
|
||||
if ( style & wxNB_FIXEDWIDTH )
|
||||
tabStyle |= TCS_FIXEDWIDTH;
|
||||
@@ -205,9 +205,23 @@ int wxNotebook::SetSelection(int nPage)
|
||||
{
|
||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") );
|
||||
|
||||
ChangePage(m_nSelection, nPage);
|
||||
if ( nPage != m_nSelection )
|
||||
{
|
||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId);
|
||||
event.SetSelection(nPage);
|
||||
event.SetOldSelection(m_nSelection);
|
||||
event.SetEventObject(this);
|
||||
if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
|
||||
{
|
||||
// program allows the page change
|
||||
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
|
||||
(void)GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
return TabCtrl_SetCurSel(m_hwnd, nPage);
|
||||
TabCtrl_SetCurSel(m_hwnd, nPage);
|
||||
}
|
||||
}
|
||||
|
||||
return m_nSelection;
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
|
||||
@@ -631,44 +645,4 @@ bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
|
||||
return processed;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
{
|
||||
// MT-FIXME should use a real semaphore
|
||||
static bool s_bInsideChangePage = FALSE;
|
||||
|
||||
// when we call ProcessEvent(), our own OnSelChange() is called which calls
|
||||
// this function - break the infinite loop
|
||||
if ( s_bInsideChangePage )
|
||||
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;
|
||||
|
||||
s_bInsideChangePage = TRUE;
|
||||
|
||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId);
|
||||
event.SetSelection(nSel);
|
||||
event.SetOldSelection(nOldSel);
|
||||
event.SetEventObject(this);
|
||||
if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
|
||||
{
|
||||
// program doesn't allow the page change
|
||||
s_bInsideChangePage = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
s_bInsideChangePage = FALSE;
|
||||
}
|
||||
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
Reference in New Issue
Block a user