X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0398b1d65dce1e2479ff41b272b815359655f5df..c6e62f74fcac5b62889b59e7ce7a41d0ce884d7b:/src/msw/notebook.cpp?ds=sidebyside diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index f8d4ed27d1..43b70d1dbb 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -22,16 +22,16 @@ // wxWindows #ifndef WX_PRECOMP - #include + #include "wx/string.h" #endif // WX_PRECOMP -#include -#include -#include -#include -#include +#include "wx/log.h" +#include "wx/imaglist.h" +#include "wx/event.h" +#include "wx/control.h" +#include "wx/notebook.h" -#include +#include "wx/msw/private.h" // Windows standard headers #ifndef __WIN95__ @@ -83,7 +83,6 @@ // event table // ---------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARIES BEGIN_EVENT_TABLE(wxNotebook, wxControl) EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange) @@ -96,7 +95,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) -#endif // ============================================================================ // implementation @@ -316,6 +314,9 @@ bool wxNotebook::DeletePage(int nPage) // no selection if the notebook became empty m_nSelection = -1; } + else + m_nSelection = TabCtrl_GetCurSel(m_hwnd); + return TRUE; } @@ -329,6 +330,11 @@ bool wxNotebook::RemovePage(int nPage) m_aPages.Remove(nPage); + if ( m_aPages.IsEmpty() ) + m_nSelection = -1; + else + m_nSelection = TabCtrl_GetCurSel(m_hwnd); + return TRUE; } @@ -344,6 +350,8 @@ bool wxNotebook::DeleteAllPages() TabCtrl_DeleteAllItems(m_hwnd); + m_nSelection = -1; + return TRUE; } @@ -414,8 +422,6 @@ bool wxNotebook::InsertPage(int nPage, GetSize((int *)&rc.right, (int *)&rc.bottom); TabCtrl_AdjustRect(m_hwnd, FALSE, &rc); pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); - if ( pPage->GetAutoLayout() ) - pPage->Layout(); // some page should be selected: either this one or the first one if there is @@ -448,8 +454,6 @@ void wxNotebook::OnSize(wxSizeEvent& event) for ( size_t nPage = 0; nPage < nCount; nPage++ ) { wxNotebookPage *pPage = m_aPages[nPage]; pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); - if ( pPage->GetAutoLayout() ) - pPage->Layout(); } event.Skip();