+// Flags to indicate which attributes are being applied
+enum wxTextAttrFlags
+{
+ wxTEXT_ATTR_TEXT_COLOUR = 0x00000001,
+ wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002,
+
+ wxTEXT_ATTR_FONT_FACE = 0x00000004,
+ wxTEXT_ATTR_FONT_SIZE = 0x00000008,
+ wxTEXT_ATTR_FONT_WEIGHT = 0x00000010,
+ wxTEXT_ATTR_FONT_ITALIC = 0x00000020,
+ wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040,
+ wxTEXT_ATTR_FONT_ENCODING = 0x02000000,
+ wxTEXT_ATTR_FONT_FAMILY = 0x04000000,
+ wxTEXT_ATTR_FONT = \
+ ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \
+ wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ),
+
+ wxTEXT_ATTR_ALIGNMENT = 0x00000080,
+ wxTEXT_ATTR_LEFT_INDENT = 0x00000100,
+ wxTEXT_ATTR_RIGHT_INDENT = 0x00000200,
+ wxTEXT_ATTR_TABS = 0x00000400,
+ wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800,
+ wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000,
+ wxTEXT_ATTR_LINE_SPACING = 0x00002000,
+ wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000,
+ wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000,
+ wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000,
+
+ wxTEXT_ATTR_BULLET_STYLE = 0x00020000,
+ wxTEXT_ATTR_BULLET_NUMBER = 0x00040000,
+ wxTEXT_ATTR_BULLET_TEXT = 0x00080000,
+ wxTEXT_ATTR_BULLET_NAME = 0x00100000,
+
+ wxTEXT_ATTR_BULLET = \
+ ( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \
+ wxTEXT_ATTR_BULLET_NAME ),
+
+
+ wxTEXT_ATTR_URL = 0x00200000,
+ wxTEXT_ATTR_PAGE_BREAK = 0x00400000,
+ wxTEXT_ATTR_EFFECTS = 0x00800000,
+ wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000,
+
+ /*!
+ * Character and paragraph combined styles
+ */
+
+ wxTEXT_ATTR_CHARACTER = \
+ (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \
+ wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL),
+
+ wxTEXT_ATTR_PARAGRAPH = \
+ (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
+ wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
+ wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|wxTEXT_ATTR_PAGE_BREAK),
+
+ wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
+};
+
+/*!
+ * Styles for wxTextAttr::SetBulletStyle
+ */
+enum wxTextAttrBulletStyle
+{
+ wxTEXT_ATTR_BULLET_STYLE_NONE = 0x00000000,
+ wxTEXT_ATTR_BULLET_STYLE_ARABIC = 0x00000001,
+ wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER = 0x00000002,
+ wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER = 0x00000004,
+ wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER = 0x00000008,
+ wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER = 0x00000010,
+ wxTEXT_ATTR_BULLET_STYLE_SYMBOL = 0x00000020,
+ wxTEXT_ATTR_BULLET_STYLE_BITMAP = 0x00000040,
+ wxTEXT_ATTR_BULLET_STYLE_PARENTHESES = 0x00000080,
+ wxTEXT_ATTR_BULLET_STYLE_PERIOD = 0x00000100,
+ wxTEXT_ATTR_BULLET_STYLE_STANDARD = 0x00000200,
+ wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS = 0x00000400,
+ wxTEXT_ATTR_BULLET_STYLE_OUTLINE = 0x00000800,
+
+ wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT = 0x00000000,
+ wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT = 0x00001000,
+ wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE = 0x00002000
+};
+
+/*!
+ * Styles for wxTextAttr::SetTextEffects
+ */
+enum wxTextAttrEffects
+{
+ wxTEXT_ATTR_EFFECT_NONE = 0x00000000,
+ wxTEXT_ATTR_EFFECT_CAPITALS = 0x00000001,
+ wxTEXT_ATTR_EFFECT_SMALL_CAPITALS = 0x00000002,
+ wxTEXT_ATTR_EFFECT_STRIKETHROUGH = 0x00000004,
+ wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH = 0x00000008,
+ wxTEXT_ATTR_EFFECT_SHADOW = 0x00000010,
+ wxTEXT_ATTR_EFFECT_EMBOSS = 0x00000020,
+ wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040,
+ wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080,
+ wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100,
+ wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200
+};
+
+/*!
+ * Line spacing values
+ */
+enum wxTextAttrLineSpacing
+{
+ wxTEXT_ATTR_LINE_SPACING_NORMAL = 10,
+ wxTEXT_ATTR_LINE_SPACING_HALF = 15,
+ wxTEXT_ATTR_LINE_SPACING_TWICE = 20
+};
+
+// ----------------------------------------------------------------------------
+// wxTextAttr: a structure containing the visual attributes of a text
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextAttr
+{
+public:
+ // ctors
+ wxTextAttr() { Init(); }
+ wxTextAttr(const wxTextAttr& attr) { Init(); Copy(attr); }
+ wxTextAttr(const wxColour& colText,
+ const wxColour& colBack = wxNullColour,
+ const wxFont& font = wxNullFont,
+ wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
+
+ // Initialise this object.
+ void Init();
+
+ // Copy
+ void Copy(const wxTextAttr& attr);
+
+ // Assignment
+ void operator= (const wxTextAttr& attr);
+
+ // Equality test
+ bool operator== (const wxTextAttr& attr) const;
+
+ // Partial equality test
+ bool EqPartial(const wxTextAttr& attr) const;
+
+ // Get attributes from font.
+ bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT);
+
+ // setters
+ void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; }
+ void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; }
+ void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
+ void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
+ void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
+ void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
+
+ void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; }
+ void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; }
+ void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; }
+ void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; }
+ void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; }
+ void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; }
+ void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; }
+
+ // Set font
+ void SetFont(const wxFont& font, int flags = wxTEXT_ATTR_FONT) { GetFontAttributes(font, flags); }
+
+ void SetFlags(long flags) { m_flags = flags; }
+
+ void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; }
+ void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; }
+ void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); }
+ void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; }
+ void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; }
+ void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; }
+ void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; }
+ void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; }
+ void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; }
+ void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
+ void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; }
+ void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; }
+ void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
+ void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); }
+ void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; }
+ void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); }
+
+ const wxColour& GetTextColour() const { return m_colText; }
+ const wxColour& GetBackgroundColour() const { return m_colBack; }
+ wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
+ const wxArrayInt& GetTabs() const { return m_tabs; }
+ long GetLeftIndent() const { return m_leftIndent; }
+ long GetLeftSubIndent() const { return m_leftSubIndent; }
+ long GetRightIndent() const { return m_rightIndent; }
+ long GetFlags() const { return m_flags; }
+
+ int GetFontSize() const { return m_fontSize; }
+ wxFontStyle GetFontStyle() const { return m_fontStyle; }
+ wxFontWeight GetFontWeight() const { return m_fontWeight; }
+ bool GetFontUnderlined() const { return m_fontUnderlined; }
+ const wxString& GetFontFaceName() const { return m_fontFaceName; }
+ wxFontEncoding GetFontEncoding() const { return m_fontEncoding; }
+ wxFontFamily GetFontFamily() const { return m_fontFamily; }
+
+ wxFont GetFont() const;
+
+ const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
+ const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
+ const wxString& GetListStyleName() const { return m_listStyleName; }
+ int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
+ int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
+
+ int GetLineSpacing() const { return m_lineSpacing; }
+ int GetBulletStyle() const { return m_bulletStyle; }
+ int GetBulletNumber() const { return m_bulletNumber; }
+ const wxString& GetBulletText() const { return m_bulletText; }
+ const wxString& GetBulletFont() const { return m_bulletFont; }
+ const wxString& GetBulletName() const { return m_bulletName; }
+ const wxString& GetURL() const { return m_urlTarget; }
+ int GetTextEffects() const { return m_textEffects; }
+ int GetTextEffectFlags() const { return m_textEffectFlags; }
+ int GetOutlineLevel() const { return m_outlineLevel; }