diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index b4967e6d8d..2cf636a420 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -946,6 +946,11 @@ public: */ void MakeValid() { m_borderWidth.SetValid(true); } + /** + True if the border has no attributes set. + */ + bool IsDefault() const { return (m_flags == 0); } + /** Returns the border flags. */ @@ -1054,10 +1059,15 @@ public: void CollectCommonAttributes(const wxTextAttrBorders& attr, wxTextAttrBorders& clashingAttr, wxTextAttrBorders& absentAttr); /** - Returns @true if all borders are valid. + Returns @true if at least one border is valid. */ bool IsValid() const { return m_left.IsValid() || m_right.IsValid() || m_top.IsValid() || m_bottom.IsValid(); } + /** + Returns @true if no border attributes were set. + */ + bool IsDefault() const { return m_left.IsDefault() && m_right.IsDefault() && m_top.IsDefault() && m_bottom.IsDefault(); } + /** Returns the left border. */ diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h index ff209d478b..b60d9f5a15 100644 --- a/interface/wx/richtext/richtextbuffer.h +++ b/interface/wx/richtext/richtextbuffer.h @@ -793,6 +793,11 @@ public: */ bool IsValid() const { return HasWidth(); } + /** + True if the border has no attributes set. + */ + bool IsDefault() const { return (m_flags == 0); } + /** Set the valid flag for this border. */ @@ -906,7 +911,7 @@ public: void CollectCommonAttributes(const wxTextAttrBorders& attr, wxTextAttrBorders& clashingAttr, wxTextAttrBorders& absentAttr); /** - Returns @true if all borders are valid. + Returns @true if at least one border is valid. */ bool IsValid() const { return m_left.IsValid() || m_right.IsValid() || m_top.IsValid() || m_bottom.IsValid(); } diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index ff86543cde..f17f174c46 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -13145,7 +13145,7 @@ void wxTextBoxAttr::CollectCommonAttributes(const wxTextBoxAttr& attr, wxTextBox bool wxTextBoxAttr::IsDefault() const { - return GetFlags() == 0 && !m_border.IsValid() && !m_outline.IsValid() && + return GetFlags() == 0 && m_border.IsDefault() && m_outline.IsDefault() && !m_size.IsValid() && !m_minSize.IsValid() && !m_maxSize.IsValid() && !m_position.IsValid() && !m_padding.IsValid() && !m_margins.IsValid(); }