From e5f9b9cfad4937d37d0aec2c21bd92625eff54d8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 31 May 2014 14:21:16 +0000 Subject: [PATCH] Return all information from wxListCtrl::GetItem() if no mask specified. This is more useful than returning nothing and is consistent with the generic version behaviour. Closes #3666. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index f2cb4e3b38..b94db2a626 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -727,7 +727,11 @@ bool wxListCtrl::GetItem(wxListItem& info) const lvItem.iItem = info.m_itemId; lvItem.iSubItem = info.m_col; - if ( info.m_mask & wxLIST_MASK_TEXT ) + // If no mask is specified, get everything: this is compatible with the + // generic version and conforms to the principle of least surprise. + const long mask = info.m_mask ? info.m_mask : -1; + + if ( mask & wxLIST_MASK_TEXT ) { lvItem.mask |= LVIF_TEXT; lvItem.pszText = new wxChar[513]; @@ -738,13 +742,13 @@ bool wxListCtrl::GetItem(wxListItem& info) const lvItem.pszText = NULL; } - if (info.m_mask & wxLIST_MASK_DATA) + if ( mask & wxLIST_MASK_DATA ) lvItem.mask |= LVIF_PARAM; - if (info.m_mask & wxLIST_MASK_IMAGE) + if ( mask & wxLIST_MASK_IMAGE ) lvItem.mask |= LVIF_IMAGE; - if ( info.m_mask & wxLIST_MASK_STATE ) + if ( mask & wxLIST_MASK_STATE ) { lvItem.mask |= LVIF_STATE; wxConvertToMSWFlags(0, info.m_stateMask, lvItem);