X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3b2cb4316b4deca34ae451493449e97e4bdb3f3b..c3008402f72bf26f81fb54d9737fa06d9ca0c3c8:/include/wx/richtext/richtextbuffer.h diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index aaefaa3ccd..38c3b901c0 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -263,6 +263,7 @@ class WXDLLIMPEXP_RICHTEXT wxTextAttrEx: public wxTextAttr public: // ctors wxTextAttrEx(const wxTextAttrEx& attr); + wxTextAttrEx(const wxTextAttr& attr) { Init(); (*this) = attr; } wxTextAttrEx() { Init(); } // Initialise this object. @@ -293,6 +294,12 @@ public: int GetBulletNumber() const { return m_bulletNumber; } wxChar GetBulletSymbol() const { return m_bulletSymbol; } + bool HasWeight() const { return (GetFlags() & wxTEXT_ATTR_FONT_WEIGHT) != 0; } + bool HasSize() const { return (GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0; } + bool HasItalic() const { return (GetFlags() & wxTEXT_ATTR_FONT_ITALIC) != 0; } + bool HasUnderlined() const { return (GetFlags() & wxTEXT_ATTR_FONT_UNDERLINE) != 0; } + bool HasFaceName() const { return (GetFlags() & wxTEXT_ATTR_FONT_FACE) != 0; } + bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); } bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); } bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); } @@ -316,6 +323,14 @@ public: !HasParagraphSpacingAfter() && !HasParagraphSpacingBefore() && !HasLineSpacing() && !HasCharacterStyleName() && !HasParagraphStyleName() && !HasBulletNumber() && !HasBulletStyle() && !HasBulletSymbol(); } + + // return the attribute having the valid font and colours: it uses the + // attributes set in attr and falls back first to attrDefault and then to + // the text control font/colours for those attributes which are not set + static wxTextAttrEx CombineEx(const wxTextAttrEx& attr, + const wxTextAttrEx& attrDef, + const wxTextCtrlBase *text); + private: // Paragraph styles int m_paragraphSpacingAfter; @@ -457,6 +472,12 @@ public: !HasCharacterStyleName() && !HasParagraphStyleName() && !HasBulletNumber() && !HasBulletStyle() && !HasBulletSymbol(); } + // return the attribute having the valid font and colours: it uses the + // attributes set in attr and falls back first to attrDefault and then to + // the text control font/colours for those attributes which are not set + static wxRichTextAttr Combine(const wxRichTextAttr& attr, + const wxRichTextAttr& attrDef, + const wxTextCtrlBase *text); private: long m_flags;