+/**
+ @class wxTextAttrBorders
+ A class representing a rich text object's borders.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxRichTextAttrBorder
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrBorders
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrBorders() { }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrBorders& borders) const
+ {
+ return m_left == borders.m_left && m_right == borders.m_right &&
+ m_top == borders.m_top && m_bottom == borders.m_bottom;
+ }
+
+ /**
+ Sets the style of all borders.
+ */
+ void SetStyle(int style);
+
+ /**
+ Sets colour of all borders.
+ */
+ void SetColour(unsigned long colour);
+
+ /**
+ Sets the colour for all borders.
+ */
+ void SetColour(const wxColour& colour);
+
+ /**
+ Sets the width of all borders.
+ */
+ void SetWidth(const wxTextAttrDimension& width);
+
+ /**
+ Sets the width of all borders.
+ */
+ void SetWidth(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { SetWidth(wxTextAttrDimension(value, units)); }
+
+ /**
+ Resets all borders.
+ */
+ void Reset() { m_left.Reset(); m_right.Reset(); m_top.Reset(); m_bottom.Reset(); }
+
+ /**
+ Partial equality test.
+ */
+ bool EqPartial(const wxTextAttrBorders& borders) const;
+
+ /**
+ Applies border to this object, but not if the same as @a compareWith.
+ */
+ bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = NULL);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrBorders& attr);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrBorders& attr, wxTextAttrBorders& clashingAttr, wxTextAttrBorders& absentAttr);
+
+ /**
+ Returns @true if all borders are valid.
+ */
+ bool IsValid() const { return m_left.IsValid() || m_right.IsValid() || m_top.IsValid() || m_bottom.IsValid(); }
+
+ /**
+ Returns the left border.
+ */
+ const wxTextAttrBorder& GetLeft() const { return m_left; }
+ wxTextAttrBorder& GetLeft() { return m_left; }
+
+ /**
+ Returns the right border.
+ */
+ const wxTextAttrBorder& GetRight() const { return m_right; }
+ wxTextAttrBorder& GetRight() { return m_right; }
+
+ /**
+ Returns the top border.
+ */
+ const wxTextAttrBorder& GetTop() const { return m_top; }
+ wxTextAttrBorder& GetTop() { return m_top; }
+
+ /**
+ Returns the bottom border.
+ */
+ const wxTextAttrBorder& GetBottom() const { return m_bottom; }
+ wxTextAttrBorder& GetBottom() { return m_bottom; }
+
+ wxTextAttrBorder m_left, m_right, m_top, m_bottom;
+
+};
+
+/**
+ @class wxTextBoxAttr
+ A class representing the box attributes of a rich text object.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextBoxAttr
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextBoxAttr() { Init(); }
+
+ /**
+ Copy constructor.
+ */
+ wxTextBoxAttr(const wxTextBoxAttr& attr) { Init(); (*this) = attr; }
+
+ /**
+ Initialises this object.
+ */
+ void Init() { Reset(); }
+
+ /**
+ Resets this object.
+ */
+ void Reset();
+
+ // Copy. Unnecessary since we let it do a binary copy
+ //void Copy(const wxTextBoxAttr& attr);
+
+ // Assignment
+ //void operator= (const wxTextBoxAttr& attr);
+
+ /**
+ Equality test.
+ */
+ bool operator== (const wxTextBoxAttr& attr) const;
+
+ /**
+ Partial equality test, ignoring unset attributes.
+
+ */
+ bool EqPartial(const wxTextBoxAttr& attr) const;
+
+ /**
+ Merges the given attributes. If @a compareWith is non-NULL, then it will be used
+ to mask out those attributes that are the same in style and @a compareWith, for
+ situations where we don't want to explicitly set inherited attributes.
+ */
+ bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = NULL);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextBoxAttr& attr, wxTextBoxAttr& clashingAttr, wxTextBoxAttr& absentAttr);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextBoxAttr& attr);
+
+ /**
+ Sets the flags.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Returns the flags.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Is this flag present?
+ */
+ bool HasFlag(wxTextBoxAttrFlags flag) const { return (m_flags & flag) != 0; }
+
+ /**
+ Removes this flag.
+ */
+ void RemoveFlag(wxTextBoxAttrFlags flag) { m_flags &= ~flag; }
+
+ /**
+ Adds this flag.
+ */
+ void AddFlag(wxTextBoxAttrFlags flag) { m_flags |= flag; }
+
+ /**
+ Returns @true if no attributes are set.
+ */
+ bool IsDefault() const;
+
+ /**
+ Returns the float mode.
+ */
+ wxTextBoxAttrFloatStyle GetFloatMode() const { return m_floatMode; }
+
+ /**
+ Sets the float mode.
+ */
+ void SetFloatMode(wxTextBoxAttrFloatStyle mode) { m_floatMode = mode; m_flags |= wxTEXT_BOX_ATTR_FLOAT; }
+
+ /**
+ Returns @true if float mode is active.
+ */
+ bool HasFloatMode() const { return HasFlag(wxTEXT_BOX_ATTR_FLOAT); }
+
+ /**
+ Returns @true if this object is floating?
+ */
+ bool IsFloating() const { return HasFloatMode() && GetFloatMode() != wxTEXT_BOX_ATTR_FLOAT_NONE; }
+
+ /**
+ Returns the clear mode - whether to wrap text after object. Currently unimplemented.
+ */
+ wxTextBoxAttrClearStyle GetClearMode() const { return m_clearMode; }
+
+ /**
+ Set the clear mode. Currently unimplemented.
+ */
+ void SetClearMode(wxTextBoxAttrClearStyle mode) { m_clearMode = mode; m_flags |= wxTEXT_BOX_ATTR_CLEAR; }
+
+ /**
+ Returns @true if we have a clear flag.
+ */
+ bool HasClearMode() const { return HasFlag(wxTEXT_BOX_ATTR_CLEAR); }
+
+ /**
+ Returns the collapse mode - whether to collapse borders. Currently unimplemented.
+ */
+ wxTextBoxAttrCollapseMode GetCollapseBorders() const { return m_collapseMode; }
+
+ /**
+ Sets the collapse mode - whether to collapse borders. Currently unimplemented.
+ */
+ void SetCollapseBorders(wxTextBoxAttrCollapseMode collapse) { m_collapseMode = collapse; m_flags |= wxTEXT_BOX_ATTR_COLLAPSE_BORDERS; }
+
+ /**
+ Returns @true if the collapse borders flag is present.
+ */
+ bool HasCollapseBorders() const { return HasFlag(wxTEXT_BOX_ATTR_COLLAPSE_BORDERS); }
+
+ /**
+ Returns the vertical alignment.
+ */
+ wxTextBoxAttrVerticalAlignment GetVerticalAlignment() const { return m_verticalAlignment; }
+
+ /**
+ Sets the vertical alignment.
+ */
+ void SetVerticalAlignment(wxTextBoxAttrVerticalAlignment verticalAlignment) { m_verticalAlignment = verticalAlignment; m_flags |= wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT; }
+
+ /**
+ Returns @true if a vertical alignment flag is present.
+ */
+ bool HasVerticalAlignment() const { return HasFlag(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT); }
+
+ /**
+ Returns the margin values.
+ */
+ wxTextAttrDimensions& GetMargins() { return m_margins; }
+ const wxTextAttrDimensions& GetMargins() const { return m_margins; }
+
+ /**
+ Returns the left margin.
+ */
+ wxTextAttrDimension& GetLeftMargin() { return m_margins.m_left; }
+ const wxTextAttrDimension& GetLeftMargin() const { return m_margins.m_left; }
+
+ /**
+ Returns the right margin.
+ */
+ wxTextAttrDimension& GetRightMargin() { return m_margins.m_right; }
+ const wxTextAttrDimension& GetRightMargin() const { return m_margins.m_right; }
+
+ /**
+ Returns the top margin.
+ */
+ wxTextAttrDimension& GetTopMargin() { return m_margins.m_top; }
+ const wxTextAttrDimension& GetTopMargin() const { return m_margins.m_top; }
+
+ /**
+ Returns the bottom margin.
+ */
+ wxTextAttrDimension& GetBottomMargin() { return m_margins.m_bottom; }
+ const wxTextAttrDimension& GetBottomMargin() const { return m_margins.m_bottom; }
+
+ /**
+ Returns the position.
+ */
+ wxTextAttrDimensions& GetPosition() { return m_position; }
+ const wxTextAttrDimensions& GetPosition() const { return m_position; }
+
+ /**
+ Returns the left position.
+ */
+ wxTextAttrDimension& GetLeft() { return m_position.m_left; }
+ const wxTextAttrDimension& GetLeft() const { return m_position.m_left; }
+
+ /**
+ Returns the right position.
+ */
+ wxTextAttrDimension& GetRight() { return m_position.m_right; }
+ const wxTextAttrDimension& GetRight() const { return m_position.m_right; }
+
+ /**
+ Returns the top position.
+ */
+ wxTextAttrDimension& GetTop() { return m_position.m_top; }
+ const wxTextAttrDimension& GetTop() const { return m_position.m_top; }
+
+ /**
+ Returns the bottom position.
+ */
+ wxTextAttrDimension& GetBottom() { return m_position.m_bottom; }
+ const wxTextAttrDimension& GetBottom() const { return m_position.m_bottom; }
+
+ /**
+ Returns the padding values.
+ */
+ wxTextAttrDimensions& GetPadding() { return m_padding; }
+ const wxTextAttrDimensions& GetPadding() const { return m_padding; }
+
+ /**
+ Returns the left padding value.
+ */
+ wxTextAttrDimension& GetLeftPadding() { return m_padding.m_left; }
+ const wxTextAttrDimension& GetLeftPadding() const { return m_padding.m_left; }
+
+ /**
+ Returns the right padding value.
+ */
+ wxTextAttrDimension& GetRightPadding() { return m_padding.m_right; }
+ const wxTextAttrDimension& GetRightPadding() const { return m_padding.m_right; }
+
+ /**
+ Returns the top padding value.
+ */
+ wxTextAttrDimension& GetTopPadding() { return m_padding.m_top; }
+ const wxTextAttrDimension& GetTopPadding() const { return m_padding.m_top; }
+
+ /**
+ Returns the bottom padding value.
+ */
+ wxTextAttrDimension& GetBottomPadding() { return m_padding.m_bottom; }
+ const wxTextAttrDimension& GetBottomPadding() const { return m_padding.m_bottom; }
+
+ /**
+ Returns the borders.
+ */
+ wxTextAttrBorders& GetBorder() { return m_border; }
+ const wxTextAttrBorders& GetBorder() const { return m_border; }
+
+ /**
+ Returns the left border.
+ */
+ wxTextAttrBorder& GetLeftBorder() { return m_border.m_left; }
+ const wxTextAttrBorder& GetLeftBorder() const { return m_border.m_left; }
+
+ /**
+ Returns the top border.
+ */
+ wxTextAttrBorder& GetTopBorder() { return m_border.m_top; }
+ const wxTextAttrBorder& GetTopBorder() const { return m_border.m_top; }
+
+ /**
+ Returns the right border.
+ */
+ wxTextAttrBorder& GetRightBorder() { return m_border.m_right; }
+ const wxTextAttrBorder& GetRightBorder() const { return m_border.m_right; }
+
+ /**
+ Returns the bottom border.
+ */
+ wxTextAttrBorder& GetBottomBorder() { return m_border.m_bottom; }
+ const wxTextAttrBorder& GetBottomBorder() const { return m_border.m_bottom; }
+
+ /**
+ Returns the outline.
+ */
+ wxTextAttrBorders& GetOutline() { return m_outline; }
+ const wxTextAttrBorders& GetOutline() const { return m_outline; }
+
+ /**
+ Returns the left outline.
+ */
+ wxTextAttrBorder& GetLeftOutline() { return m_outline.m_left; }
+ const wxTextAttrBorder& GetLeftOutline() const { return m_outline.m_left; }
+
+ /**
+ Returns the top outline.
+ */
+ wxTextAttrBorder& GetTopOutline() { return m_outline.m_top; }
+ const wxTextAttrBorder& GetTopOutline() const { return m_outline.m_top; }
+
+ /**
+ Returns the right outline.
+ */
+ wxTextAttrBorder& GetRightOutline() { return m_outline.m_right; }
+ const wxTextAttrBorder& GetRightOutline() const { return m_outline.m_right; }
+
+ /**
+ Returns the bottom outline.
+ */
+ wxTextAttrBorder& GetBottomOutline() { return m_outline.m_bottom; }
+ const wxTextAttrBorder& GetBottomOutline() const { return m_outline.m_bottom; }
+
+ /**
+ Returns the object size.
+ */
+ wxTextAttrSize& GetSize() { return m_size; }
+ const wxTextAttrSize& GetSize() const { return m_size; }
+
+ /**
+ Sets the object size.
+ */
+ void SetSize(const wxTextAttrSize& sz) { m_size = sz; }
+
+ /**
+ Returns the object width.
+ */
+ wxTextAttrDimension& GetWidth() { return m_size.m_width; }
+ const wxTextAttrDimension& GetWidth() const { return m_size.m_width; }
+
+ /**
+ Returns the object height.
+ */
+ wxTextAttrDimension& GetHeight() { return m_size.m_height; }
+ const wxTextAttrDimension& GetHeight() const { return m_size.m_height; }
+
+public:
+
+ int m_flags;
+
+ wxTextAttrDimensions m_margins;
+ wxTextAttrDimensions m_padding;
+ wxTextAttrDimensions m_position;
+
+ wxTextAttrSize m_size;
+
+ wxTextAttrBorders m_border;
+ wxTextAttrBorders m_outline;
+
+ wxTextBoxAttrFloatStyle m_floatMode;
+ wxTextBoxAttrClearStyle m_clearMode;
+ wxTextBoxAttrCollapseMode m_collapseMode;
+ wxTextBoxAttrVerticalAlignment m_verticalAlignment;
+};
+
+/**
+ @class wxRichTextAttr
+ A class representing enhanced attributes for rich text objects.
+ This adds a wxTextBoxAttr member to the basic wxTextAttr class.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxTextBoxAttr, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextAttr: public wxTextAttr
+{
+public:
+ /**
+ Constructor taking a wxTextAttr.
+ */
+ wxRichTextAttr(const wxTextAttr& attr) { wxTextAttr::Copy(attr); }
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextAttr(const wxRichTextAttr& attr): wxTextAttr() { Copy(attr); }
+
+ /**
+ Default constructor.
+ */
+ wxRichTextAttr() {}
+
+ /**
+ Copy function.
+ */
+ void Copy(const wxRichTextAttr& attr);
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxRichTextAttr& attr) { Copy(attr); }
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxTextAttr& attr) { wxTextAttr::Copy(attr); }
+
+ /**
+ Equality test.
+ */
+ bool operator==(const wxRichTextAttr& attr) const;
+
+ /**
+ Partial equality test taking comparison object into account.
+ */
+ bool EqPartial(const wxRichTextAttr& attr) const;
+
+ /**
+ Merges the given attributes. If @a compareWith
+ is non-NULL, then it will be used to mask out those attributes that are the same in style
+ and @a compareWith, for situations where we don't want to explicitly set inherited attributes.
+ */
+ bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxRichTextAttr& attr, wxRichTextAttr& clashingAttr, wxRichTextAttr& absentAttr);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxRichTextAttr& attr);
+
+ /**
+ Returns the text box attributes.
+ */
+ wxTextBoxAttr& GetTextBoxAttr() { return m_textBoxAttr; }
+ const wxTextBoxAttr& GetTextBoxAttr() const { return m_textBoxAttr; }
+
+ /**
+ Set the text box attributes.
+ */
+ void SetTextBoxAttr(const wxTextBoxAttr& attr) { m_textBoxAttr = attr; }
+
+ wxTextBoxAttr m_textBoxAttr;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxVariant, wxRichTextVariantArray, WXDLLIMPEXP_RICHTEXT);
+
+/**
+ @class wxRichTextProperties
+ A simple property class using wxVariants. This is used to give each rich text object the
+ ability to store custom properties that can be used by the application.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextObject, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextProperties: public wxObject
+{
+DECLARE_DYNAMIC_CLASS(wxRichTextProperties)
+public:
+
+ /**
+ Default constructor.
+ */
+ wxRichTextProperties() {}
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextProperties(const wxRichTextProperties& props): wxObject() { Copy(props); }
+
+ /**
+ Assignment operator.
+ */
+ void operator=(const wxRichTextProperties& props) { Copy(props); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxRichTextProperties& props) const;
+
+ /**
+ Copies from @a props.
+ */
+ void Copy(const wxRichTextProperties& props) { m_properties = props.m_properties; }
+
+ /**
+ Returns the variant at the given index.
+ */
+ const wxVariant& operator[](size_t idx) const { return m_properties[idx]; }
+
+ /**
+ Returns the variant at the given index.
+ */
+ wxVariant& operator[](size_t idx) { return m_properties[idx]; }
+
+ /**
+ Clears the properties.
+ */
+ void Clear() { m_properties.Clear(); }
+
+ /**
+ Returns the array of variants implementing the properties.
+ */
+ const wxRichTextVariantArray& GetProperties() const { return m_properties; }
+
+ /**
+ Returns the array of variants implementing the properties.
+ */
+ wxRichTextVariantArray& GetProperties() { return m_properties; }
+
+ /**
+ Sets the array of variants.
+ */
+ void SetProperties(const wxRichTextVariantArray& props) { m_properties = props; }
+
+ /**
+ Returns all the property names.
+ */
+ wxArrayString GetPropertyNames() const;
+
+ /**
+ Returns a count of the properties.
+ */
+ size_t GetCount() const { return m_properties.GetCount(); }
+
+ /**
+ Returns @true if the given property is found.
+ */
+ bool HasProperty(const wxString& name) const { return Find(name) != -1; }
+
+ /**
+ Finds the given property.
+ */
+ int Find(const wxString& name) const;
+
+ /**
+ Gets the property variant by name.
+ */
+ const wxVariant& GetProperty(const wxString& name) const;
+
+ /**
+ Finds or creates a property with the given name, returning a pointer to the variant.
+ */
+ wxVariant* FindOrCreateProperty(const wxString& name);
+
+ /**
+ Gets the value of the named property as a string.
+ */
+ wxString GetPropertyString(const wxString& name) const;
+
+ /**
+ Gets the value of the named property as a long integer.
+ */
+ long GetPropertyLong(const wxString& name) const;
+
+ /**
+ Gets the value of the named property as a boolean.
+ */
+ bool GetPropertyBool(const wxString& name) const;
+
+ /**
+ Gets the value of the named property as a double.
+ */
+ double GetPropertyDouble(const wxString& name) const;
+
+ /**
+ Sets the property by passing a variant which contains a name and value.
+ */
+ void SetProperty(const wxVariant& variant);
+
+ /**
+ Sets a property by name and variant.
+ */
+ void SetProperty(const wxString& name, const wxVariant& variant);
+
+ /**
+ Sets a property by name and string value.
+ */
+ void SetProperty(const wxString& name, const wxString& value);
+
+ /**
+ Sets property by name and long integer value.
+ */
+ void SetProperty(const wxString& name, long value);
+
+ /**
+ Sets property by name and double value.
+ */
+ void SetProperty(const wxString& name, double value);
+
+ /**
+ Sets property by name and boolean value.
+ */
+ void SetProperty(const wxString& name, bool value);
+
+protected:
+ wxRichTextVariantArray m_properties;
+};
+
+
+/**
+ @class wxRichTextFontTable
+ Manages quick access to a pool of fonts for rendering rich text.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable: public wxObject
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxRichTextFontTable();
+
+ /**
+ Copy constructor.
+ */
+ wxRichTextFontTable(const wxRichTextFontTable& table);
+ virtual ~wxRichTextFontTable();
+
+ /**
+ Returns @true if the font table is valid.
+ */
+ bool IsOk() const { return m_refData != NULL; }
+
+ /**
+ Finds a font for the given attribute object.
+ */
+ wxFont FindFont(const wxRichTextAttr& fontSpec);
+
+ /**
+ Clears the font table.
+ */
+ void Clear();
+
+ /**
+ Assignment operator.
+ */
+ void operator= (const wxRichTextFontTable& table);
+
+ /**
+ Equality operator.
+ */
+ bool operator == (const wxRichTextFontTable& table) const;
+
+ /**
+ Inequality operator.
+ */
+ bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); }
+
+protected:
+
+ DECLARE_DYNAMIC_CLASS(wxRichTextFontTable)
+};
+
+/**
+ @class wxRichTextRange
+
+ This stores beginning and end positions for a range of data.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextBuffer, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextRange