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
This commit is contained in:
Vadim Zeitlin 2014-05-31 14:21:16 +00:00
parent 21fd108d23
commit e5f9b9cfad

View File

@ -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);