From: Vadim Zeitlin Date: Thu, 22 Dec 2005 03:07:48 +0000 (+0000) Subject: don't overwrite the existing attributes when setting one new one, i.e. SetItemBackgro... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0f3888a5f82aae5fcbca1e5aff979d3ca2349381 don't overwrite the existing attributes when setting one new one, i.e. SetItemBackgroundColour() after SetItemTextColour() doesn't reset the text colour to default one any more git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 4972854909..ae0826d047 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -788,12 +788,15 @@ bool wxListCtrl::SetItem(wxListItem& info) data->lParam = info.m_data; // attributes - if (info.HasAttributes()) + if ( info.HasAttributes() ) { - if (data->attr) - *data->attr = *info.GetAttributes(); + const wxListItemAttr& attrNew = *info.GetAttributes(); + + // don't overwrite the already set attributes if we have them + if ( data->attr ) + data->attr->AssignFrom(attrNew); else - data->attr = new wxListItemAttr(*info.GetAttributes()); + data->attr = new wxListItemAttr(attrNew); }; };