+ wxClientData * const data = GetClientObject(n);
+ if ( data )
+ {
+ delete data;
+ DoSetItemClientData(n, NULL);
+ }
+}
+
+// ============================================================================
+// wxControlWithItems implementation
+// ============================================================================
+
+void
+wxControlWithItemsBase::InitCommandEventWithItems(wxCommandEvent& event, int n)
+{
+ InitCommandEvent(event);
+
+ if ( n != wxNOT_FOUND )
+ {
+ if ( HasClientObjectData() )
+ event.SetClientObject(GetClientObject(n));
+ else if ( HasClientUntypedData() )
+ event.SetClientData(GetClientData(n));
+ }
+}
+
+void wxControlWithItemsBase::SendSelectionChangedEvent(wxEventType eventType)
+{
+ const int n = GetSelection();
+ if ( n == wxNOT_FOUND )
+ return;
+
+ wxCommandEvent event(eventType, m_windowId);
+ event.SetInt(n);
+ event.SetEventObject(this);
+ event.SetString(GetStringSelection());
+ InitCommandEventWithItems(event, n);
+
+ HandleWindowEvent(event);