+ int item = wxNOT_FOUND;
+ if ( selections.empty() )
+ {
+ // indicate that this is a deselection
+ event.SetExtraLong(0);
+ item = m_oldSelections[0];
+ }
+ else // we [still] have some selections
+ {
+ // Now test if any new item is selected
+ bool any_new_selected = false;
+ for ( size_t idx = 0; idx < countSel; idx++ )
+ {
+ item = selections[idx];
+ if ( m_oldSelections.Index(item) == wxNOT_FOUND )
+ {
+ any_new_selected = true;
+ break;
+ }
+ }
+
+ if ( any_new_selected )
+ {
+ // indicate that this is a selection
+ event.SetExtraLong(1);
+ }
+ else // no new items selected
+ {
+ // Now test if any new item is deselected
+ bool any_new_deselected = false;
+ for ( size_t idx = 0; idx < countSelOld; idx++ )
+ {
+ item = m_oldSelections[idx];
+ if ( selections.Index(item) == wxNOT_FOUND )
+ {
+ any_new_deselected = true;
+ break;
+ }
+ }
+
+ if ( any_new_deselected )
+ {
+ // indicate that this is a selection
+ event.SetExtraLong(0);
+ }
+ else
+ {
+ item = wxNOT_FOUND; // this should be impossible
+ }
+ }
+ }