X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/590a0f8bcb889dc4e99ce26a378c02cbf57b9bdb..ab67e8874db324fab5223cc8d5dff8a8de3e2b77:/include/wx/richtext/richtextbuffer.h diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index af21f78675..b9052fe843 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -130,6 +130,9 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextDrawingHandler; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextField; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFieldType; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent; @@ -192,7 +195,10 @@ enum wxRichTextHitTestFlags wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS = 0x20, // Ignore floating objects - wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS = 0x40 + wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS = 0x40, + + // Don't recurse into objects marked as atomic + wxRICHTEXT_HITTEST_HONOUR_ATOMIC = 0x80 }; /** @@ -275,7 +281,7 @@ enum wxRichTextHitTestFlags // A special flag telling the buffer to keep the first paragraph style // as-is, when deleting a paragraph marker. In future we might pass a // flag to InsertFragment and DeleteRange to indicate the appropriate mode. -#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x10000000 +#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x20000000 /** Default superscript/subscript font multiplication factor. @@ -329,7 +335,8 @@ 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_ABSOLUTE = 0x0020, // Relative to the parent + wxTEXT_BOX_ATTR_POSITION_FIXED = 0x0040, // Relative to the top-level window wxTEXT_BOX_ATTR_POSITION_MASK = 0x00F0 }; @@ -363,9 +370,12 @@ public: void Reset() { m_value = 0; m_flags = 0; } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a dim are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a dim but not + in this object. */ - bool EqPartial(const wxTextAttrDimension& dim) const; + bool EqPartial(const wxTextAttrDimension& dim, bool weakTest = true) const; /** Apply the dimension, but not those identical to @a compareWith if present. */ @@ -490,13 +500,16 @@ public: 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. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a dim sare present. If @a weakTest is + @false, the function will fail if an attribute is present in @a dims but not + in this object. */ - bool EqPartial(const wxTextAttrDimensions& dims) const; + bool EqPartial(const wxTextAttrDimensions& dims, bool weakTest = true) const; /** - Apply border to 'this', but not if the same as @a compareWith. + Apply to 'this', but not if the same as @a compareWith. */ bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = NULL); @@ -581,12 +594,15 @@ public: bool operator==(const wxTextAttrSize& size) const { return m_width == size.m_width && m_height == size.m_height ; } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a size are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a size but not + in this object. */ - bool EqPartial(const wxTextAttrSize& dims) const; + bool EqPartial(const wxTextAttrSize& size, bool weakTest = true) const; /** - Apply border to this object, but not if the same as @a compareWith. + Apply to this object, but not if the same as @a compareWith. */ bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = NULL); @@ -806,9 +822,12 @@ public: void Reset() { m_borderStyle = 0; m_borderColour = 0; m_flags = 0; m_borderWidth.Reset(); } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a border are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a border but not + in this object. */ - bool EqPartial(const wxTextAttrBorder& border) const; + bool EqPartial(const wxTextAttrBorder& border, bool weakTest = true) const; /** Applies the border to this object, but not if the same as @a compareWith. @@ -982,9 +1001,12 @@ public: void Reset() { m_left.Reset(); m_right.Reset(); m_top.Reset(); m_bottom.Reset(); } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a borders are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a borders but not + in this object. */ - bool EqPartial(const wxTextAttrBorders& borders) const; + bool EqPartial(const wxTextAttrBorders& borders, bool weakTest = true) const; /** Applies border to this object, but not if the same as @a compareWith. @@ -1080,10 +1102,13 @@ public: bool operator== (const wxTextBoxAttr& attr) const; /** - Partial equality test, ignoring unset attributes. + Partial equality test, ignoring unset attributes. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a attr are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a attr but not + in this object. */ - bool EqPartial(const wxTextBoxAttr& attr) const; + bool EqPartial(const wxTextBoxAttr& attr, bool weakTest = true) const; /** Merges the given attributes. If @a compareWith is non-NULL, then it will be used @@ -1482,9 +1507,12 @@ public: bool operator==(const wxRichTextAttr& attr) const; /** - Partial equality test taking comparison object into account. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a attr are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a attr but not + in this object. */ - bool EqPartial(const wxRichTextAttr& attr) const; + bool EqPartial(const wxRichTextAttr& attr, bool weakTest = true) const; /** Merges the given attributes. If @a compareWith @@ -1745,8 +1773,15 @@ public: */ bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); } + /** + Set the font scale factor. + */ + void SetFontScale(double fontScale); + protected: + double m_fontScale; + DECLARE_DYNAMIC_CLASS(wxRichTextFontTable) }; @@ -2051,6 +2086,52 @@ public: wxRichTextParagraphLayoutBox* m_container; }; +/** + @class wxRichTextDrawingContext + + A class for passing information to drawing and measuring functions. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextDrawingContext: public wxObject +{ + DECLARE_CLASS(wxRichTextDrawingContext) +public: + + /** + Pass the buffer to the context so the context can retrieve information + such as virtual attributes. + */ + wxRichTextDrawingContext(wxRichTextBuffer* buffer) { Init(); m_buffer = buffer; } + + void Init() { m_buffer = NULL; } + + /** + Does this object have virtual attributes? + Virtual attributes can be provided for visual cues without + affecting the actual styling. + */ + bool HasVirtualAttributes(wxRichTextObject* obj) const; + + /** + Returns the virtual attributes for this object. + Virtual attributes can be provided for visual cues without + affecting the actual styling. + */ + wxRichTextAttr GetVirtualAttributes(wxRichTextObject* obj) const; + + /** + Applies any virtual attributes relevant to this object. + */ + bool ApplyVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const; + + wxRichTextBuffer* m_buffer; +}; + /** @class wxRichTextObject @@ -2079,7 +2160,7 @@ public: Draw the item, within the given range. Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping) */ - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0; + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0; /** Lay the item out at the specified position with the given size constraint. @@ -2087,7 +2168,7 @@ public: and @a parentRect is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box). */ - virtual bool Layout(wxDC& dc, const wxRect& rect, const wxRect& parentRect, int style) = 0; + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) = 0; /** Hit-testing: returns a flag indicating hit test details, plus @@ -2106,12 +2187,12 @@ public: @return One of the ::wxRichTextHitTestFlags values. */ - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); /** Finds the absolute position and row height for the given character position. */ - virtual bool FindPosition(wxDC& WXUNUSED(dc), long WXUNUSED(index), wxPoint& WXUNUSED(pt), int* WXUNUSED(height), bool WXUNUSED(forceLineStart)) { return false; } + virtual bool FindPosition(wxDC& WXUNUSED(dc), wxRichTextDrawingContext& WXUNUSED(context), long WXUNUSED(index), wxPoint& WXUNUSED(pt), int* WXUNUSED(height), bool WXUNUSED(forceLineStart)) { return false; } /** Returns the best size, i.e. the ideal starting size for this object irrespective @@ -2125,7 +2206,7 @@ public: is invalid for this object. */ - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; /** Do a split from @a pos, returning an object containing the second part, and setting @@ -2360,10 +2441,16 @@ public: wxRichTextRange GetOwnRangeIfTopLevel() const { return IsTopLevel() ? m_ownRange : m_range; } /** - Returns @true if this object this composite. + Returns @true if this object is composite. */ virtual bool IsComposite() const { return false; } + /** + Returns @true if no user editing can be done inside the object. This returns @true for simple objects, + @false for most composite objects, but @true for fields, which if composite, should not be user-edited. + */ + virtual bool IsAtomic() const { return true; } + /** Returns a pointer to the parent object. */ @@ -2421,7 +2508,7 @@ public: Calculates the available content space in the given rectangle, given the margins, border and padding specified in the object's attributes. */ - virtual wxRect GetAvailableContentArea(wxDC& dc, const wxRect& outerRect) const; + virtual wxRect GetAvailableContentArea(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& outerRect) const; /** Lays out the object first with a given amount of space, and then if no width was specified in attr, @@ -2431,7 +2518,7 @@ public: in a previous layout pass to @a availableParentSpace, but should have a width of 50% of @a availableContainerSpace. (If these two rects were the same, a 2nd pass could see the object getting too small.) */ - virtual bool LayoutToBestSize(wxDC& dc, wxRichTextBuffer* buffer, + virtual bool LayoutToBestSize(wxDC& dc, wxRichTextDrawingContext& context, wxRichTextBuffer* buffer, const wxRichTextAttr& parentAttr, const wxRichTextAttr& attr, const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style); @@ -2451,7 +2538,7 @@ public: wxRichTextAttr& GetAttributes() { return m_attributes; } /** - Sets the object's properties. + Returns the object's properties. */ wxRichTextProperties& GetProperties() { return m_properties; } @@ -2461,7 +2548,7 @@ public: const wxRichTextProperties& GetProperties() const { return m_properties; } /** - Returns the object's properties. + Sets the object's properties. */ void SetProperties(const wxRichTextProperties& props) { m_properties = props; } @@ -2637,9 +2724,9 @@ public: // Overridables - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); - virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); + virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart); virtual void CalculateRange(long start, long& end); @@ -2647,7 +2734,7 @@ public: virtual wxString GetTextForRange(const wxRichTextRange& range) const; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; virtual void Dump(wxTextOutputStream& stream); @@ -2679,6 +2766,12 @@ public: */ virtual bool IsComposite() const { return true; } + /** + Returns @true if no user editing can be done inside the object. This returns @true for simple objects, + @false for most composite objects, but @true for fields, which if composite, should not be user-edited. + */ + virtual bool IsAtomic() const { return false; } + /** Returns true if the buffer is empty. */ @@ -2752,13 +2845,13 @@ public: // Overridables - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); - virtual bool Layout(wxDC& dc, const wxRect& rect, const wxRect& parentRect, int style); + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -2832,6 +2925,16 @@ public: bool InsertImageWithUndo(wxRichTextBuffer* buffer, long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags, const wxRichTextAttr& textAttr); + /** + Submits a command to insert the given field. Field data can be included in properties. + + @see wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + wxRichTextField* InsertFieldWithUndo(wxRichTextBuffer* buffer, long pos, const wxString& fieldType, + const wxRichTextProperties& properties, + wxRichTextCtrl* ctrl, int flags, + const wxRichTextAttr& textAttr); + /** Returns the style that is appropriate for a new paragraph at this position. If the previous paragraph has a paragraph style name, looks up the next-paragraph @@ -2852,7 +2955,7 @@ public: /** Draws the floating objects in this buffer. */ - void DrawFloats(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + void DrawFloats(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); /** Moves an anchored object to another paragraph. @@ -3184,6 +3287,12 @@ public: virtual wxRichTextObject* Clone() const { return new wxRichTextParagraphLayoutBox(*this); } + /** + Prepares the content just before insertion (or after buffer reset). + Currently is only called if undo mode is on. + */ + virtual void PrepareContent(wxRichTextParagraphLayoutBox& container); + /** Insert fragment into this box at the given position. If partialParagraph is true, it is assumed that the last (or only) paragraph is just a piece of data with no paragraph @@ -3344,7 +3453,7 @@ public: // Overridables - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); virtual wxString GetXMLNodeName() const { return wxT("textbox"); } @@ -3365,6 +3474,474 @@ public: protected: }; +/** + @class wxRichTextField + + This class implements the general concept of a field, an object that represents + additional functionality such as a footnote, a bookmark, a page number, a table + of contents, and so on. Extra information (such as a bookmark name) can be stored + in the object properties. + + Drawing, layout, and property editing is delegated to classes derived + from wxRichTextFieldType, such as instances of wxRichTextFieldTypeStandard; this makes + the use of fields an efficient method of introducing extra functionality, since + most of the information required to draw a field (such as a bitmap) is kept centrally + in a single field type definition. + + The FieldType property, accessed by SetFieldType/GetFieldType, is used to retrieve + the field type definition. So be careful not to overwrite this property. + + wxRichTextField is derived from wxRichTextParagraphLayoutBox, which means that it + can contain its own read-only content, refreshed when the application calls the UpdateField + function. Whether a field is treated as a composite or a single graphic is determined + by the field type definition. If using wxRichTextFieldTypeStandard, passing the display + type wxRICHTEXT_FIELD_STYLE_COMPOSITE to the field type definition causes the field + to behave like a composite; the other display styles display a simple graphic. + When implementing a composite field, you will still need to derive from wxRichTextFieldTypeStandard + or wxRichTextFieldType, if only to implement UpdateField to refresh the field content + appropriately. wxRichTextFieldTypeStandard is only one possible implementation, but + covers common needs especially for simple, static fields using text or a bitmap. + + Register field types on application initialisation with the static function + wxRichTextParagraphLayoutBox::AddFieldType. They will be deleted automatically + on application exit. + + An application can write a field to a control with wxRichTextCtrl::WriteField, + taking a field type, the properties for the field, and optional attributes. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFieldTypeStandard, wxRichTextFieldType, wxRichTextParagraphLayoutBox, wxRichTextProperties, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextField: public wxRichTextParagraphLayoutBox +{ + DECLARE_DYNAMIC_CLASS(wxRichTextField) +public: +// Constructors + + /** + Default constructor; optionally pass the parent object. + */ + + wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = NULL); + + /** + Copy constructor. + */ + + wxRichTextField(const wxRichTextField& obj): wxRichTextParagraphLayoutBox() { Copy(obj); } + +// Overridables + + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); + + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + + virtual wxString GetXMLNodeName() const { return wxT("field"); } + + virtual bool CanEditProperties() const; + + virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer); + + virtual wxString GetPropertiesMenuLabel() const; + + virtual bool AcceptsFocus() const { return false; } + + virtual void CalculateRange(long start, long& end); + + /** + If a field has children, we don't want the user to be able to edit it. + */ + virtual bool IsAtomic() const { return true; } + + virtual bool IsEmpty() const { return false; } + + virtual bool IsTopLevel() const; + +// Accessors + + void SetFieldType(const wxString& fieldType) { GetProperties().SetProperty(wxT("FieldType"), fieldType); } + wxString GetFieldType() const { return GetProperties().GetPropertyString(wxT("FieldType")); } + +// Operations + + /** + Update the field; delegated to the associated field type. This would typically expand the field to its value, + if this is a dynamically changing and/or composite field. + */ + virtual bool UpdateField(wxRichTextBuffer* buffer); + + virtual wxRichTextObject* Clone() const { return new wxRichTextField(*this); } + + void Copy(const wxRichTextField& obj); + +protected: +}; + +/** + @class wxRichTextFieldType + + The base class for custom field types. Each type definition handles one + field type. Override functions to provide drawing, layout, updating and + property editing functionality for a field. + + Register field types on application initialisation with the static function + wxRichTextParagraphLayoutBox::AddFieldType. They will be deleted automatically + on application exit. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFieldTypeStandard, wxRichTextField, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFieldType: public wxObject +{ + DECLARE_CLASS(wxRichTextFieldType) +public: + /** + Creates a field type definition. + */ + wxRichTextFieldType(const wxString& name = wxEmptyString) + : m_name(name) + { } + + /** + Copy constructor. + */ + wxRichTextFieldType(const wxRichTextFieldType& fieldType) + : wxObject(fieldType) + { Copy(fieldType); } + + void Copy(const wxRichTextFieldType& fieldType) { m_name = fieldType.m_name; } + + /** + Draw the item, within the given range. Some objects may ignore the range (for + example paragraphs) while others must obey it (lines, to implement wrapping) + */ + virtual bool Draw(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style) = 0; + + /** + Lay the item out at the specified position with the given size constraint. + Layout must set the cached size. @rect is the available space for the object, + and @a parentRect is the container that is used to determine a relative size + or position (for example if a text box must be 50% of the parent text box). + */ + virtual bool Layout(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) = 0; + + /** + Returns the object size for the given range. Returns @false if the range + is invalid for this object. + */ + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; + + /** + Returns @true if we can edit the object's properties via a GUI. + */ + virtual bool CanEditProperties(wxRichTextField* WXUNUSED(obj)) const { return false; } + + /** + Edits the object's properties via a GUI. + */ + virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) { return false; } + + /** + Returns the label to be used for the properties context menu item. + */ + virtual wxString GetPropertiesMenuLabel(wxRichTextField* WXUNUSED(obj)) const { return wxEmptyString; } + + /** + Update the field. This would typically expand the field to its value, + if this is a dynamically changing and/or composite field. + */ + virtual bool UpdateField(wxRichTextBuffer* WXUNUSED(buffer), wxRichTextField* WXUNUSED(obj)) { return false; } + + /** + Returns @true if this object is top-level, i.e. contains its own paragraphs, such as a text box. + */ + virtual bool IsTopLevel(wxRichTextField* WXUNUSED(obj)) const { return true; } + + /** + Sets the field type name. There should be a unique name per field type object. + */ + void SetName(const wxString& name) { m_name = name; } + + /** + Returns the field type name. There should be a unique name per field type object. + */ + wxString GetName() const { return m_name; } + +protected: + + wxString m_name; +}; + +WX_DECLARE_STRING_HASH_MAP(wxRichTextFieldType*, wxRichTextFieldTypeHashMap); + +/** + @class wxRichTextFieldTypeStandard + + A field type that can handle fields with text or bitmap labels, with a small range + of styles for implementing rectangular fields and fields that can be used for start + and end tags. + + The border, text and background colours can be customised; the default is + white text on a black background. + + The following display styles can be used. + + @beginStyleTable + @style{wxRICHTEXT_FIELD_STYLE_COMPOSITE} + Creates a composite field; you will probably need to derive a new class to implement UpdateField. + @style{wxRICHTEXT_FIELD_STYLE_RECTANGLE} + Shows a rounded rectangle background. + @style{wxRICHTEXT_FIELD_STYLE_NO_BORDER} + Suppresses the background and border; mostly used with a bitmap label. + @style{wxRICHTEXT_FIELD_STYLE_START_TAG} + Shows a start tag background, with the pointy end facing right. + @style{wxRICHTEXT_FIELD_STYLE_END_TAG} + Shows an end tag background, with the pointy end facing left. + @endStyleTable + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextFieldType, wxRichTextField, wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextFieldTypeStandard: public wxRichTextFieldType +{ + DECLARE_CLASS(wxRichTextFieldTypeStandard) +public: + + // Display style types + enum { wxRICHTEXT_FIELD_STYLE_COMPOSITE = 0x01, + wxRICHTEXT_FIELD_STYLE_RECTANGLE = 0x02, + wxRICHTEXT_FIELD_STYLE_NO_BORDER = 0x04, + wxRICHTEXT_FIELD_STYLE_START_TAG = 0x08, + wxRICHTEXT_FIELD_STYLE_END_TAG = 0x10 + }; + + /** + Constructor, creating a field type definition with a text label. + + @param parent + The name of the type definition. This must be unique, and is the type + name used when adding a field to a control. + @param label + The text label to be shown on the field. + @param displayStyle + The display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE, + wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG, + wxRICHTEXT_FIELD_STYLE_END_TAG. + + */ + wxRichTextFieldTypeStandard(const wxString& name, const wxString& label, int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE); + + /** + Constructor, creating a field type definition with a bitmap label. + + @param parent + The name of the type definition. This must be unique, and is the type + name used when adding a field to a control. + @param label + The bitmap label to be shown on the field. + @param displayStyle + The display style: one of wxRICHTEXT_FIELD_STYLE_RECTANGLE, + wxRICHTEXT_FIELD_STYLE_NO_BORDER, wxRICHTEXT_FIELD_STYLE_START_TAG, + wxRICHTEXT_FIELD_STYLE_END_TAG. + + */ + wxRichTextFieldTypeStandard(const wxString& name, const wxBitmap& bitmap, int displayStyle = wxRICHTEXT_FIELD_STYLE_NO_BORDER); + + /** + The default constructor. + + */ + wxRichTextFieldTypeStandard() { Init(); } + + /** + The copy constructor. + + */ + wxRichTextFieldTypeStandard(const wxRichTextFieldTypeStandard& field) + : wxRichTextFieldType(field) + { Copy(field); } + + /** + Initialises the object. + */ + void Init(); + + /** + Copies the object. + */ + void Copy(const wxRichTextFieldTypeStandard& field); + + /** + The assignment operator. + */ + void operator=(const wxRichTextFieldTypeStandard& field) { Copy(field); } + + /** + Draw the item, within the given range. Some objects may ignore the range (for + example paragraphs) while others must obey it (lines, to implement wrapping) + */ + virtual bool Draw(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + + /** + Lay the item out at the specified position with the given size constraint. + Layout must set the cached size. @rect is the available space for the object, + and @a parentRect is the container that is used to determine a relative size + or position (for example if a text box must be 50% of the parent text box). + */ + virtual bool Layout(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); + + /** + Returns the object size for the given range. Returns @false if the range + is invalid for this object. + */ + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + + /** + Get the size of the field, given the label, font size, and so on. + */ + wxSize GetSize(wxRichTextField* obj, wxDC& dc, wxRichTextDrawingContext& context, int style) const; + + /** + Returns @true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE, @false otherwise. + */ + virtual bool IsTopLevel(wxRichTextField* WXUNUSED(obj)) const { return (GetDisplayStyle() & wxRICHTEXT_FIELD_STYLE_COMPOSITE) != 0; } + + /** + Sets the text label for fields of this type. + */ + void SetLabel(const wxString& label) { m_label = label; } + + /** + Returns the text label for fields of this type. + */ + const wxString& GetLabel() const { return m_label; } + + /** + Sets the bitmap label for fields of this type. + */ + void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + + /** + Gets the bitmap label for fields of this type. + */ + const wxBitmap& GetBitmap() const { return m_bitmap; } + + /** + Gets the display style for fields of this type. + */ + int GetDisplayStyle() const { return m_displayStyle; } + + /** + Sets the display style for fields of this type. + */ + void SetDisplayStyle(int displayStyle) { m_displayStyle = displayStyle; } + + /** + Gets the font used for drawing the text label. + */ + const wxFont& GetFont() const { return m_font; } + + /** + Sets the font used for drawing the text label. + */ + void SetFont(const wxFont& font) { m_font = font; } + + /** + Gets the colour used for drawing the text label. + */ + const wxColour& GetTextColour() const { return m_textColour; } + + /** + Sets the colour used for drawing the text label. + */ + void SetTextColour(const wxColour& colour) { m_textColour = colour; } + + /** + Gets the colour used for drawing the field border. + */ + const wxColour& GetBorderColour() const { return m_borderColour; } + + /** + Sets the colour used for drawing the field border. + */ + void SetBorderColour(const wxColour& colour) { m_borderColour = colour; } + + /** + Gets the colour used for drawing the field background. + */ + const wxColour& GetBackgroundColour() const { return m_backgroundColour; } + + /** + Sets the colour used for drawing the field background. + */ + void SetBackgroundColour(const wxColour& colour) { m_backgroundColour = colour; } + + /** + Sets the vertical padding (the distance between the border and the text). + */ + void SetVerticalPadding(int padding) { m_verticalPadding = padding; } + + /** + Gets the vertical padding (the distance between the border and the text). + */ + int GetVerticalPadding() const { return m_verticalPadding; } + + /** + Sets the horizontal padding (the distance between the border and the text). + */ + void SetHorizontalPadding(int padding) { m_horizontalPadding = padding; } + + /** + Sets the horizontal padding (the distance between the border and the text). + */ + int GetHorizontalPadding() const { return m_horizontalPadding; } + + /** + Sets the horizontal margin surrounding the field object. + */ + void SetHorizontalMargin(int margin) { m_horizontalMargin = margin; } + + /** + Gets the horizontal margin surrounding the field object. + */ + int GetHorizontalMargin() const { return m_horizontalMargin; } + + /** + Sets the vertical margin surrounding the field object. + */ + void SetVerticalMargin(int margin) { m_verticalMargin = margin; } + + /** + Gets the vertical margin surrounding the field object. + */ + int GetVerticalMargin() const { return m_verticalMargin; } + +protected: + + wxString m_label; + int m_displayStyle; + wxFont m_font; + wxColour m_textColour; + wxColour m_borderColour; + wxColour m_backgroundColour; + int m_verticalPadding; + int m_horizontalPadding; + int m_horizontalMargin; + int m_verticalMargin; + wxBitmap m_bitmap; +}; + /** @class wxRichTextLine @@ -3531,15 +4108,15 @@ public: // Overridables - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); - virtual bool Layout(wxDC& dc, const wxRect& rect, const wxRect& parentRect, int style); + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; - virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); + virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart); - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); virtual void CalculateRange(long start, long& end); @@ -3604,7 +4181,7 @@ public: Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left of the split. */ - bool FindWrapPosition(const wxRichTextRange& range, wxDC& dc, int availableSpace, long& wrapPosition, wxArrayInt* partialExtents); + bool FindWrapPosition(const wxRichTextRange& range, wxDC& dc, wxRichTextDrawingContext& context, int availableSpace, long& wrapPosition, wxArrayInt* partialExtents); /** Finds the object at the given position. @@ -3660,7 +4237,7 @@ public: /** Lays out the floating objects. */ - void LayoutFloat(wxDC& dc, const wxRect& rect, int style, wxRichTextFloatCollector* floatCollector); + void LayoutFloat(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style, wxRichTextFloatCollector* floatCollector); protected: @@ -3702,11 +4279,11 @@ public: // Overridables - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); - virtual bool Layout(wxDC& dc, const wxRect& rect, const wxRect& parentRect, int style); + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; virtual wxString GetTextForRange(const wxRichTextRange& range) const; @@ -3959,7 +4536,7 @@ public: /** Default constructor. */ - wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { } + wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { Init(); } /** Creates a wxRichTextImage from a wxImage. @@ -3976,13 +4553,18 @@ public: */ wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); } + /** + Initialisation. + */ + void Init(); + // Overridables - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); - virtual bool Layout(wxDC& dc, const wxRect& rect, const wxRect& parentRect, int style); + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; /** Returns the 'natural' size for this object - the image size. @@ -4026,12 +4608,12 @@ public: /** Sets the image cache. */ - void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; } + void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; m_originalImageSize = wxSize(bitmap.GetWidth(), bitmap.GetHeight()); } /** Resets the image cache. */ - void ResetImageCache() { m_imageCache = wxNullBitmap; } + void ResetImageCache() { m_imageCache = wxNullBitmap; m_originalImageSize = wxSize(-1, -1); } /** Returns the image block containing the raw data. @@ -4055,9 +4637,20 @@ public: */ virtual bool LoadImageCache(wxDC& dc, bool resetCache = false); + /** + Gets the original image size. + */ + wxSize GetOriginalImageSize() const { return m_originalImageSize; } + + /** + Sets the original image size. + */ + void SetOriginalImageSize(const wxSize& sz) { m_originalImageSize = sz; } + protected: wxRichTextImageBlock m_imageBlock; wxBitmap m_imageCache; + wxSize m_originalImageSize; }; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand; @@ -4143,6 +4736,31 @@ public: */ void SetFontTable(const wxRichTextFontTable& table) { m_fontTable = table; } + /** + Sets the scale factor for displaying fonts, for example for more comfortable + editing. + */ + void SetFontScale(double fontScale); + + /** + Returns the scale factor for displaying fonts, for example for more comfortable + editing. + */ + double GetFontScale() const { return m_fontScale; } + + /** + Sets the scale factor for displaying certain dimensions such as indentation and + inter-paragraph spacing. This can be useful when editing in a small control + where you still want legible text, but a minimum of wasted white space. + */ + void SetDimensionScale(double dimScale); + + /** + Returns the scale factor for displaying certain dimensions such as indentation + and inter-paragraph spacing. + */ + double GetDimensionScale() const { return m_dimensionScale; } + // Operations /** @@ -4526,7 +5144,7 @@ public: // Implementation - virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); + virtual int HitTest(wxDC& dc, wxRichTextDrawingContext& context, const wxPoint& pt, long& textPosition, wxRichTextObject** obj, wxRichTextObject** contextObj, int flags = 0); /** Copies the buffer. @@ -4651,6 +5269,68 @@ public: */ static void InitStandardHandlers(); + /** + Returns the drawing handlers. + */ + static wxList& GetDrawingHandlers() { return sm_drawingHandlers; } + + /** + Adds a drawing handler to the end. + */ + static void AddDrawingHandler(wxRichTextDrawingHandler *handler); + + /** + Inserts a drawing handler at the front. + */ + static void InsertDrawingHandler(wxRichTextDrawingHandler *handler); + + /** + Removes a drawing handler. + */ + static bool RemoveDrawingHandler(const wxString& name); + + /** + Finds a drawing handler by name. + */ + static wxRichTextDrawingHandler *FindDrawingHandler(const wxString& name); + + /** + Clean up drawing handlers. + */ + static void CleanUpDrawingHandlers(); + + /** + Returns the field types. + */ + static wxRichTextFieldTypeHashMap& GetFieldTypes() { return sm_fieldTypes; } + + /** + Adds a field type. + + @see RemoveFieldType(), FindFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + + */ + static void AddFieldType(wxRichTextFieldType *fieldType); + + /** + Removes a field type by name. + + @see AddFieldType(), FindFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + static bool RemoveFieldType(const wxString& name); + + /** + Finds a field type by name. + + @see RemoveFieldType(), AddFieldType(), wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard + */ + static wxRichTextFieldType *FindFieldType(const wxString& name); + + /** + Cleans up field types. + */ + static void CleanUpFieldTypes(); + /** Returns the renderer object. */ @@ -4734,6 +5414,12 @@ protected: /// File handlers static wxList sm_handlers; + /// Drawing handlers + static wxList sm_drawingHandlers; + + /// Field types + static wxRichTextFieldTypeHashMap sm_fieldTypes; + /// Renderer static wxRichTextRenderer* sm_renderer; @@ -4745,6 +5431,12 @@ protected: /// Scaling factor in use: needed to calculate correct dimensions when printing double m_scale; + + /// Font scale for adjusting the text size when editing + double m_fontScale; + + /// Dimension scale for reducing redundant whitespace when editing + double m_dimensionScale; }; /** @@ -4773,7 +5465,7 @@ public: // Overridables - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); virtual wxString GetXMLNodeName() const { return wxT("cell"); } @@ -4824,13 +5516,13 @@ public: // Overridables - virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style); virtual wxString GetXMLNodeName() const { return wxT("table"); } - virtual bool Layout(wxDC& dc, const wxRect& rect, const wxRect& parentRect, int style); + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -4848,7 +5540,7 @@ public: virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler); #endif - virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart); + virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart); virtual void CalculateRange(long start, long& end); @@ -5399,12 +6091,12 @@ public: virtual void SetVisible(bool visible) { m_visible = visible; } /** - Sets the name of the nandler. + Sets the name of the handler. */ void SetName(const wxString& name) { m_name = name; } /** - Returns the name of the nandler. + Returns the name of the handler. */ wxString GetName() const { return m_name; } @@ -5513,6 +6205,54 @@ protected: }; +/** + @class wxRichTextDrawingHandler + + The base class for custom drawing handlers. + Currently, drawing handlers can provide virtual attributes. + + @library{wxrichtext} + @category{richtext} + + @see wxRichTextBuffer, wxRichTextCtrl +*/ + +class WXDLLIMPEXP_RICHTEXT wxRichTextDrawingHandler: public wxObject +{ + DECLARE_CLASS(wxRichTextDrawingHandler) +public: + /** + Creates a drawing handler object. + */ + wxRichTextDrawingHandler(const wxString& name = wxEmptyString) + : m_name(name) + { } + + /** + Returns @true if this object has virtual attributes that we can provide. + */ + virtual bool HasVirtualAttributes(wxRichTextObject* obj) const = 0; + + /** + Provides virtual attributes that we can provide. + */ + virtual bool GetVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const = 0; + + /** + Sets the name of the handler. + */ + void SetName(const wxString& name) { m_name = name; } + + /** + Returns the name of the handler. + */ + wxString GetName() const { return m_name; } + +protected: + + wxString m_name; +}; + #if wxUSE_DATAOBJ /** @@ -5655,10 +6395,6 @@ inline bool wxRichTextHasStyle(int flags, int style) WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); -/// Compare two attribute objects, but take into account the flags -/// specifying attributes of interest. -WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); - /// Apply one style to another WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);