X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0dc44daa338774eafd9ef9e9c31212acf07532e2..59859d3da18244fa31f82c30ded14f619c3c967f:/src/generic/listbkg.cpp diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index bd48126901..0861211c0e 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -85,11 +85,6 @@ END_EVENT_TABLE() // wxListbook creation // ---------------------------------------------------------------------------- -void wxListbook::Init() -{ - m_selection = wxNOT_FOUND; -} - bool wxListbook::Create(wxWindow *parent, wxWindowID id, @@ -311,11 +306,6 @@ void wxListbook::UpdateSelectedPage(size_t newsel) GetListView()->Focus(newsel); } -int wxListbook::GetSelection() const -{ - return m_selection; -} - wxBookCtrlEvent* wxListbook::CreatePageChangingEvent() const { return new wxBookCtrlEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId); @@ -353,20 +343,9 @@ wxListbook::InsertPage(size_t n, GetListView()->Focus(m_selection); } - // some page should be selected: either this one or the first one if there - // is still no selection - int selNew = -1; - if ( bSelect ) - selNew = n; - else if ( m_selection == -1 ) - selNew = 0; - - if ( selNew != m_selection ) + if ( !DoSetSelectionAfterInsertion(n, bSelect) ) page->Hide(); - if ( selNew != -1 ) - SetSelection(selNew); - UpdateSize(); return true; @@ -387,7 +366,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page) int sel = m_selection - 1; if (page_count == 1) sel = wxNOT_FOUND; - else if ((page_count == 2) || (sel == -1)) + else if ((page_count == 2) || (sel == wxNOT_FOUND)) sel = 0; // force sel invalid if deleting current page - don't try to hide it @@ -411,8 +390,6 @@ bool wxListbook::DeleteAllPages() if (!wxBookCtrlBase::DeleteAllPages()) return false; - m_selection = -1; - UpdateSize(); return true;