// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
-// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
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);
// 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();
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 );
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 );