- if (cmd == EN_UPDATE)
- {
- wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, id);
- event.SetEventObject( this );
- ProcessCommand(event);
- return TRUE;
- }
- else if (cmd == EN_KILLFOCUS)
- {
- wxCommandEvent event(wxEVT_KILL_FOCUS, id);
- event.SetEventObject( this );
- ProcessCommand(event);
- return TRUE;
- }
- else return FALSE;
-}
-
-bool wxTreeCtrl::MSWNotify(const WXWPARAM wParam, const WXLPARAM lParam)
-{
- wxTreeEvent event(wxEVT_NULL, m_windowId);
- wxEventType eventType = wxEVT_NULL;
- NMHDR* hdr1 = (NMHDR*) lParam;
- switch ( hdr1->code )
- {
- case TVN_BEGINDRAG:
- {
- eventType = wxEVT_COMMAND_TREE_BEGIN_DRAG;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemNew, (HWND) GetHWND());
- event.m_pointDrag.x = hdr->ptDrag.x;
- event.m_pointDrag.y = hdr->ptDrag.y;
- break;
- }
- case TVN_BEGINLABELEDIT:
- {
- eventType = wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT;
- TV_DISPINFO *info = (TV_DISPINFO *)lParam;
- wxConvertFromMSWTreeItem(event.m_item, info->item, (HWND) GetHWND());
- break;
- }
- case TVN_BEGINRDRAG:
- {
- eventType = wxEVT_COMMAND_TREE_BEGIN_RDRAG;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemNew, (HWND) GetHWND());
- event.m_pointDrag.x = hdr->ptDrag.x;
- event.m_pointDrag.y = hdr->ptDrag.y;
- break;
- }
- case TVN_DELETEITEM:
- {
- eventType = wxEVT_COMMAND_TREE_DELETE_ITEM;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemOld, (HWND) GetHWND());
- event.m_pointDrag.x = hdr->ptDrag.x;
- event.m_pointDrag.y = hdr->ptDrag.y;
- break;
- }
- case TVN_ENDLABELEDIT:
- {
- eventType = wxEVT_COMMAND_TREE_END_LABEL_EDIT;
- TV_DISPINFO *info = (TV_DISPINFO *)lParam;
- wxConvertFromMSWTreeItem(event.m_item, info->item, (HWND) GetHWND());
- break;
- }
- case TVN_GETDISPINFO:
- {
- eventType = wxEVT_COMMAND_TREE_GET_INFO;
- TV_DISPINFO *info = (TV_DISPINFO *)lParam;
- wxConvertFromMSWTreeItem(event.m_item, info->item, (HWND) GetHWND());
- break;
- }
- case TVN_ITEMEXPANDING:
- {
- eventType = wxEVT_COMMAND_TREE_ITEM_EXPANDING;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemNew, (HWND) GetHWND());
-
- switch ( hdr->action )
- {
- case TVE_EXPAND:
- event.m_code = wxTREE_EXPAND_EXPAND;
- break;
- case TVE_COLLAPSE:
- event.m_code = wxTREE_EXPAND_COLLAPSE;
- case TVE_COLLAPSERESET:
- event.m_code = wxTREE_EXPAND_COLLAPSE_RESET;
- case TVE_TOGGLE:
- event.m_code = wxTREE_EXPAND_TOGGLE;
- break;
- default :
- break;
- }
- break;
- }
- case TVN_ITEMEXPANDED:
- {
- eventType = wxEVT_COMMAND_TREE_ITEM_EXPANDED;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemNew, (HWND) GetHWND());
- switch ( hdr->action )
- {
- case TVE_EXPAND:
- event.m_code = wxTREE_EXPAND_EXPAND;
- break;
- case TVE_COLLAPSE:
- event.m_code = wxTREE_EXPAND_COLLAPSE;
- case TVE_COLLAPSERESET:
- event.m_code = wxTREE_EXPAND_COLLAPSE_RESET;
- case TVE_TOGGLE:
- event.m_code = wxTREE_EXPAND_TOGGLE;
- break;
- default :
- break;
- }
- break;
- }
- case TVN_KEYDOWN:
- {
- eventType = wxEVT_COMMAND_TREE_KEY_DOWN;
- TV_KEYDOWN *info = (TV_KEYDOWN *)lParam;
- event.m_code = wxCharCodeMSWToWX(info->wVKey);
- break;
- }
- case TVN_SELCHANGED:
- {
- eventType = wxEVT_COMMAND_TREE_SEL_CHANGED;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemNew, (HWND) GetHWND());
- event.m_oldItem = (long) hdr->itemNew.hItem;
-
- break;
- }
- case TVN_SELCHANGING:
- {
- eventType = wxEVT_COMMAND_TREE_SEL_CHANGING;
- NM_TREEVIEW* hdr = (NM_TREEVIEW*)lParam;
- wxConvertFromMSWTreeItem(event.m_item, hdr->itemNew, (HWND) GetHWND());
- event.m_oldItem = (long) hdr->itemNew.hItem;
- break;
- }
- case TVN_SETDISPINFO:
- {
- eventType = wxEVT_COMMAND_TREE_SET_INFO;
- TV_DISPINFO *info = (TV_DISPINFO *)lParam;
- wxConvertFromMSWTreeItem(event.m_item, info->item, (HWND) GetHWND());
- break;
- }
-
- default :
- return wxControl::MSWNotify(wParam, lParam);
- break;
- }
-
- event.SetEventObject( this );
- event.SetEventType(eventType);
-
- if ( !GetEventHandler()->ProcessEvent(event) )
- return FALSE;
-
- if (hdr1->code == TVN_GETDISPINFO)
- {
- TV_DISPINFO *info = (TV_DISPINFO *)lParam;
- wxConvertToMSWTreeItem(event.m_item, info->item);
- }