X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/98ec9dbebc5584ba1b903d314b25e8c562891483..0cd7d9b2355834dfabd0faeab0c5e812ebc3905a:/src/msw/listctrl.cpp?ds=sidebyside diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 191b98c91a..d5bd89601f 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -64,6 +64,10 @@ #define LVS_EX_FULLROWSELECT 0x00000020 #endif +#ifndef LVS_OWNERDATA + #define LVS_OWNERDATA 0x1000 +#endif + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -301,8 +305,8 @@ wxListCtrl::~wxListCtrl() if ( m_textCtrl ) { - m_textCtrl->UnsubclassWin(); m_textCtrl->SetHWND(0); + m_textCtrl->UnsubclassWin(); delete m_textCtrl; m_textCtrl = NULL; } @@ -452,6 +456,16 @@ long wxListCtrl::ConvertToMSWStyle(long& oldStyle, long style) const if ( style & wxLC_VIRTUAL ) { + int ver = wxTheApp->GetComCtl32Version(); + if ( ver < 470 ) + { + wxLogWarning(_("Please install a newer version of comctl32.dll\n" + "(at least version 4.70 is required but you have " + "%d.%02d)\n" + "or this program won't operate correctly."), + ver / 100, ver % 100); + } + wstyle |= LVS_OWNERDATA; } @@ -1058,8 +1072,8 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) if (m_textCtrl) { - m_textCtrl->UnsubclassWin(); m_textCtrl->SetHWND(0); + m_textCtrl->UnsubclassWin(); delete m_textCtrl; m_textCtrl = NULL; } @@ -1074,29 +1088,15 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) // End label editing, optionally cancelling the edit bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel)) { - wxFAIL; - - /* I don't know how to implement this: there's no such macro as ListView_EndEditLabelNow. - * ??? - bool success = (ListView_EndEditLabelNow(GetHwnd(), cancel) != 0); - - if (m_textCtrl) - { - m_textCtrl->UnsubclassWin(); - m_textCtrl->SetHWND(0); - delete m_textCtrl; - m_textCtrl = NULL; - } - return success; - */ + wxFAIL_MSG( _T("not implemented") ); + return FALSE; } - // Ensures this item is visible bool wxListCtrl::EnsureVisible(long item) { - return (ListView_EnsureVisible(GetHwnd(), (int) item, FALSE) != 0); + return ListView_EnsureVisible(GetHwnd(), (int) item, FALSE) != 0; } // Find an item whose label matches this string, starting from the item after 'start' @@ -1408,6 +1408,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT; LV_DISPINFO *info = (LV_DISPINFO *)lParam; wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd()); + event.m_itemIndex = event.m_item.m_itemId; } break; @@ -1442,6 +1443,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxConvertFromMSWListItem(this, event.m_item, info->item); if ( info->item.pszText == NULL || info->item.iItem == -1 ) return FALSE; + + event.m_itemIndex = event.m_item.m_itemId; } break; @@ -1495,7 +1498,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) !(wxIsShiftDown() || wxIsCtrlDown()) ) { eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; - event.m_itemIndex = lItem; } else { @@ -1503,6 +1505,9 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_code = wxCharCodeMSWToWX(wVKey); } + event.m_itemIndex = + event.m_item.m_itemId = lItem; + if ( lItem != -1 ) { // fill the other fields too