X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/37788684ba0dfe52d3b4f67e5c2dae521893bfff..cc4d5638c66a409e421420ed7110917755a66788:/src/common/lboxcmn.cpp?ds=inline diff --git a/src/common/lboxcmn.cpp b/src/common/lboxcmn.cpp index da8bc5f35d..2afe3f1b7b 100644 --- a/src/common/lboxcmn.cpp +++ b/src/common/lboxcmn.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 22.10.99 -// RCS-ID: $Id$ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -31,9 +30,10 @@ #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 @@ -89,8 +89,8 @@ wxEND_FLAGS( wxListBoxStyle ) wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl, "wx/listbox.h") wxBEGIN_PROPERTIES_TABLE(wxListBox) -wxEVENT_PROPERTY( Select, wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEvent ) -wxEVENT_PROPERTY( DoubleClick, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEvent ) +wxEVENT_PROPERTY( Select, wxEVT_LISTBOX, wxCommandEvent ) +wxEVENT_PROPERTY( DoubleClick, wxEVT_LISTBOX_DCLICK, wxCommandEvent ) wxPROPERTY( Font, wxFont, SetFont, GetFont , wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ wxT("Helpstring"), wxT("group")) @@ -166,6 +166,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. @@ -294,7 +302,7 @@ bool wxListBoxBase::CalcAndSendEvent() m_oldSelections = selections; - return SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED, item, selected); + return SendEvent(wxEVT_LISTBOX, item, selected); } // ----------------------------------------------------------------------------