X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7fe42e848cc0c9058dae906c3a7bded50681e6..71a09c3579dd5cb4cd8fa7fdc143561cbff74e12:/src/osx/notebook_osx.cpp?ds=sidebyside diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index 90dc488863..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();