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:
@@ -28,6 +28,17 @@ public:
|
|||||||
|
|
||||||
// default copy ctor, assignment operator and dtor are ok
|
// 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
|
// setters
|
||||||
void SetTextColour(const wxColour& colText) { m_colText = colText; }
|
void SetTextColour(const wxColour& colText) { m_colText = colText; }
|
||||||
|
@@ -35,6 +35,16 @@ public:
|
|||||||
const wxColour& colBack,
|
const wxColour& colBack,
|
||||||
const wxFont& font);
|
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.
|
Returns the currently set background colour.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user