+#define wxSCRIPT_MUL_FACTOR 1.5
+
+typedef unsigned short wxTextAttrDimensionFlags;
+
+// Miscelaneous text box flags
+enum wxTextBoxAttrFlags
+{
+ wxTEXT_BOX_ATTR_FLOAT = 0x00000001,
+ wxTEXT_BOX_ATTR_CLEAR = 0x00000002,
+ wxTEXT_BOX_ATTR_COLLAPSE_BORDERS = 0x00000004
+};
+
+// Whether a value is present, used in dimension flags
+enum wxTextAttrValueFlags
+{
+ wxTEXT_ATTR_VALUE_PRESENT = 0x1000,
+ wxTEXT_ATTR_VALUE_PRESENT_MASK = 0x1000
+};
+
+// Units - included in the dimension value
+enum wxTextAttrUnits
+{
+ wxTEXT_ATTR_UNITS_TENTHS_MM = 0x0001,
+ wxTEXT_ATTR_UNITS_PIXELS = 0x0002,
+ wxTEXT_ATTR_UNITS_PERCENTAGE = 0x0004,
+ wxTEXT_ATTR_UNITS_POINTS = 0x0008,
+
+ wxTEXT_ATTR_UNITS_MASK = 0x000F
+};
+
+// Position - included in the dimension flags
+enum wxTextBoxAttrPosition
+{
+ wxTEXT_BOX_ATTR_POSITION_STATIC = 0x0000, // Default is static, i.e. as per normal layout
+ wxTEXT_BOX_ATTR_POSITION_RELATIVE = 0x0010,
+ wxTEXT_BOX_ATTR_POSITION_ABSOLUTE = 0x0020,
+
+ wxTEXT_BOX_ATTR_POSITION_MASK = 0x00F0
+};
+
+// Dimension, including units and position
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimension
+{
+public:
+ wxTextAttrDimension() { Reset(); }
+ wxTextAttrDimension(int value, wxTextAttrDimensionFlags flags = wxTEXT_ATTR_VALUE_PRESENT|wxTEXT_ATTR_UNITS_TENTHS_MM) { m_value = value; m_flags = flags; }
+
+ void Reset() { m_value = 0; m_flags = 0; }
+
+ // Partial equality test
+ bool EqPartial(const wxTextAttrDimension& dim) const;
+
+ // Apply
+ 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);
+
+ bool operator==(const wxTextAttrDimension& dim) const { return m_value == dim.m_value && m_flags == dim.m_flags; }
+
+ int GetValue() const { return m_value; }
+ float GetValueMM() const { return float(m_value) / 10.0; }
+ void SetValueMM(float value) { m_value = (int) ((value * 10.0) + 0.5); m_flags |= wxTEXT_ATTR_VALUE_PRESENT; }
+ void SetValue(int value) { m_value = value; m_flags |= wxTEXT_ATTR_VALUE_PRESENT; }
+ void SetValue(int value, wxTextAttrDimensionFlags flags) { m_value = value; m_flags = flags; }
+ void SetValue(const wxTextAttrDimension& dim) { (*this) = dim; }
+
+ wxTextAttrUnits GetUnits() const { return (wxTextAttrUnits) (m_flags & wxTEXT_ATTR_UNITS_MASK); }
+ void SetUnits(wxTextAttrUnits units) { m_flags &= ~wxTEXT_ATTR_UNITS_MASK; m_flags |= units; }
+
+ wxTextBoxAttrPosition GetPosition() const { return (wxTextBoxAttrPosition) (m_flags & wxTEXT_BOX_ATTR_POSITION_MASK); }
+ void SetPosition(wxTextBoxAttrPosition pos) { m_flags &= ~wxTEXT_BOX_ATTR_POSITION_MASK; m_flags |= pos; }
+
+ bool IsPresent() const { return (m_flags & wxTEXT_ATTR_VALUE_PRESENT) != 0; }
+ void SetPresent(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_PRESENT_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_PRESENT : 0); }
+
+ wxTextAttrDimensionFlags GetFlags() const { return m_flags; }
+ void SetFlags(wxTextAttrDimensionFlags flags) { m_flags = flags; }
+
+ int m_value;
+ wxTextAttrDimensionFlags m_flags;
+};
+
+// A class for left, right, top and bottom dimensions
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensions
+{
+public:
+ void Reset() { m_left.Reset(); m_top.Reset(); m_right.Reset(); m_bottom.Reset(); }
+
+ 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 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);
+
+ const wxTextAttrDimension& GetLeft() const { return m_left; }
+ wxTextAttrDimension& GetLeft() { return m_left; }
+
+ const wxTextAttrDimension& GetRight() const { return m_right; }
+ wxTextAttrDimension& GetRight() { return m_right; }
+
+ const wxTextAttrDimension& GetTop() const { return m_top; }
+ wxTextAttrDimension& GetTop() { return m_top; }
+
+ const wxTextAttrDimension& GetBottom() const { return m_bottom; }
+ wxTextAttrDimension& GetBottom() { return m_bottom; }
+
+ wxTextAttrDimension m_left;
+ wxTextAttrDimension m_top;
+ wxTextAttrDimension m_right;
+ wxTextAttrDimension m_bottom;
+};
+
+// A class to make it easier to convert dimensions
+class WXDLLIMPEXP_RICHTEXT wxTextAttrDimensionConverter
+{
+public:
+ wxTextAttrDimensionConverter(wxDC& dc, double scale = 1.0, const wxSize& parentSize = wxDefaultSize);
+ wxTextAttrDimensionConverter(int ppi, double scale = 1.0, const wxSize& parentSize = wxDefaultSize);
+
+ int GetPixels(const wxTextAttrDimension& dim, int direction = wxHORIZONTAL) const;
+ int GetTenthsMM(const wxTextAttrDimension& dim) const;
+
+ int ConvertTenthsMMToPixels(int units) const;
+ int ConvertPixelsToTenthsMM(int pixels) const;
+
+ int m_ppi;
+ double m_scale;
+ wxSize m_parentSize;
+};
+
+// Border styles
+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
+enum wxTextAttrBorderFlags
+{
+ wxTEXT_BOX_ATTR_BORDER_STYLE = 0x0001,
+ wxTEXT_BOX_ATTR_BORDER_COLOUR = 0x0002
+};
+
+// Border width symbols for qualitative widths
+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
+};
+
+// Border
+class WXDLLIMPEXP_RICHTEXT wxTextAttrBorder
+{
+public:
+ wxTextAttrBorder() { Reset(); }
+
+ 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;
+ }
+
+ void Reset() { m_borderStyle = 0; m_borderColour = 0; m_flags = 0; m_borderWidth.Reset(); }
+
+ // Partial equality test
+ bool EqPartial(const wxTextAttrBorder& border) const;
+
+ // Apply border to 'this', but not if the same as compareWith
+ bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = NULL);
+
+ // Remove 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);
+
+ void SetStyle(int style) { m_borderStyle = style; m_flags |= wxTEXT_BOX_ATTR_BORDER_STYLE; }
+ int GetStyle() const { return m_borderStyle; }
+
+ void SetColour(unsigned long colour) { m_borderColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+ void SetColour(const wxColour& colour) { m_borderColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+ unsigned long GetColourLong() const { return m_borderColour; }
+ wxColour GetColour() const { return wxColour(m_borderColour); }
+
+ wxTextAttrDimension& GetWidth() { return m_borderWidth; }
+ const wxTextAttrDimension& GetWidth() const { return m_borderWidth; }
+ void SetWidth(const wxTextAttrDimension& width) { m_borderWidth = width; }
+
+ bool HasStyle() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_STYLE) != 0; }
+ bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; }
+ bool HasWidth() const { return m_borderWidth.IsPresent(); }
+
+ bool IsValid() const { return HasStyle() && HasColour() && HasWidth(); }
+
+ int GetFlags() const { return m_flags; }
+ void SetFlags(int flags) { m_flags = flags; }
+ void AddFlag(int flag) { m_flags |= flag; }
+ void RemoveFlag(int flag) { m_flags &= ~flag; }
+
+ int m_borderStyle;
+ unsigned long m_borderColour;
+ wxTextAttrDimension m_borderWidth;
+ int m_flags;
+};
+
+// Borders
+class WXDLLIMPEXP_RICHTEXT wxTextAttrBorders
+{
+public:
+ wxTextAttrBorders() { }
+
+ 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;
+ }
+
+ // Set style of all borders
+ void SetStyle(int style);
+
+ // Set colour of all borders
+ void SetColour(unsigned long colour);
+ void SetColour(const wxColour& colour);
+
+ // Set width of all borders
+ void SetWidth(const wxTextAttrDimension& width);
+
+ // Reset
+ void Reset() { m_left.Reset(); m_right.Reset(); m_top.Reset(); m_bottom.Reset(); }
+
+ // Partial equality test
+ bool EqPartial(const wxTextAttrBorders& borders) const;
+
+ // Apply border to 'this', but not if the same as compareWith
+ bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = NULL);
+
+ // Remove 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);
+
+ bool HasBorder() const { return m_left.IsValid() || m_right.IsValid() || m_top.IsValid() || m_bottom.IsValid(); }
+
+ const wxTextAttrBorder& GetLeft() const { return m_left; }
+ wxTextAttrBorder& GetLeft() { return m_left; }
+
+ const wxTextAttrBorder& GetRight() const { return m_right; }
+ wxTextAttrBorder& GetRight() { return m_right; }
+
+ const wxTextAttrBorder& GetTop() const { return m_top; }
+ wxTextAttrBorder& GetTop() { return m_top; }
+
+ const wxTextAttrBorder& GetBottom() const { return m_bottom; }
+ wxTextAttrBorder& GetBottom() { return m_bottom; }
+
+ wxTextAttrBorder m_left, m_right, m_top, m_bottom;
+
+};
+
+// ----------------------------------------------------------------------------
+// wxTextBoxAttr: a structure containing box attributes
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_RICHTEXT wxTextBoxAttr
+{
+public:
+ // ctors
+ wxTextBoxAttr() { Init(); }
+ wxTextBoxAttr(const wxTextBoxAttr& attr) { Init(); (*this) = attr; }
+
+ // Initialise this object.
+ void Init() { Reset(); }
+
+ // Reset 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
+ bool EqPartial(const wxTextBoxAttr& attr) const;
+
+ // Merges the given attributes. 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 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);
+
+ // Remove specified attributes from this object
+ bool RemoveStyle(const wxTextBoxAttr& attr);
+
+ // Set flags
+ void SetFlags(int flags) { m_flags = flags; }
+
+ // Get flags
+ int GetFlags() const { return m_flags; }
+
+ // Is this flag present?
+ bool HasFlag(wxTextBoxAttrFlags flag) const { return (m_flags & flag) != 0; }
+
+ // Remove this flag
+ void RemoveFlag(wxTextBoxAttrFlags flag) { m_flags &= ~flag; }
+
+ // Add this flag
+ void AddFlag(wxTextBoxAttrFlags flag) { m_flags |= flag; }
+
+ // Is this default? I.e. no flags set
+ bool IsDefault() const;
+
+ // Float mode
+ short int GetFloatMode() const { return m_floatMode; }
+ void SetFloatMode(short int mode) { m_floatMode = mode; m_flags |= wxTEXT_BOX_ATTR_FLOAT; }
+ bool HasFloatMode() const { return HasFlag(wxTEXT_BOX_ATTR_FLOAT); }
+ bool IsFloating() const { return HasFloatMode() && GetFloatMode() != wxTEXT_BOX_ATTR_FLOAT_NONE; }
+
+ // Whether to wrap text after object
+ short int GetClearMode() const { return m_clearMode; }
+ void SetClearMode(short int mode) { m_clearMode = mode; m_flags |= wxTEXT_BOX_ATTR_CLEAR; }
+ bool HasClearMode() const { return HasFlag(wxTEXT_BOX_ATTR_CLEAR); }
+
+ // Whether to collapse borders
+ int GetCollapseBorders() const { return m_collapseMode ; }
+ void SetCollapseBorders(int collapse) { m_collapseMode = collapse; m_flags |= wxTEXT_BOX_ATTR_COLLAPSE_BORDERS; }
+ bool HasCollapseBorders() const { return HasFlag(wxTEXT_BOX_ATTR_COLLAPSE_BORDERS); }
+
+ // Margins
+
+ wxTextAttrDimensions& GetMargins() { return m_margins; }
+ const wxTextAttrDimensions& GetMargins() const { return m_margins; }
+
+ wxTextAttrDimension& GetLeftMargin() { return m_margins.m_left; }
+ const wxTextAttrDimension& GetLeftMargin() const { return m_margins.m_left; }
+
+ wxTextAttrDimension& GetRightMargin() { return m_margins.m_right; }
+ const wxTextAttrDimension& GetRightMargin() const { return m_margins.m_right; }
+
+ wxTextAttrDimension& GetTopMargin() { return m_margins.m_top; }
+ const wxTextAttrDimension& GetTopMargin() const { return m_margins.m_top; }
+
+ wxTextAttrDimension& GetBottomMargin() { return m_margins.m_bottom; }
+ const wxTextAttrDimension& GetBottomMargin() const { return m_margins.m_bottom; }
+
+ // Position
+
+ wxTextAttrDimensions& GetPosition() { return m_position; }
+ const wxTextAttrDimensions& GetPosition() const { return m_position; }
+
+ wxTextAttrDimension& GetLeft() { return m_position.m_left; }
+ const wxTextAttrDimension& GetLeft() const { return m_position.m_left; }
+
+ wxTextAttrDimension& GetRight() { return m_position.m_right; }
+ const wxTextAttrDimension& GetRight() const { return m_position.m_right; }
+
+ wxTextAttrDimension& GetTop() { return m_position.m_top; }
+ const wxTextAttrDimension& GetTop() const { return m_position.m_top; }
+
+ wxTextAttrDimension& GetBottom() { return m_position.m_bottom; }
+ const wxTextAttrDimension& GetBottom() const { return m_position.m_bottom; }
+
+ // Padding
+
+ wxTextAttrDimensions& GetPadding() { return m_padding; }
+ const wxTextAttrDimensions& GetPadding() const { return m_padding; }
+
+ wxTextAttrDimension& GetLeftPadding() { return m_padding.m_left; }
+ const wxTextAttrDimension& GetLeftPadding() const { return m_padding.m_left; }
+
+ wxTextAttrDimension& GetRightPadding() { return m_padding.m_right; }
+ const wxTextAttrDimension& GetRightPadding() const { return m_padding.m_right; }
+
+ wxTextAttrDimension& GetTopPadding() { return m_padding.m_top; }
+ const wxTextAttrDimension& GetTopPadding() const { return m_padding.m_top; }
+
+ wxTextAttrDimension& GetBottomPadding() { return m_padding.m_bottom; }
+ const wxTextAttrDimension& GetBottomPadding() const { return m_padding.m_bottom; }
+
+ // Border
+
+ wxTextAttrBorders& GetBorder() { return m_border; }
+ const wxTextAttrBorders& GetBorder() const { return m_border; }
+
+ wxTextAttrBorder& GetLeftBorder() { return m_border.m_left; }
+ const wxTextAttrBorder& GetLeftBorder() const { return m_border.m_left; }
+
+ wxTextAttrBorder& GetTopBorder() { return m_border.m_top; }
+ const wxTextAttrBorder& GetTopBorder() const { return m_border.m_top; }
+
+ wxTextAttrBorder& GetRightBorder() { return m_border.m_right; }
+ const wxTextAttrBorder& GetRightBorder() const { return m_border.m_right; }
+
+ wxTextAttrBorder& GetBottomBorder() { return m_border.m_bottom; }
+ const wxTextAttrBorder& GetBottomBorder() const { return m_border.m_bottom; }
+
+ // Outline
+
+ wxTextAttrBorders& GetOutline() { return m_outline; }
+ const wxTextAttrBorders& GetOutline() const { return m_outline; }
+
+ wxTextAttrBorder& GetLeftOutline() { return m_outline.m_left; }
+ const wxTextAttrBorder& GetLeftOutline() const { return m_outline.m_left; }
+
+ wxTextAttrBorder& GetTopOutline() { return m_outline.m_top; }
+ const wxTextAttrBorder& GetTopOutline() const { return m_outline.m_top; }
+
+ wxTextAttrBorder& GetRightOutline() { return m_outline.m_right; }
+ const wxTextAttrBorder& GetRightOutline() const { return m_outline.m_right; }
+
+ wxTextAttrBorder& GetBottomOutline() { return m_outline.m_bottom; }
+ const wxTextAttrBorder& GetBottomOutline() const { return m_outline.m_bottom; }
+
+
+ // Width and height
+
+ wxTextAttrDimension& GetWidth() { return m_width; }
+ const wxTextAttrDimension& GetWidth() const { return m_width; }
+
+ wxTextAttrDimension& GetHeight() { return m_height; }
+ const wxTextAttrDimension& GetHeight() const { return m_height; }
+
+public:
+
+ int m_flags;
+
+ wxTextAttrDimensions m_margins;
+ wxTextAttrDimensions m_padding;
+ wxTextAttrDimensions m_position;
+
+ wxTextAttrDimension m_width;
+ wxTextAttrDimension m_height;
+
+ wxTextAttrBorders m_border;
+ wxTextAttrBorders m_outline;
+
+ short int m_floatMode;
+ short int m_clearMode;
+ short int m_collapseMode;
+};
+
+// ----------------------------------------------------------------------------
+// wxRichTextAttr: an enhanced attribute
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextAttr: public wxTextAttr
+{
+public:
+ wxRichTextAttr(const wxTextAttr& attr) { wxTextAttr::Copy(attr); }
+ wxRichTextAttr(const wxRichTextAttr& attr) { Copy(attr); }
+ wxRichTextAttr() {}
+
+ // Copy
+ void Copy(const wxRichTextAttr& attr);
+
+ // Assignment
+ void operator=(const wxRichTextAttr& attr) { Copy(attr); }
+ 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 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 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);
+
+ // Remove specified attributes from this object
+ bool RemoveStyle(const wxRichTextAttr& attr);
+
+ wxTextBoxAttr& GetTextBoxAttr() { return m_textBoxAttr; }
+ const wxTextBoxAttr& GetTextBoxAttr() const { return m_textBoxAttr; }
+ void SetTextBoxAttr(const wxTextBoxAttr& attr) { m_textBoxAttr = attr; }
+
+ wxTextBoxAttr m_textBoxAttr;
+};
+
+WX_DECLARE_USER_EXPORTED_OBJARRAY(wxVariant, wxRichTextVariantArray, WXDLLIMPEXP_RICHTEXT);
+
+// ----------------------------------------------------------------------------
+// wxRichTextProperties - A simple property class using wxVariants
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextProperties: public wxObject
+{
+DECLARE_DYNAMIC_CLASS(wxRichTextProperties)
+public:
+ wxRichTextProperties() {}
+ wxRichTextProperties(const wxRichTextProperties& props) { Copy(props); }
+
+ void operator=(const wxRichTextProperties& props) { Copy(props); }
+ bool operator==(const wxRichTextProperties& props) const;
+ void Copy(const wxRichTextProperties& props) { m_properties = props.m_properties; }
+ const wxVariant& operator[](size_t idx) const { return m_properties[idx]; }
+ wxVariant& operator[](size_t idx) { return m_properties[idx]; }
+ void Clear() { m_properties.Clear(); }
+
+ const wxRichTextVariantArray& GetProperties() const { return m_properties; }
+ wxRichTextVariantArray& GetProperties() { return m_properties; }
+ void SetProperties(const wxRichTextVariantArray& props) { m_properties = props; }
+
+ wxArrayString GetPropertyNames() const;
+
+ size_t GetCount() const { return m_properties.GetCount(); }
+
+ int HasProperty(const wxString& name) const { return Find(name) != -1; }
+
+ int Find(const wxString& name) const;
+ const wxVariant& GetProperty(const wxString& name) const;
+ wxVariant* FindOrCreateProperty(const wxString& name);
+
+ wxString GetPropertyString(const wxString& name) const;
+ long GetPropertyLong(const wxString& name) const;
+ bool GetPropertyBool(const wxString& name) const;
+ double GetPropertyDouble(const wxString& name) const;
+
+ void SetProperty(const wxVariant& variant);
+ void SetProperty(const wxString& name, const wxVariant& variant);
+ void SetProperty(const wxString& name, const wxString& value);
+ void SetProperty(const wxString& name, long value);
+ void SetProperty(const wxString& name, double value);
+ void SetProperty(const wxString& name, bool value);
+
+protected:
+ wxRichTextVariantArray m_properties;
+};
+
+
+/*!
+ * wxRichTextFontTable
+ * Manages quick access to a pool of fonts for rendering rich text
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable: public wxObject
+{
+public:
+ wxRichTextFontTable();
+
+ wxRichTextFontTable(const wxRichTextFontTable& table);
+ virtual ~wxRichTextFontTable();
+
+ bool IsOk() const { return m_refData != NULL; }
+
+ wxFont FindFont(const wxRichTextAttr& fontSpec);
+ void Clear();
+
+ void operator= (const wxRichTextFontTable& table);
+ bool operator == (const wxRichTextFontTable& table) const;
+ bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); }
+
+protected:
+
+ DECLARE_DYNAMIC_CLASS(wxRichTextFontTable)
+};