From: Julian Smart Date: Wed, 4 Jan 2012 16:32:08 +0000 (+0000) Subject: Implement missing wxTextBoxAttr::IsDefault function X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/eb3d8a3319b51c8cf33fdd3e4b987b5181c23fdc?ds=sidebyside Implement missing wxTextBoxAttr::IsDefault function git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70266 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 38d75f16d1..7dbc4613c9 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -517,6 +517,12 @@ public: const wxTextAttrDimension& GetBottom() const { return m_bottom; } wxTextAttrDimension& GetBottom() { return m_bottom; } + /** + Are all dimensions valid? + + */ + bool IsValid() const { return m_left.IsValid() && m_top.IsValid() && m_right.IsValid() && m_bottom.IsValid(); } + wxTextAttrDimension m_left; wxTextAttrDimension m_top; wxTextAttrDimension m_right; diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h index c9c4b655cd..2b4bc29ff5 100644 --- a/interface/wx/richtext/richtextbuffer.h +++ b/interface/wx/richtext/richtextbuffer.h @@ -401,6 +401,12 @@ public: const wxTextAttrDimension& GetBottom() const { return m_bottom; } wxTextAttrDimension& GetBottom() { return m_bottom; } + /** + Are all dimensions valid? + + */ + bool IsValid() const { return m_left.IsValid() && m_top.IsValid() && m_right.IsValid() && m_bottom.IsValid(); } + wxTextAttrDimension m_left; wxTextAttrDimension m_top; wxTextAttrDimension m_right; diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index e00b70b9d0..d0d2fecb97 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -11016,6 +11016,13 @@ void wxTextBoxAttr::CollectCommonAttributes(const wxTextBoxAttr& attr, wxTextBox m_outline.CollectCommonAttributes(attr.m_outline, clashingAttr.m_outline, absentAttr.m_outline); } +bool wxTextBoxAttr::IsDefault() const +{ + return GetFlags() == 0 && !m_border.IsValid() && !m_outline.IsValid() && + !m_size.GetWidth().IsValid() && !m_size.GetHeight().IsValid() && + !m_position.IsValid() && !m_padding.IsValid() && !m_margins.IsValid(); +} + // wxRichTextAttr void wxRichTextAttr::Copy(const wxRichTextAttr& attr)