+ 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 wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
+{
+ wxListEvent event(wxEVT_NULL, m_windowId);
+ wxEventType eventType = wxEVT_NULL;
+ NMHDR *hdr1 = (NMHDR *) lParam;
+ switch ( hdr1->code )
+ {
+ case LVN_BEGINRDRAG:
+ eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
+ // fall through
+
+ case LVN_BEGINDRAG:
+ if ( eventType == wxEVT_NULL )
+ {
+ eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
+ }
+
+ {
+ NM_LISTVIEW *hdr = (NM_LISTVIEW *)lParam;
+ event.m_itemIndex = hdr->iItem;
+ event.m_pointDrag.x = hdr->ptAction.x;
+ event.m_pointDrag.y = hdr->ptAction.y;
+ }
+ break;
+
+ case LVN_BEGINLABELEDIT:
+ {
+ eventType = wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
+ LV_DISPINFO *info = (LV_DISPINFO *)lParam;
+ wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd());
+ break;
+ }
+
+ case LVN_COLUMNCLICK:
+ {
+ eventType = wxEVT_COMMAND_LIST_COL_CLICK;
+ NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
+ event.m_itemIndex = -1;
+ event.m_col = hdr->iSubItem;
+ break;
+ }
+
+ case LVN_DELETEALLITEMS:
+ // what's the sense of generating a wxWin event for this when
+ // it's absolutely not portable?
+#if 0
+ eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
+ event.m_itemIndex = -1;
+#endif // 0
+
+ // return TRUE to suppress all additional LVN_DELETEITEM
+ // notifications - this makes deleting all items from a list ctrl
+ // much faster
+ *result = TRUE;
+ return TRUE;
+
+ case LVN_DELETEITEM:
+ {
+ eventType = wxEVT_COMMAND_LIST_DELETE_ITEM;
+ NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
+ event.m_itemIndex = hdr->iItem;
+ break;
+ }
+ case LVN_ENDLABELEDIT:
+ {
+ eventType = wxEVT_COMMAND_LIST_END_LABEL_EDIT;
+ LV_DISPINFO *info = (LV_DISPINFO *)lParam;
+ wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd());
+ if ( info->item.pszText == NULL || info->item.iItem == -1 )
+ event.m_cancelled = TRUE;
+ break;
+ }
+ case LVN_GETDISPINFO:
+ return FALSE;
+
+ // this provokes stack overflow: indeed, wxConvertFromMSWListItem()
+ // sends us WM_NOTIFY! As it doesn't do anything for now, just leave
+ // it out.
+#if 0
+ {
+ // TODO: some text buffering here, I think
+ // TODO: API for getting Windows to retrieve values
+ // on demand.
+ eventType = wxEVT_COMMAND_LIST_GET_INFO;
+ LV_DISPINFO *info = (LV_DISPINFO *)lParam;
+ wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd());
+ break;
+ }
+#endif // 0
+
+ case LVN_INSERTITEM:
+ {
+ eventType = wxEVT_COMMAND_LIST_INSERT_ITEM;
+ NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
+ event.m_itemIndex = hdr->iItem;
+ break;
+ }
+ case LVN_ITEMCHANGED:
+ {
+ // This needs to be sent to wxListCtrl as a rather more
+ // concrete event. For now, just detect a selection
+ // or deselection.
+ NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
+ if ( (hdr->uNewState & LVIS_SELECTED) && !(hdr->uOldState & LVIS_SELECTED) )
+ {
+ eventType = wxEVT_COMMAND_LIST_ITEM_SELECTED;
+ event.m_itemIndex = hdr->iItem;
+ }
+ else if ( !(hdr->uNewState & LVIS_SELECTED) && (hdr->uOldState & LVIS_SELECTED) )
+ {
+ eventType = wxEVT_COMMAND_LIST_ITEM_DESELECTED;
+ event.m_itemIndex = hdr->iItem;
+ }
+ else
+ return FALSE;
+ break;
+ }
+
+ case LVN_KEYDOWN:
+ {
+ LV_KEYDOWN *info = (LV_KEYDOWN *)lParam;
+ WORD wVKey = info->wVKey;
+
+ // get the current selection
+ long lItem = GetNextItem(-1,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
+
+ // <Enter> or <Space> activate the selected item if any
+ if ( lItem != -1 && (wVKey == VK_RETURN || wVKey == VK_SPACE) )
+ {
+ // TODO this behaviour probably should be optional
+ eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
+ event.m_itemIndex = lItem;
+ }
+ else
+ {
+ eventType = wxEVT_COMMAND_LIST_KEY_DOWN;
+ event.m_code = wxCharCodeMSWToWX(wVKey);
+ }
+ break;
+ }
+
+ case NM_DBLCLK:
+ // if the user processes it in wxEVT_COMMAND_LEFT_CLICK(), don't do
+ // anything else
+ if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
+ {
+ return TRUE;
+ }
+
+ // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event
+ eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
+ break;
+
+ case LVN_SETDISPINFO:
+ {
+ eventType = wxEVT_COMMAND_LIST_SET_INFO;
+ LV_DISPINFO *info = (LV_DISPINFO *)lParam;
+ wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd());
+ break;
+ }
+
+ default:
+ return wxControl::MSWOnNotify(idCtrl, lParam, result);
+ }
+