+ bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; }
+ bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; }
+ bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) && HasFlag(wxTEXT_ATTR_ALIGNMENT) ; }
+ bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; }
+ bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); }
+ bool HasRightIndent() const { return HasFlag(wxTEXT_ATTR_RIGHT_INDENT); }
+ bool HasFontWeight() const { return HasFlag(wxTEXT_ATTR_FONT_WEIGHT); }
+ bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); }
+ bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); }
+ bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); }
+ bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); }
+ bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); }
+ bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); }
+
+ 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); }
+ bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); }
+ bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); }
+ bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); }
+ bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); }
+ bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); }
+ bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); }
+ bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); }
+ bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
+ bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
+ bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); }
+ bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); }
+ bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); }
+
+ bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
+
+ // Is this a character style?
+ bool IsCharacterStyle() const { return HasFlag(wxTEXT_ATTR_CHARACTER); }
+ bool IsParagraphStyle() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH); }
+
+ // returns false if we have any attributes set, true otherwise
+ bool IsDefault() const
+ {
+ return GetFlags() == 0;
+ }
+
+ // Merges the given attributes. Does not affect 'this'. If compareWith
+ // is non-NULL, then it will be used to mask out those attributes that are the same in style
+ // and compareWith, for situations where we don't want to explicitly set inherited attributes.
+ bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL);
+
+ // merges the attributes of the base and the overlay objects and returns
+ // the result; the parameter attributes take precedence
+ //
+ // WARNING: the order of arguments is the opposite of Combine()
+ static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay)
+ {
+ return Combine(overlay, base, NULL);
+ }
+
+ // merges the attributes of this object and overlay
+ void Merge(const wxTextAttr& overlay)
+ {
+ *this = Merge(*this, overlay);
+ }
+
+ // 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 wxTextAttr Combine(const wxTextAttr& attr,
+ const wxTextAttr& attrDef,
+ const wxTextCtrlBase *text);
+
+ // Compare tabs
+ static bool TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);
+
+ // Remove attributes
+ static bool RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style);
+
+ // Combine two bitlists, specifying the bits of interest with separate flags.
+ static bool CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB);
+
+ // Compare two bitlists
+ static bool BitlistsEqPartial(int valueA, int valueB, int flags);
+
+ // Split into paragraph and character styles
+ static bool SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle);
+
+private:
+ long m_flags;
+
+ // Paragraph styles
+ wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm
+ int m_leftIndent; // left indent in 1/10 mm
+ int m_leftSubIndent; // left indent for all but the first
+ // line in a paragraph relative to the
+ // first line, in 1/10 mm
+ int m_rightIndent; // right indent in 1/10 mm
+ wxTextAttrAlignment m_textAlignment;
+
+ int m_paragraphSpacingAfter;
+ int m_paragraphSpacingBefore;
+ int m_lineSpacing;
+ int m_bulletStyle;
+ int m_bulletNumber;
+ int m_textEffects;
+ int m_textEffectFlags;
+ int m_outlineLevel;
+ wxString m_bulletText;
+ wxString m_bulletFont;
+ wxString m_bulletName;
+ wxString m_urlTarget;
+ wxFontEncoding m_fontEncoding;
+
+ // Character styles
+ wxColour m_colText,
+ m_colBack;
+ int m_fontSize;
+ int m_fontStyle;
+ int m_fontWeight;
+ bool m_fontUnderlined;
+ wxString m_fontFaceName;
+
+ // Character style
+ wxString m_characterStyleName;
+
+ // Paragraph style
+ wxString m_paragraphStyleName;
+
+ // List style
+ wxString m_listStyleName;
+};
+
+// ----------------------------------------------------------------------------
+// wxTextAreaBase: multiline text control specific methods
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextAreaBase
+{
+public:
+ wxTextAreaBase() { }
+ virtual ~wxTextAreaBase() { }