]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listbkg.cpp
Rename delegates to try and stop name clashes, probably with wxWebKitCtrl.
[wxWidgets.git] / src / generic / listbkg.cpp
index bd4812690188015857c30159a435cc5ca42c7184..0861211c0eeb4ab6d3d08253c9b03a0565d990db 100644 (file)
@@ -85,11 +85,6 @@ END_EVENT_TABLE()
 // wxListbook creation
 // ----------------------------------------------------------------------------
 
 // wxListbook creation
 // ----------------------------------------------------------------------------
 
-void wxListbook::Init()
-{
-    m_selection = wxNOT_FOUND;
-}
-
 bool
 wxListbook::Create(wxWindow *parent,
                    wxWindowID id,
 bool
 wxListbook::Create(wxWindow *parent,
                    wxWindowID id,
@@ -311,11 +306,6 @@ void wxListbook::UpdateSelectedPage(size_t newsel)
     GetListView()->Focus(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);
 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);
     }
 
         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();
 
         page->Hide();
 
-    if ( selNew != -1 )
-        SetSelection(selNew);
-
     UpdateSize();
 
     return true;
     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;
             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
                 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;
 
     if (!wxBookCtrlBase::DeleteAllPages())
         return false;
 
-    m_selection = -1;
-
     UpdateSize();
 
     return true;
     UpdateSize();
 
     return true;