]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/listbox.cpp
added wxTB_HORZ_TEXT (patch 713813); documented it; moved toolbar styles to toolbar.h
[wxWidgets.git] / src / univ / listbox.cpp
index 725eafa5ec721fcc211e06ef094060a8589f41a0..4612caa01df895d24394c0cef4bc83d017e0b61b 100644 (file)
@@ -49,8 +49,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase)
     EVT_SIZE(wxListBox::OnSize)
-
-    EVT_IDLE(wxListBox::OnIdle)
 END_EVENT_TABLE()
 
 // ----------------------------------------------------------------------------
@@ -127,6 +125,8 @@ bool wxListBox::Create(wxWindow *parent,
 
 wxListBox::~wxListBox()
 {
+    // call this just to free the client data -- and avoid leaking memory
+    DoClear();
 }
 
 // ----------------------------------------------------------------------------
@@ -272,7 +272,8 @@ void wxListBox::Clear()
 
 void wxListBox::Delete(int n)
 {
-    wxCHECK_RET( n < GetCount(), _T("invalid index in wxListBox::Delete") );
+    wxCHECK_RET( n >= 0 && n < GetCount(),
+                 _T("invalid index in wxListBox::Delete") );
 
     // do it before removing the index as otherwise the last item will not be
     // refreshed (as GetCount() will be decremented)
@@ -598,7 +599,7 @@ void wxListBox::UpdateItems()
     }
 }
 
-void wxListBox::OnIdle(wxIdleEvent& event)
+void wxListBox::OnInternalIdle()
 {
     if ( m_updateScrollbarY || m_updateScrollbarX )
     {
@@ -621,8 +622,6 @@ void wxListBox::OnIdle(wxIdleEvent& event)
 
         m_updateCount = 0;
     }
-
-    event.Skip();
 }
 
 // ----------------------------------------------------------------------------
@@ -1007,7 +1006,7 @@ void wxListBox::ExtendSelection(int itemTo)
     }
 }
 
-void wxListBox::Select(bool sel, int item)
+void wxListBox::DoSelect(int item, bool sel)
 {
     if ( item != -1 )
     {
@@ -1027,7 +1026,7 @@ void wxListBox::Select(bool sel, int item)
 
 void wxListBox::SelectAndNotify(int item)
 {
-    Select(TRUE, item);
+    DoSelect(item);
 
     SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 }
@@ -1046,7 +1045,7 @@ void wxListBox::Activate(int item)
 
     if ( item != -1 )
     {
-        Select(TRUE, item);
+        DoSelect(item);
 
         SendEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
     }
@@ -1089,7 +1088,7 @@ bool wxListBox::PerformAction(const wxControlAction& action,
             item = m_current;
 
         if ( IsSelected(item) )
-            Unselect(item);
+            DoUnselect(item);
         else
             SelectAndNotify(item);
     }
@@ -1100,12 +1099,12 @@ bool wxListBox::PerformAction(const wxControlAction& action,
         if ( strArg.empty() )
             SelectAndNotify(item);
         else
-            Select(TRUE, item);
+            DoSelect(item);
     }
     else if ( action == wxACTION_LISTBOX_SELECTADD )
-        Select(TRUE, item);
+        DoSelect(item);
     else if ( action == wxACTION_LISTBOX_UNSELECT )
-        Select(FALSE, item);
+        DoUnselect(item);
     else if ( action == wxACTION_LISTBOX_MOVEDOWN )
         ChangeCurrent(1);
     else if ( action == wxACTION_LISTBOX_MOVEUP )