- const int index = GetSelection();
- if ( !DoChangeSingleSelection(index) )
- return;
-
- wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId() );
- event.SetEventObject( this );
-
- if (index == wxNOT_FOUND)
- {
- // indicate that this is a deselection
- event.SetExtraLong( 0 );
- event.SetInt( -1 );
-
- HandleWindowEvent( event );
-
- return;
- }
- else
- {
- GtkTreeEntry* entry = GTKGetEntry( index );
-
- // indicate that this is a selection
- event.SetExtraLong( 1 );
-
- event.SetInt( index );
- event.SetString(wxConvUTF8.cMB2WX(gtk_tree_entry_get_label(entry)));
-
- if ( HasClientObjectData() )
- event.SetClientObject(
- (wxClientData*) gtk_tree_entry_get_userdata(entry)
- );
- else if ( HasClientUntypedData() )
- event.SetClientData( gtk_tree_entry_get_userdata(entry) );
-
- HandleWindowEvent( event );
-
- g_object_unref (entry);
- }
+ const int item = GetSelection();
+ if ( DoChangeSingleSelection(item) )
+ SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED, item, true);