+ case NM_CLICK:
+ {
+ DWORD pos = GetMessagePos();
+ POINT point;
+ point.x = LOWORD(pos);
+ point.y = HIWORD(pos);
+ ::MapWindowPoints(HWND_DESKTOP, GetHwnd(), &point, 1);
+ int flags = 0;
+ wxTreeItemId item = HitTest(wxPoint(point.x, point.y), flags);
+ if (flags & wxTREE_HITTEST_ONITEMSTATEICON)
+ {
+ event.m_item = item;
+ eventType = wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK;
+ }
+ break;
+ }
+
+ case NM_DBLCLK:
+ case NM_RCLICK:
+ {
+ TV_HITTESTINFO tvhti;
+ ::GetCursorPos(&tvhti.pt);
+ ::ScreenToClient(GetHwnd(), &tvhti.pt);
+ if ( TreeView_HitTest(GetHwnd(), &tvhti) )
+ {
+ if ( tvhti.flags & TVHT_ONITEM )
+ {
+ event.m_item = tvhti.hItem;
+ eventType = (int)hdr->code == NM_DBLCLK
+ ? wxEVT_COMMAND_TREE_ITEM_ACTIVATED
+ : wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK;
+
+ event.m_pointDrag.x = tvhti.pt.x;
+ event.m_pointDrag.y = tvhti.pt.y;
+ }
+
+ break;
+ }
+ }
+ // fall through
+