Add wxItemAttr::HasColours() and IsDefault() accessors

They are trivial but useful to have as testing for HasBackgroundColour() ||
HasTextColour() || HasFont() is too verbose.
This commit is contained in:
Vadim Zeitlin
2016-04-17 17:19:20 +02:00
parent c15f75b81d
commit e84053ed64
2 changed files with 16 additions and 1 deletions

View File

@@ -39,6 +39,9 @@ public:
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
bool HasColours() const { return HasTextColour() || HasBackgroundColour(); }
bool IsDefault() const { return !HasColours() && !HasFont(); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxFont& GetFont() const { return m_font; }

View File

@@ -17,7 +17,7 @@
@see @ref overview_listctrl
@since 3.1.1 (previous versions had the identical wxListItemAttr class)
@since 3.1.1 (previous versions had a similar wxListItemAttr class)
*/
class wxItemAttr
{
@@ -55,6 +55,13 @@ public:
*/
bool HasBackgroundColour() const;
/**
Returns @true if either text or background colour is set.
@see HasBackgroundColour(), HasTextColour()
*/
bool HasColours() const;
/**
Returns @true if the currently set font is valid.
*/
@@ -65,6 +72,11 @@ public:
*/
bool HasTextColour() const;
/**
Returns @true if this object has no custom attributes set.
*/
bool IsDefault() const;
/**
Sets a new background color.
*/