Don't send selection events for an already selected item in wxMSW wxListBox.

Remember the last item for which a listbox notification event had been sent
and don't send it again if the user clicks on an already selected item. This
is consistent with wxGTK behaviour and generally makes more sense: why should
we send an event if the selection didn't really change?

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-06-05 22:58:13 +00:00
parent f186bd4d40
commit c07b0669cf
2 changed files with 31 additions and 4 deletions

View File

@@ -101,9 +101,6 @@ public:
// send the appropriate event if they differ, otherwise just return false.
bool CalcAndSendEvent();
wxArrayInt m_oldSelections;
void UpdateOldSelections();
protected:
virtual void DoSetFirstItem(int n) = 0;
@@ -118,6 +115,16 @@ protected:
// Returns true if the event was processed.
bool SendEvent(wxEventType evtType, int item, bool selected);
// Array storing the indices of all selected items that we already notified
// the user code about for multi selection list boxes.
//
// TODO-OPT: wxSelectionStore would be more efficient for big list boxes.
wxArrayInt m_oldSelections;
// Update m_oldSelections with currently selected items (does nothing in
// single selection mode).
void UpdateOldSelections();
private:
wxDECLARE_NO_COPY_CLASS(wxListBoxBase);
};