Add equality operators to wxItemAttr

It can be necessary to compare two item attributes for equality, e.g. to check
if the attributes have changed, so provide a straightforward implementation of
equality and inequality operator for it.
This commit is contained in:
Vadim Zeitlin 2016-04-17 17:36:20 +02:00
parent c17f1d7888
commit dfb993274c
2 changed files with 21 additions and 0 deletions

View File

@ -28,6 +28,17 @@ public:
// default copy ctor, assignment operator and dtor are ok
bool operator==(const wxItemAttr& other) const
{
return m_colText == other.m_colText &&
m_colBack == other.m_colBack &&
m_font == other.m_font;
}
bool operator!=(const wxItemAttr& other) const
{
return !(*this == other);
}
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }

View File

@ -35,6 +35,16 @@ public:
const wxColour& colBack,
const wxFont& font);
/**
Compare two item attributes for equality.
*/
bool operator==(const wxItemAttr& other) const;
/**
Compare two item attributes for inequality.
*/
bool operator!=(const wxItemAttr& other) const;
/**
Returns the currently set background colour.
*/