From e84053ed641b8d3634662faef53a0b7803f6a11b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Apr 2016 17:19:20 +0200 Subject: [PATCH] Add wxItemAttr::HasColours() and IsDefault() accessors They are trivial but useful to have as testing for HasBackgroundColour() || HasTextColour() || HasFont() is too verbose. --- include/wx/itemattr.h | 3 +++ interface/wx/itemattr.h | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/wx/itemattr.h b/include/wx/itemattr.h index 90ae149d85..3a77cdaded 100644 --- a/include/wx/itemattr.h +++ b/include/wx/itemattr.h @@ -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; } diff --git a/interface/wx/itemattr.h b/interface/wx/itemattr.h index 49e72bd510..d47c618e68 100644 --- a/interface/wx/itemattr.h +++ b/interface/wx/itemattr.h @@ -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. */