+ switch ( type )
+ {
+ case wxClientData_Object:
+ SetClientObject
+ (
+ pos,
+ (reinterpret_cast<wxClientData **>(clientData))[n]
+ );
+ break;
+
+ case wxClientData_Void:
+ SetClientData(pos, clientData[n]);
+ break;
+
+ default:
+ wxFAIL_MSG( wxT("unknown client data type") );
+ // fall through
+
+ case wxClientData_None:
+ // nothing to do
+ break;
+ }
+}
+
+void wxItemContainer::ResetItemClientObject(unsigned int n)
+{
+ 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);