]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/lboxcmn.cpp
supporting promised file urls for transfer, see #14281
[wxWidgets.git] / src / common / lboxcmn.cpp
index 7e8b2be8e4d689d2e6411e44780997e8326ec9be..0e1d05019365d2c6bad19c5782992dc6135085fe 100644 (file)
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/arrstr.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
+extern WXDLLEXPORT_DATA(const char) wxListBoxNameStr[] = "listBox";
 
 // ============================================================================
 // implementation
@@ -86,7 +87,7 @@ wxFLAGS_MEMBER(wxLB_NEEDED_SB)
 wxFLAGS_MEMBER(wxLB_SORT)
 wxEND_FLAGS( wxListBoxStyle )
 
-wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControlWithItems, "wx/listbox.h")
+wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl, "wx/listbox.h")
 
 wxBEGIN_PROPERTIES_TABLE(wxListBox)
 wxEVENT_PROPERTY( Select, wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEvent )
@@ -166,6 +167,14 @@ void wxListBoxBase::DeselectAll(int itemToLeaveSelected)
 
 void wxListBoxBase::UpdateOldSelections()
 {
+    // When the control becomes empty, any previously remembered selections are
+    // invalid anyhow, so just forget them.
+    if ( IsEmpty() )
+    {
+        m_oldSelections.clear();
+        return;
+    }
+
     // We need to remember the selection even in single-selection case on
     // Windows, so that we don't send an event when the user clicks on an
     // already selected item.