From 82ab1ab113009207bb21001e904345dcbfcc9456 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 16 Jan 2012 13:37:18 +0000 Subject: [PATCH] Only return the requested data from generic wxListCtrl::GetItem(). For compatibility with MSW, only return the data that was requested by the item mask from wxListCtrl::GetItem(). This harmonizes the behaviour between all ports. Closes #1621. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70368 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 4fd503c7ce..2b1a22df1e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -342,12 +342,23 @@ bool wxListHeaderData::IsHit( int x, int y ) const void wxListHeaderData::GetItem( wxListItem& item ) { - item.m_mask = m_mask; - item.m_text = m_text; - item.m_image = m_image; - item.m_format = m_format; - item.m_width = m_width; - item.m_state = m_state; + long mask = item.m_mask; + if ( !mask ) + { + // by default, get everything for backwards compatibility + mask = -1; + } + + if ( mask & wxLIST_MASK_STATE ) + item.m_state = m_state; + if ( mask & wxLIST_MASK_TEXT ) + item.m_text = m_text; + if ( mask & wxLIST_MASK_IMAGE ) + item.m_image = m_image; + if ( mask & wxLIST_MASK_WIDTH ) + item.m_width = m_width; + if ( mask & wxLIST_MASK_FORMAT ) + item.m_format = m_format; } int wxListHeaderData::GetImage() const -- 2.45.2