X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cb0f56f97868a8309275d87e3b4b63fb0f68d4ce..47f12f58dbd5e62c5d1c635142a26c3e2208d012:/src/msw/listctrl.cpp?ds=inline diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index d49a287745..e6a6f0f08e 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -497,11 +497,7 @@ wxTextCtrl* wxListCtrl::GetEditControl(void) const bool wxListCtrl::GetItem(wxListItem& info) const { LV_ITEM lvItem; -#ifdef __GNUWIN32__ - memset(&lvItem, 0, sizeof(lvItem)); -#else - ZeroMemory(&lvItem, sizeof(lvItem)); // must set all fields to 0 -#endif + wxZeroMemory(lvItem); lvItem.iItem = info.m_itemId; lvItem.iSubItem = info.m_col; @@ -1256,9 +1252,9 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { eventType = wxEVT_COMMAND_LIST_END_LABEL_EDIT; LV_DISPINFO *info = (LV_DISPINFO *)lParam; - wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd()); + wxConvertFromMSWListItem(this, event.m_item, info->item); if ( info->item.pszText == NULL || info->item.iItem == -1 ) - event.m_cancelled = TRUE; + return FALSE; break; } case LVN_GETDISPINFO: @@ -1341,7 +1337,11 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event - eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; + { + eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; + NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam; + event.m_itemIndex = hdr->iItem; + } break; case NM_RCLICK: @@ -1358,11 +1358,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // else translate it into wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event LV_HITTESTINFO lvhti; -#ifdef __GNUWIN32__ - memset(&lvhti,0,sizeof(LV_HITTESTINFO)); -#else - ZeroMemory(&lvhti, sizeof(LV_HITTESTINFO)); // must set all fields to 0 -#endif + wxZeroMemory(lvhti); + ::GetCursorPos(&(lvhti.pt)); ::ScreenToClient(GetHwnd(),&(lvhti.pt)); if ( ListView_HitTest(GetHwnd(),&lvhti) != -1 ) @@ -1417,18 +1414,29 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( !GetEventHandler()->ProcessEvent(event) ) return FALSE; - if ( (int)hdr1->code == LVN_GETDISPINFO) + switch ((int)hdr1->code) { - LV_DISPINFO *info = (LV_DISPINFO *)lParam; - if ( info->item.mask & LVIF_TEXT ) - { - if ( !event.m_item.m_text.IsNull() ) + case LVN_GETDISPINFO: { - info->item.pszText = AddPool(event.m_item.m_text); - info->item.cchTextMax = wxStrlen(info->item.pszText) + 1; + LV_DISPINFO *info = (LV_DISPINFO *)lParam; + if ( info->item.mask & LVIF_TEXT ) + { + if ( !event.m_item.m_text.IsNull() ) + { + info->item.pszText = AddPool(event.m_item.m_text); + info->item.cchTextMax = wxStrlen(info->item.pszText) + 1; + } + } + // wxConvertToMSWListItem(this, event.m_item, info->item); + break; } - } - // wxConvertToMSWListItem(this, event.m_item, info->item); + case LVN_ENDLABELEDIT: + { + *result = event.IsAllowed(); + return TRUE; + } + default: + break; } *result = !event.IsAllowed();