- wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
- event.m_item = item;
- event.m_code = 0;
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent( event );
+ // here we process only the messages which happen on tree items
+
+ m_dragCount = 0;
+
+ if (item == NULL) return; /* we hit the blank area */
+
+ if ( event.RightDown() )
+ {
+ wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
+ nevent.m_item = item;
+ nevent.m_code = 0;
+ nevent.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(nevent);
+ }
+ else if ( event.LeftUp() && (item == m_current) &&
+ (flags & wxTREE_HITTEST_ONITEMLABEL) &&
+ HasFlag(wxTR_EDIT_LABELS) )
+ {
+ m_renameTimer->Start( 100, TRUE );
+ }
+ else
+ {
+ // how should the selection work for this event?
+ bool is_multiple, extended_select, unselect_others;
+ EventFlagsToSelType(GetWindowStyleFlag(),
+ event.ShiftDown(),
+ event.ControlDown(),
+ &is_multiple, &extended_select, &unselect_others);
+
+ if ( onButton )
+ {
+ Toggle( item );
+ if ( is_multiple )
+ return;
+ }
+
+ SelectItem(item, unselect_others, extended_select);
+
+ if ( event.LeftDClick() )
+ {
+ wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
+ nevent.m_item = item;
+ nevent.m_code = 0;
+ nevent.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( nevent );
+ }
+ }