Replace wxTreeItemAttr and wxListItemAttr with wxItemAttr

The two existing structs were completely identical, just replace them with a
single wxItemAttr.

Notice that wxDataViewItemAttr is not quite the same, although pretty similar,
so it remains separate for now. It would be nice to combine it with this one
too in the future, e.g. to make it simpler to make items bold in a wxListCtrl.
This commit is contained in:
Vadim Zeitlin
2016-04-16 17:44:19 +02:00
parent c592363e95
commit 246ae58c19
24 changed files with 232 additions and 221 deletions

View File

@@ -39,6 +39,7 @@
#include "wx/msw/private.h"
#include "wx/imaglist.h"
#include "wx/itemattr.h"
#include "wx/msw/dragimag.h"
#include "wx/msw/uxtheme.h"
@@ -1146,14 +1147,14 @@ void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item,
{
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxTreeItemAttr *attr;
wxItemAttr *attr;
wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem);
if ( it == m_attrs.end() )
{
m_hasAnyAttr = true;
m_attrs[item.m_pItem] =
attr = new wxTreeItemAttr;
attr = new wxItemAttr;
}
else
{
@@ -1170,14 +1171,14 @@ void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item,
{
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxTreeItemAttr *attr;
wxItemAttr *attr;
wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem);
if ( it == m_attrs.end() )
{
m_hasAnyAttr = true;
m_attrs[item.m_pItem] =
attr = new wxTreeItemAttr;
attr = new wxItemAttr;
}
else // already in the hash
{
@@ -1193,14 +1194,14 @@ void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
{
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxTreeItemAttr *attr;
wxItemAttr *attr;
wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem);
if ( it == m_attrs.end() )
{
m_hasAnyAttr = true;
m_attrs[item.m_pItem] =
attr = new wxTreeItemAttr;
attr = new wxItemAttr;
}
else // already in the hash
{
@@ -3550,7 +3551,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
break;
}
wxTreeItemAttr * const attr = it->second;
wxItemAttr * const attr = it->second;
wxTreeViewItem tvItem((void *)nmcd.dwItemSpec,
TVIF_STATE, TVIS_DROPHILITED);