- event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
- : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
- GetEventHandler()->ProcessEvent(event);
- }
+ // May not send messages, so emulate them
+ if ( bOk )
+ {
+ wxTreeEvent event(wxEVT_NULL, m_windowId);
+ event.m_item.m_itemId = item;
+ event.m_item.m_mask = event.m_item.m_stateMask = 0xFFFF; // get all
+ GetItem(event.m_item);
+
+ bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
+
+ event.m_code = action;
+ event.SetEventObject(this);
+
+ // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
+ event.SetEventType(
+ bIsExpanded
+ ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
+ : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
+ GetEventHandler()->ProcessEvent(event);
+
+ event.SetEventType(
+ bIsExpanded
+ ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
+ : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
+ GetEventHandler()->ProcessEvent(event);
+ }