+
+ default:
+ wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
+ }
+
+ bool bOk = TreeView_Expand((HWND)GetHWND(), (HTREEITEM)item, mswAction) != 0;
+
+ // TreeView_Expand doesn't send TVN_EXPAND(ING) 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);