X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dfd0756f75c2a714e0c9d9c66c3ae1c17fca532c..71a09c3579dd5cb4cd8fa7fdc143561cbff74e12:/src/osx/notebook_osx.cpp?ds=sidebyside diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index 9e49d0caca..59a329d5e7 100644 --- a/src/osx/notebook_osx.cpp +++ b/src/osx/notebook_osx.cpp @@ -4,7 +4,6 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -173,11 +172,19 @@ wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage) wxNotebookPage* page = m_pages[nPage] ; m_pages.RemoveAt(nPage); + m_images.RemoveAt(nPage); MacSetupTabs(); - if (m_selection >= (int)GetPageCount()) - m_selection = GetPageCount() - 1; + if ( m_selection >= (int)nPage ) + { + if ( GetPageCount() == 0 ) + m_selection = wxNOT_FOUND; + else + m_selection = m_selection ? m_selection - 1 : 0; + + GetPeer()->SetValue( m_selection + 1 ) ; + } if (m_selection >= 0) m_pages[m_selection]->Show(true); @@ -190,7 +197,8 @@ wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage) // remove all pages bool wxNotebook::DeleteAllPages() { - WX_CLEAR_ARRAY(m_pages) ; + WX_CLEAR_ARRAY(m_pages); + m_images.clear(); MacSetupTabs(); m_selection = wxNOT_FOUND ; InvalidateBestSize(); @@ -458,7 +466,7 @@ bool wxNotebook::OSXHandleClicked( double WXUNUSED(timestampsec) ) if ( newSel != m_selection ) { wxBookCtrlEvent changing( - wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId, + wxEVT_NOTEBOOK_PAGE_CHANGING, m_windowId, newSel , m_selection ); changing.SetEventObject( this ); HandleWindowEvent( changing ); @@ -466,7 +474,7 @@ bool wxNotebook::OSXHandleClicked( double WXUNUSED(timestampsec) ) if ( changing.IsAllowed() ) { wxBookCtrlEvent event( - wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId, + wxEVT_NOTEBOOK_PAGE_CHANGED, m_windowId, newSel, m_selection ); event.SetEventObject( this ); HandleWindowEvent( event );