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:
parent
c17f1d7888
commit
dfb993274c
@ -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; }
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user