+enum wxTextBoxAttrPosition
+{
+ wxTEXT_BOX_ATTR_POSITION_STATIC = 0x0000, // Default is static, i.e. as per normal layout
+ wxTEXT_BOX_ATTR_POSITION_RELATIVE = 0x0010, // Relative to the relevant edge
+ wxTEXT_BOX_ATTR_POSITION_ABSOLUTE = 0x0020,
+
+ wxTEXT_BOX_ATTR_POSITION_MASK = 0x00F0
+};
+
+/**
+ @class wxTextAttrDimension
+
+ A class representing a rich text dimension, including units and position.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimensions
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimension
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrDimension() { Reset(); }
+ /**
+ Constructor taking value and units flag.
+ */
+ wxTextAttrDimension(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { m_value = value; m_flags = units|wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Resets the dimension value and flags.
+ */
+ void Reset() { m_value = 0; m_flags = 0; }
+
+ /**
+ Partial equality test.
+ */
+ bool EqPartial(const wxTextAttrDimension& dim) const;
+
+ /** Apply the dimension, but not those identical to @a compareWith if present.
+ */
+ bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* 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 wxTextAttrDimension& attr, wxTextAttrDimension& clashingAttr, wxTextAttrDimension& absentAttr);
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrDimension& dim) const { return m_value == dim.m_value && m_flags == dim.m_flags; }
+
+ /**
+ Returns the integer value of the dimension.
+ */
+ int GetValue() const { return m_value; }
+
+ /**
+ Returns the floating-pointing value of the dimension in mm.
+
+ */
+ float GetValueMM() const { return float(m_value) / 10.0; }
+
+ /**
+ Sets the value of the dimension in mm.
+ */
+ void SetValueMM(float value) { m_value = (int) ((value * 10.0) + 0.5); m_flags |= wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Sets the integer value of the dimension.
+ */
+ void SetValue(int value) { m_value = value; m_flags |= wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Sets the integer value of the dimension, passing dimension flags.
+ */
+ void SetValue(int value, wxTextAttrDimensionFlags flags) { SetValue(value); m_flags = flags; }
+
+ /**
+ Sets the integer value and units.
+ */
+ void SetValue(int value, wxTextAttrUnits units) { m_value = value; m_flags = units | wxTEXT_ATTR_VALUE_VALID; }
+
+ /**
+ Sets the dimension.
+ */
+ void SetValue(const wxTextAttrDimension& dim) { (*this) = dim; }
+
+ /**
+ Gets the units of the dimension.
+ */
+ wxTextAttrUnits GetUnits() const { return (wxTextAttrUnits) (m_flags & wxTEXT_ATTR_UNITS_MASK); }
+
+ /**
+ Sets the units of the dimension.
+ */
+ void SetUnits(wxTextAttrUnits units) { m_flags &= ~wxTEXT_ATTR_UNITS_MASK; m_flags |= units; }
+
+ /**
+ Gets the position flags.
+ */
+ wxTextBoxAttrPosition GetPosition() const { return (wxTextBoxAttrPosition) (m_flags & wxTEXT_BOX_ATTR_POSITION_MASK); }
+
+ /**
+ Sets the position flags.
+ */
+ void SetPosition(wxTextBoxAttrPosition pos) { m_flags &= ~wxTEXT_BOX_ATTR_POSITION_MASK; m_flags |= pos; }
+
+ /**
+ Returns @true if the dimension is valid.
+ */
+ bool IsValid() const { return (m_flags & wxTEXT_ATTR_VALUE_VALID) != 0; }
+
+ /**
+ Sets the valid flag.
+ */
+ void SetValid(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_VALID_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_VALID : 0); }
+
+ /**
+ Gets the dimension flags.
+ */
+ wxTextAttrDimensionFlags GetFlags() const { return m_flags; }
+
+ /**
+ Sets the dimension flags.
+ */
+ void SetFlags(wxTextAttrDimensionFlags flags) { m_flags = flags; }
+
+ int m_value;
+ wxTextAttrDimensionFlags m_flags;
+};
+
+/**
+ @class wxTextAttrDimensions
+ A class for left, right, top and bottom dimensions.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensions
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrDimensions() {}
+
+ /**
+ Resets the value and flags for all dimensions.
+ */
+ void Reset() { m_left.Reset(); m_top.Reset(); m_right.Reset(); m_bottom.Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrDimensions& dims) const { return m_left == dims.m_left && m_top == dims.m_top && m_right == dims.m_right && m_bottom == dims.m_bottom; }
+
+ /**
+ Partial equality test.
+
+ */
+ bool EqPartial(const wxTextAttrDimensions& dims) const;
+
+ /**
+ Apply border to 'this', but not if the same as @a compareWith.
+
+ */
+ bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* 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 wxTextAttrDimensions& attr, wxTextAttrDimensions& clashingAttr, wxTextAttrDimensions& absentAttr);
+
+ /**
+ Remove specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrDimensions& attr);
+
+ /**
+ Gets the left dimension.
+ */
+ const wxTextAttrDimension& GetLeft() const { return m_left; }
+ wxTextAttrDimension& GetLeft() { return m_left; }
+
+ /**
+ Gets the right dimension.
+
+ */
+ const wxTextAttrDimension& GetRight() const { return m_right; }
+ wxTextAttrDimension& GetRight() { return m_right; }
+
+ /**
+ Gets the top dimension.
+
+ */
+ const wxTextAttrDimension& GetTop() const { return m_top; }
+ wxTextAttrDimension& GetTop() { return m_top; }
+
+ /**
+ Gets the bottom dimension.
+
+ */
+ const wxTextAttrDimension& GetBottom() const { return m_bottom; }
+ wxTextAttrDimension& GetBottom() { return m_bottom; }
+
+ /**
+ Are all dimensions valid?
+
+ */
+ bool IsValid() const { return m_left.IsValid() && m_top.IsValid() && m_right.IsValid() && m_bottom.IsValid(); }
+
+ wxTextAttrDimension m_left;
+ wxTextAttrDimension m_top;
+ wxTextAttrDimension m_right;
+ wxTextAttrDimension m_bottom;
+};
+
+/**
+ @class wxTextAttrSize
+ A class for representing width and height.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrSize
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrSize() {}
+
+ /**
+ Resets the width and height dimensions.
+ */
+ void Reset() { m_width.Reset(); m_height.Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrSize& size) const { return m_width == size.m_width && m_height == size.m_height ; }
+
+ /**
+ Partial equality test.
+ */
+ bool EqPartial(const wxTextAttrSize& dims) const;
+
+ /**
+ Apply border to this object, but not if the same as @a compareWith.
+ */
+ bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* 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 wxTextAttrSize& attr, wxTextAttrSize& clashingAttr, wxTextAttrSize& absentAttr);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrSize& attr);
+
+ /**
+ Returns the width.
+ */
+ wxTextAttrDimension& GetWidth() { return m_width; }
+ const wxTextAttrDimension& GetWidth() const { return m_width; }
+
+ /**
+ Sets the width.
+ */
+ void SetWidth(int value, wxTextAttrDimensionFlags flags) { m_width.SetValue(value, flags); }
+ /**
+ Sets the width.
+ */
+ void SetWidth(int value, wxTextAttrUnits units) { m_width.SetValue(value, units); }
+ /**
+ Sets the width.
+ */
+ void SetWidth(const wxTextAttrDimension& dim) { m_width.SetValue(dim); }
+
+ /**
+ Gets the height.
+ */
+ wxTextAttrDimension& GetHeight() { return m_height; }
+ const wxTextAttrDimension& GetHeight() const { return m_height; }
+
+ /**
+ Sets the height.
+ */
+ void SetHeight(int value, wxTextAttrDimensionFlags flags) { m_height.SetValue(value, flags); }
+ /**
+ Sets the height.
+ */
+ void SetHeight(int value, wxTextAttrUnits units) { m_height.SetValue(value, units); }
+ /**
+ Sets the height.
+ */
+ void SetHeight(const wxTextAttrDimension& dim) { m_height.SetValue(dim); }
+
+ wxTextAttrDimension m_width;
+ wxTextAttrDimension m_height;
+};
+
+/**
+ @class wxTextAttrDimensionConverter
+ A class to make it easier to convert dimensions.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxTextAttrDimension
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensionConverter
+{
+public:
+ /**
+ Constructor.
+ */
+ wxTextAttrDimensionConverter(wxDC& dc, double scale = 1.0, const wxSize& parentSize = wxDefaultSize);
+ /**
+ Constructor.
+ */
+ wxTextAttrDimensionConverter(int ppi, double scale = 1.0, const wxSize& parentSize = wxDefaultSize);
+
+ /**
+ Gets the pixel size for the given dimension.
+ */
+ int GetPixels(const wxTextAttrDimension& dim, int direction = wxHORIZONTAL) const;
+ /**
+ Gets the mm size for the given dimension.
+ */
+ int GetTenthsMM(const wxTextAttrDimension& dim) const;
+
+ /**
+ Converts tenths of a mm to pixels.
+ */
+ int ConvertTenthsMMToPixels(int units) const;
+ /**
+ Converts pixels to tenths of a mm.
+ */
+ int ConvertPixelsToTenthsMM(int pixels) const;
+
+ int m_ppi;
+ double m_scale;
+ wxSize m_parentSize;
+};
+
+/**
+ Border styles, used with wxTextAttrBorder.
+ */
+enum wxTextAttrBorderStyle
+{
+ wxTEXT_BOX_ATTR_BORDER_NONE = 0,
+ wxTEXT_BOX_ATTR_BORDER_SOLID = 1,
+ wxTEXT_BOX_ATTR_BORDER_DOTTED = 2,
+ wxTEXT_BOX_ATTR_BORDER_DASHED = 3,
+ wxTEXT_BOX_ATTR_BORDER_DOUBLE = 4,
+ wxTEXT_BOX_ATTR_BORDER_GROOVE = 5,
+ wxTEXT_BOX_ATTR_BORDER_RIDGE = 6,
+ wxTEXT_BOX_ATTR_BORDER_INSET = 7,
+ wxTEXT_BOX_ATTR_BORDER_OUTSET = 8
+};
+
+/**
+ Border style presence flags, used with wxTextAttrBorder.
+ */
+enum wxTextAttrBorderFlags
+{
+ wxTEXT_BOX_ATTR_BORDER_STYLE = 0x0001,
+ wxTEXT_BOX_ATTR_BORDER_COLOUR = 0x0002
+};
+
+/**
+ Border width symbols for qualitative widths, used with wxTextAttrBorder.
+ */
+enum wxTextAttrBorderWidth
+{
+ wxTEXT_BOX_ATTR_BORDER_THIN = -1,
+ wxTEXT_BOX_ATTR_BORDER_MEDIUM = -2,
+ wxTEXT_BOX_ATTR_BORDER_THICK = -3
+};
+
+/**
+ Float styles.
+ */
+enum wxTextBoxAttrFloatStyle
+{
+ wxTEXT_BOX_ATTR_FLOAT_NONE = 0,
+ wxTEXT_BOX_ATTR_FLOAT_LEFT = 1,
+ wxTEXT_BOX_ATTR_FLOAT_RIGHT = 2
+};
+
+/**
+ Clear styles.
+ */
+enum wxTextBoxAttrClearStyle
+{
+ wxTEXT_BOX_ATTR_CLEAR_NONE = 0,
+ wxTEXT_BOX_ATTR_CLEAR_LEFT = 1,
+ wxTEXT_BOX_ATTR_CLEAR_RIGHT = 2,
+ wxTEXT_BOX_ATTR_CLEAR_BOTH = 3
+};
+
+/**
+ Collapse mode styles. TODO: can they be switched on per side?
+ */
+enum wxTextBoxAttrCollapseMode
+{
+ wxTEXT_BOX_ATTR_COLLAPSE_NONE = 0,
+ wxTEXT_BOX_ATTR_COLLAPSE_FULL = 1
+};
+
+/**
+ Vertical alignment values.
+ */
+enum wxTextBoxAttrVerticalAlignment
+{
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE = 0,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP = 1,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE = 2,
+ wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM = 3
+};
+
+/**
+ @class wxTextAttrBorder
+ A class representing a rich text object border.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl, wxRichTextAttrBorders
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrBorder
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrBorder() { Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrBorder& border) const
+ {
+ return m_flags == border.m_flags && m_borderStyle == border.m_borderStyle &&
+ m_borderColour == border.m_borderColour && m_borderWidth == border.m_borderWidth;
+ }
+
+ /**
+ Resets the border style, colour, width and flags.
+ */
+ void Reset() { m_borderStyle = 0; m_borderColour = 0; m_flags = 0; m_borderWidth.Reset(); }
+
+ /**
+ Partial equality test.
+ */
+ bool EqPartial(const wxTextAttrBorder& border) const;
+
+ /**
+ Applies the border to this object, but not if the same as @a compareWith.
+
+ */
+ bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = NULL);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrBorder& 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 wxTextAttrBorder& attr, wxTextAttrBorder& clashingAttr, wxTextAttrBorder& absentAttr);
+
+ /**
+ Sets the border style.
+ */
+ void SetStyle(int style) { m_borderStyle = style; m_flags |= wxTEXT_BOX_ATTR_BORDER_STYLE; }
+
+ /**
+ Gets the border style.
+
+ */
+ int GetStyle() const { return m_borderStyle; }
+
+ /**
+ Sets the border colour.
+ */
+ void SetColour(unsigned long colour) { m_borderColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Sets the border colour.
+ */
+ void SetColour(const wxColour& colour) { m_borderColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Gets the colour as a long.
+ */
+ unsigned long GetColourLong() const { return m_borderColour; }
+
+ /**
+ Gets the colour.
+ */
+ wxColour GetColour() const { return wxColour(m_borderColour); }
+
+ /**
+ Gets the border width.
+ */
+ wxTextAttrDimension& GetWidth() { return m_borderWidth; }
+ const wxTextAttrDimension& GetWidth() const { return m_borderWidth; }
+
+ /**
+ Sets the border width.
+ */
+ void SetWidth(const wxTextAttrDimension& width) { m_borderWidth = width; }
+ /**
+ Sets the border width.
+ */
+ void SetWidth(int value, wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM) { SetWidth(wxTextAttrDimension(value, units)); }
+
+ /**
+ True if the border has a valid style.
+ */
+ bool HasStyle() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_STYLE) != 0; }
+
+ /**
+ True if the border has a valid colour.
+ */
+ bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; }
+
+ /**
+ True if the border has a valid width.
+ */
+ bool HasWidth() const { return m_borderWidth.IsValid(); }
+
+ /**
+ True if the border is valid.
+ */
+ bool IsValid() const { return HasWidth(); }
+
+ /**
+ Set the valid flag for this border.
+ */
+ void MakeValid() { m_borderWidth.SetValid(true); }
+
+ /**
+ Returns the border flags.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets the border flags.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Adds a border flag.
+ */
+ void AddFlag(int flag) { m_flags |= flag; }
+
+ /**
+ Removes a border flag.
+ */
+ void RemoveFlag(int flag) { m_flags &= ~flag; }
+
+ int m_borderStyle;
+ unsigned long m_borderColour;
+ wxTextAttrDimension m_borderWidth;
+ int m_flags;
+};
+
+/**
+ @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; }
+
+ /**
+ Returns the box style name.
+ */
+ const wxString& GetBoxStyleName() const { return m_boxStyleName; }
+
+ /**
+ Sets the box style name.
+ */
+ void SetBoxStyleName(const wxString& name) { m_boxStyleName = name; AddFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); }
+
+ /**
+ Returns @true if the box style name is present.
+ */
+ bool HasBoxStyleName() const { return HasFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); }
+
+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;
+ wxString m_boxStyleName;
+};
+
+/**
+ @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
+*/