]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listbkg.cpp
ignore WinCE projects and build directories
[wxWidgets.git] / src / generic / listbkg.cpp
index 9f725353c00dd7678be1182b8e62b7473654255a..2bfb0b4d09abf7e99766c87a6c9b4a78901e0c09 100644 (file)
 IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase)
 IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent)
 
 IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase)
 IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent)
 
-#if !WXWIN_COMPATIBILITY_EVENT_TYPES
 const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
 const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType();
 const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
 const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType();
-#endif
-const int wxID_LISTBOOKLISTVIEW = wxNewId();
 
 BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase)
     EVT_SIZE(wxListbook::OnSize)
 
 BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase)
     EVT_SIZE(wxListbook::OnSize)
-    EVT_LIST_ITEM_SELECTED(wxID_LISTBOOKLISTVIEW, wxListbook::OnListSelected)
+    EVT_LIST_ITEM_SELECTED(wxID_ANY, wxListbook::OnListSelected)
 END_EVENT_TABLE()
 
 // ============================================================================
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -103,7 +100,7 @@ wxListbook::Create(wxWindow *parent,
     m_bookctrl = new wxListView
                  (
                     this,
     m_bookctrl = new wxListView
                  (
                     this,
-                    wxID_LISTBOOKLISTVIEW,
+                    wxID_ANY,
                     wxDefaultPosition,
                     wxDefaultSize,
                     wxLC_ICON | wxLC_SINGLE_SEL |
                     wxDefaultPosition,
                     wxDefaultSize,
                     wxLC_ICON | wxLC_SINGLE_SEL |
@@ -274,12 +271,17 @@ int wxListbook::GetSelection() const
     return m_selection;
 }
 
     return m_selection;
 }
 
-int wxListbook::DoSetSelection(size_t n, int flags)
+wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const
+{
+    return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId);
+}
+
+void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event)
 {
 {
-    wxListbookEvent event(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId);
-    return wxBookCtrlBase::DoSetSelection(n, flags, event);
+    event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED);
 }
 
 }
 
+
 // ----------------------------------------------------------------------------
 // adding/removing the pages
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // adding/removing the pages
 // ----------------------------------------------------------------------------
@@ -320,15 +322,9 @@ wxListbook::InsertPage(size_t n,
     if ( selNew != -1 )
         SetSelection(selNew);
 
     if ( selNew != -1 )
         SetSelection(selNew);
 
-    InvalidateBestSize();
-    // GetListView()->InvalidateBestSize();
-    GetListView()->Arrange();
-
-    if (GetPageCount() == 1)
-    {
-        wxSizeEvent sz(GetSize(), GetId());
-        ProcessEvent(sz);
-    }
+    wxSizeEvent sz(GetSize(), GetId());
+    GetEventHandler()->ProcessEvent(sz);
+    
     return true;
 }
 
     return true;
 }
 
@@ -361,7 +357,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
         if (GetPageCount() == 0)
         {
             wxSizeEvent sz(GetSize(), GetId());
         if (GetPageCount() == 0)
         {
             wxSizeEvent sz(GetSize(), GetId());
-            ProcessEvent(sz);
+            GetEventHandler()->ProcessEvent(sz);
         }
     }
 
         }
     }
 
@@ -378,7 +374,7 @@ bool wxListbook::DeleteAllPages()
     m_selection = -1;
 
     wxSizeEvent sz(GetSize(), GetId());
     m_selection = -1;
 
     wxSizeEvent sz(GetSize(), GetId());
-    ProcessEvent(sz);
+    GetEventHandler()->ProcessEvent(sz);
 
     return true;
 }
 
     return true;
 }
@@ -389,6 +385,12 @@ bool wxListbook::DeleteAllPages()
 
 void wxListbook::OnListSelected(wxListEvent& eventList)
 {
 
 void wxListbook::OnListSelected(wxListEvent& eventList)
 {
+    if ( eventList.GetEventObject() != m_bookctrl )
+    {
+        eventList.Skip();
+        return;
+    }
+
     const int selNew = eventList.GetIndex();
 
     if ( selNew == m_selection )
     const int selNew = eventList.GetIndex();
 
     if ( selNew == m_selection )