Added drawing context to allow 'virtual' (dynamic) attributes, for e.g. showing bookmarks without affecting the content
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -130,6 +130,7 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList;
|
|||||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine;
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine;
|
||||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph;
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph;
|
||||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler;
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler;
|
||||||
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextDrawingHandler;
|
||||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet;
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet;
|
||||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition;
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition;
|
||||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent;
|
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent;
|
||||||
@@ -2051,6 +2052,52 @@ public:
|
|||||||
wxRichTextParagraphLayoutBox* m_container;
|
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
|
@class wxRichTextObject
|
||||||
|
|
||||||
@@ -2079,7 +2126,7 @@ public:
|
|||||||
Draw the item, within the given range. Some objects may ignore the range (for
|
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)
|
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.
|
Lay the item out at the specified position with the given size constraint.
|
||||||
@@ -2087,7 +2134,7 @@ public:
|
|||||||
and @a parentRect is the container that is used to determine a relative size
|
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).
|
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
|
Hit-testing: returns a flag indicating hit test details, plus
|
||||||
@@ -2106,12 +2153,12 @@ public:
|
|||||||
@return One of the ::wxRichTextHitTestFlags values.
|
@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.
|
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
|
Returns the best size, i.e. the ideal starting size for this object irrespective
|
||||||
@@ -2125,7 +2172,7 @@ public:
|
|||||||
is invalid for this object.
|
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
|
Do a split from @a pos, returning an object containing the second part, and setting
|
||||||
@@ -2421,7 +2468,7 @@ public:
|
|||||||
Calculates the available content space in the given rectangle, given the
|
Calculates the available content space in the given rectangle, given the
|
||||||
margins, border and padding specified in the object's attributes.
|
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,
|
Lays out the object first with a given amount of space, and then if no width was specified in attr,
|
||||||
@@ -2431,7 +2478,7 @@ public:
|
|||||||
in a previous layout pass to @a availableParentSpace, but should have a width of 50% of @a availableContainerSpace.
|
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.)
|
(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 wxRichTextAttr& parentAttr, const wxRichTextAttr& attr,
|
||||||
const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style);
|
const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style);
|
||||||
|
|
||||||
@@ -2637,9 +2684,9 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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);
|
virtual void CalculateRange(long start, long& end);
|
||||||
|
|
||||||
@@ -2647,7 +2694,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
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);
|
virtual void Dump(wxTextOutputStream& stream);
|
||||||
|
|
||||||
@@ -2752,13 +2799,13 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
@@ -2852,7 +2899,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Draws the floating objects in this buffer.
|
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.
|
Moves an anchored object to another paragraph.
|
||||||
@@ -3344,7 +3391,7 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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"); }
|
virtual wxString GetXMLNodeName() const { return wxT("textbox"); }
|
||||||
|
|
||||||
@@ -3531,15 +3578,15 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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);
|
virtual void CalculateRange(long start, long& end);
|
||||||
|
|
||||||
@@ -3604,7 +3651,7 @@ public:
|
|||||||
Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left
|
Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left
|
||||||
of the split.
|
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.
|
Finds the object at the given position.
|
||||||
@@ -3660,7 +3707,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Lays out the floating objects.
|
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, int style, wxRichTextFloatCollector* floatCollector);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -3702,11 +3749,11 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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;
|
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||||
|
|
||||||
@@ -3978,11 +4025,11 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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.
|
Returns the 'natural' size for this object - the image size.
|
||||||
@@ -4526,7 +4573,7 @@ public:
|
|||||||
|
|
||||||
// Implementation
|
// 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.
|
Copies the buffer.
|
||||||
@@ -4651,6 +4698,36 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void InitStandardHandlers();
|
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 renderer object.
|
Returns the renderer object.
|
||||||
*/
|
*/
|
||||||
@@ -4734,6 +4811,9 @@ protected:
|
|||||||
/// File handlers
|
/// File handlers
|
||||||
static wxList sm_handlers;
|
static wxList sm_handlers;
|
||||||
|
|
||||||
|
/// Drawing handlers
|
||||||
|
static wxList sm_drawingHandlers;
|
||||||
|
|
||||||
/// Renderer
|
/// Renderer
|
||||||
static wxRichTextRenderer* sm_renderer;
|
static wxRichTextRenderer* sm_renderer;
|
||||||
|
|
||||||
@@ -4773,7 +4853,7 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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"); }
|
virtual wxString GetXMLNodeName() const { return wxT("cell"); }
|
||||||
|
|
||||||
@@ -4824,13 +4904,13 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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 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);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
@@ -4848,7 +4928,7 @@ public:
|
|||||||
virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
|
virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
|
||||||
#endif
|
#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);
|
virtual void CalculateRange(long start, long& end);
|
||||||
|
|
||||||
@@ -5513,6 +5593,54 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxRichTextDrawingHandler
|
||||||
|
|
||||||
|
The base class for custom drawing handlers.
|
||||||
|
Currently, drawing handlers can provide virtual handlers.
|
||||||
|
|
||||||
|
@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 nandler.
|
||||||
|
*/
|
||||||
|
void SetName(const wxString& name) { m_name = name; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name of the nandler.
|
||||||
|
*/
|
||||||
|
wxString GetName() const { return m_name; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
wxString m_name;
|
||||||
|
};
|
||||||
|
|
||||||
#if wxUSE_DATAOBJ
|
#if wxUSE_DATAOBJ
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1935,6 +1935,52 @@ public:
|
|||||||
wxRichTextParagraphLayoutBox* m_container;
|
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
|
@class wxRichTextObject
|
||||||
|
|
||||||
@@ -1963,7 +2009,7 @@ public:
|
|||||||
Draw the item, within the given range. Some objects may ignore the range (for
|
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)
|
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.
|
Lay the item out at the specified position with the given size constraint.
|
||||||
@@ -1971,7 +2017,7 @@ public:
|
|||||||
and @a parentRect is the container that is used to determine a relative size
|
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).
|
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
|
Hit-testing: returns a flag indicating hit test details, plus
|
||||||
@@ -1986,12 +2032,12 @@ public:
|
|||||||
@return One of the ::wxRichTextHitTestFlags values.
|
@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.
|
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
|
Returns the best size, i.e. the ideal starting size for this object irrespective
|
||||||
@@ -2005,7 +2051,7 @@ public:
|
|||||||
is invalid for this object.
|
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
|
Do a split from @a pos, returning an object containing the second part, and setting
|
||||||
@@ -2301,7 +2347,7 @@ public:
|
|||||||
Calculates the available content space in the given rectangle, given the
|
Calculates the available content space in the given rectangle, given the
|
||||||
margins, border and padding specified in the object's attributes.
|
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,
|
Lays out the object first with a given amount of space, and then if no width was specified in attr,
|
||||||
@@ -2311,7 +2357,7 @@ public:
|
|||||||
in a previous layout pass to @a availableParentSpace, but should have a width of 50% of @a availableContainerSpace.
|
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.)
|
(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 wxRichTextAttr& parentAttr, const wxRichTextAttr& attr,
|
||||||
const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style);
|
const wxRect& availableParentSpace, const wxRect& availableContainerSpace, int style);
|
||||||
|
|
||||||
@@ -2517,9 +2563,9 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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);
|
virtual void CalculateRange(long start, long& end);
|
||||||
|
|
||||||
@@ -2527,7 +2573,7 @@ public:
|
|||||||
|
|
||||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
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);
|
virtual void Dump(wxTextOutputStream& stream);
|
||||||
|
|
||||||
@@ -2632,13 +2678,13 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
@@ -2733,7 +2779,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Draws the floating objects in this buffer.
|
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.
|
Moves an anchored object to another paragraph.
|
||||||
@@ -3225,7 +3271,7 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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"); }
|
virtual wxString GetXMLNodeName() const { return wxT("textbox"); }
|
||||||
|
|
||||||
@@ -3412,15 +3458,15 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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);
|
virtual void CalculateRange(long start, long& end);
|
||||||
|
|
||||||
@@ -3485,7 +3531,7 @@ public:
|
|||||||
Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left
|
Finds a suitable wrap position. @a wrapPosition is the last position in the line to the left
|
||||||
of the split.
|
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.
|
Finds the object at the given position.
|
||||||
@@ -3541,7 +3587,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Lays out the floating objects.
|
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, int style, wxRichTextFloatCollector* floatCollector);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -3583,11 +3629,11 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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;
|
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||||
|
|
||||||
@@ -3859,11 +3905,11 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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.
|
Returns the 'natural' size for this object - the image size.
|
||||||
@@ -4407,7 +4453,7 @@ public:
|
|||||||
|
|
||||||
// Implementation
|
// 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.
|
Copies the buffer.
|
||||||
@@ -4532,6 +4578,36 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void InitStandardHandlers();
|
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 renderer object.
|
Returns the renderer object.
|
||||||
*/
|
*/
|
||||||
@@ -4615,6 +4691,9 @@ protected:
|
|||||||
/// File handlers
|
/// File handlers
|
||||||
static wxList sm_handlers;
|
static wxList sm_handlers;
|
||||||
|
|
||||||
|
/// Drawing handlers
|
||||||
|
static wxList sm_drawingHandlers;
|
||||||
|
|
||||||
/// Renderer
|
/// Renderer
|
||||||
static wxRichTextRenderer* sm_renderer;
|
static wxRichTextRenderer* sm_renderer;
|
||||||
|
|
||||||
@@ -4654,7 +4733,7 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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"); }
|
virtual wxString GetXMLNodeName() const { return wxT("cell"); }
|
||||||
|
|
||||||
@@ -4705,13 +4784,13 @@ public:
|
|||||||
|
|
||||||
// Overridables
|
// 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 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);
|
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||||
|
|
||||||
@@ -4729,7 +4808,7 @@ public:
|
|||||||
virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
|
virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
|
||||||
#endif
|
#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);
|
virtual void CalculateRange(long start, long& end);
|
||||||
|
|
||||||
@@ -5393,6 +5472,54 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxRichTextDrawingHandler
|
||||||
|
|
||||||
|
The base class for custom drawing handlers.
|
||||||
|
Currently, drawing handlers can provide virtual handlers.
|
||||||
|
|
||||||
|
@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 nandler.
|
||||||
|
*/
|
||||||
|
void SetName(const wxString& name) { m_name = name; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the name of the nandler.
|
||||||
|
*/
|
||||||
|
wxString GetName() const { return m_name; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
wxString m_name;
|
||||||
|
};
|
||||||
|
|
||||||
#if wxUSE_DATAOBJ
|
#if wxUSE_DATAOBJ
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -445,9 +445,10 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
drawingArea.SetPosition(GetLogicalPoint(drawingArea.GetPosition()));
|
drawingArea.SetPosition(GetLogicalPoint(drawingArea.GetPosition()));
|
||||||
|
|
||||||
wxRect availableSpace(GetClientSize());
|
wxRect availableSpace(GetClientSize());
|
||||||
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
if (GetBuffer().IsDirty())
|
if (GetBuffer().IsDirty())
|
||||||
{
|
{
|
||||||
GetBuffer().Layout(dc, availableSpace, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
|
GetBuffer().Layout(dc, context, availableSpace, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
|
||||||
GetBuffer().Invalidate(wxRICHTEXT_NONE);
|
GetBuffer().Invalidate(wxRICHTEXT_NONE);
|
||||||
SetupScrollbars();
|
SetupScrollbars();
|
||||||
}
|
}
|
||||||
@@ -464,7 +465,7 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
if ((GetExtraStyle() & wxRICHTEXT_EX_NO_GUIDELINES) == 0)
|
if ((GetExtraStyle() & wxRICHTEXT_EX_NO_GUIDELINES) == 0)
|
||||||
flags |= wxRICHTEXT_DRAW_GUIDELINES;
|
flags |= wxRICHTEXT_DRAW_GUIDELINES;
|
||||||
|
|
||||||
GetBuffer().Draw(dc, GetBuffer().GetOwnRange(), GetSelection(), drawingArea, 0 /* descent */, flags);
|
GetBuffer().Draw(dc, context, GetBuffer().GetOwnRange(), GetSelection(), drawingArea, 0 /* descent */, flags);
|
||||||
|
|
||||||
dc.DestroyClippingRegion();
|
dc.DestroyClippingRegion();
|
||||||
|
|
||||||
@@ -573,7 +574,8 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event)
|
|||||||
long position = 0;
|
long position = 0;
|
||||||
wxRichTextObject* hitObj = NULL;
|
wxRichTextObject* hitObj = NULL;
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
int hit = GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position, & hitObj, & contextObj);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
int hit = GetBuffer().HitTest(dc, context, event.GetLogicalPosition(dc), position, & hitObj, & contextObj);
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
// If there's no selection, or we're not inside it, this isn't an attempt to initiate Drag'n'Drop
|
// If there's no selection, or we're not inside it, this isn't an attempt to initiate Drag'n'Drop
|
||||||
@@ -639,8 +641,9 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
|
|||||||
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
||||||
wxRichTextObject* hitObj = NULL;
|
wxRichTextObject* hitObj = NULL;
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
// Only get objects at this level, not nested, because otherwise we couldn't swipe text at a single level.
|
// Only get objects at this level, not nested, because otherwise we couldn't swipe text at a single level.
|
||||||
int hit = GetFocusObject()->HitTest(dc, logicalPt, position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS);
|
int hit = GetFocusObject()->HitTest(dc, context, logicalPt, position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS);
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
if (m_preDrag)
|
if (m_preDrag)
|
||||||
@@ -652,7 +655,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
|
|||||||
long position = 0;
|
long position = 0;
|
||||||
wxRichTextObject* hitObj = NULL;
|
wxRichTextObject* hitObj = NULL;
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
int hit = GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position, & hitObj, & contextObj);
|
int hit = GetBuffer().HitTest(dc, context, event.GetLogicalPosition(dc), position, & hitObj, & contextObj);
|
||||||
wxRichTextParagraphLayoutBox* oldFocusObject = GetFocusObject();
|
wxRichTextParagraphLayoutBox* oldFocusObject = GetFocusObject();
|
||||||
wxRichTextParagraphLayoutBox* container = wxDynamicCast(contextObj, wxRichTextParagraphLayoutBox);
|
wxRichTextParagraphLayoutBox* container = wxDynamicCast(contextObj, wxRichTextParagraphLayoutBox);
|
||||||
if (container && container != GetFocusObject() && container->AcceptsFocus())
|
if (container && container != GetFocusObject() && container->AcceptsFocus())
|
||||||
@@ -823,7 +826,8 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
|
|||||||
flags = wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS;
|
flags = wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS;
|
||||||
container = GetFocusObject();
|
container = GetFocusObject();
|
||||||
}
|
}
|
||||||
int hit = container->HitTest(dc, logicalPt, position, & hitObj, & contextObj, flags);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
int hit = container->HitTest(dc, context, logicalPt, position, & hitObj, & contextObj, flags);
|
||||||
|
|
||||||
// See if we need to change the cursor
|
// See if we need to change the cursor
|
||||||
|
|
||||||
@@ -857,7 +861,8 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
|
|||||||
// Check for dragging across multiple containers
|
// Check for dragging across multiple containers
|
||||||
long position2 = 0;
|
long position2 = 0;
|
||||||
wxRichTextObject* hitObj2 = NULL, *contextObj2 = NULL;
|
wxRichTextObject* hitObj2 = NULL, *contextObj2 = NULL;
|
||||||
int hit2 = GetBuffer().HitTest(dc, logicalPt, position2, & hitObj2, & contextObj2, 0);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
int hit2 = GetBuffer().HitTest(dc, context, logicalPt, position2, & hitObj2, & contextObj2, 0);
|
||||||
if (hit2 != wxRICHTEXT_HITTEST_NONE && !(hit2 & wxRICHTEXT_HITTEST_OUTSIDE) && hitObj2 && hitObj != hitObj2)
|
if (hit2 != wxRICHTEXT_HITTEST_NONE && !(hit2 & wxRICHTEXT_HITTEST_OUTSIDE) && hitObj2 && hitObj != hitObj2)
|
||||||
{
|
{
|
||||||
// See if we can find a common ancestor
|
// See if we can find a common ancestor
|
||||||
@@ -945,7 +950,8 @@ void wxRichTextCtrl::OnRightClick(wxMouseEvent& event)
|
|||||||
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
||||||
wxRichTextObject* hitObj = NULL;
|
wxRichTextObject* hitObj = NULL;
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
int hit = GetFocusObject()->HitTest(dc, logicalPt, position, & hitObj, & contextObj);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
int hit = GetFocusObject()->HitTest(dc, context, logicalPt, position, & hitObj, & contextObj);
|
||||||
|
|
||||||
if (hitObj && hitObj->GetContainer() != GetFocusObject())
|
if (hitObj && hitObj->GetContainer() != GetFocusObject())
|
||||||
{
|
{
|
||||||
@@ -1397,7 +1403,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRichTextCtrl::ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj, long position, const wxPoint& pos)
|
bool wxRichTextCtrl::ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* WXUNUSED(obj), long position, const wxPoint& WXUNUSED(pos))
|
||||||
{
|
{
|
||||||
wxRichTextAttr attr;
|
wxRichTextAttr attr;
|
||||||
if (container && GetStyle(position, attr, container))
|
if (container && GetStyle(position, attr, container))
|
||||||
@@ -2020,7 +2026,8 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags)
|
|||||||
|
|
||||||
wxRichTextObject* hitObj = NULL;
|
wxRichTextObject* hitObj = NULL;
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
int hitTest = container->HitTest(dc, pt, newPos, & hitObj, & contextObj, hitTestFlags);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
int hitTest = container->HitTest(dc, context, pt, newPos, & hitObj, & contextObj, hitTestFlags);
|
||||||
|
|
||||||
if (hitObj &&
|
if (hitObj &&
|
||||||
((hitTest & wxRICHTEXT_HITTEST_NONE) == 0) &&
|
((hitTest & wxRICHTEXT_HITTEST_NONE) == 0) &&
|
||||||
@@ -2734,7 +2741,8 @@ wxRichTextCtrl::HitTest(const wxPoint& pt,
|
|||||||
|
|
||||||
wxRichTextObject* hitObj = NULL;
|
wxRichTextObject* hitObj = NULL;
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
int hit = ((wxRichTextCtrl*)this)->GetFocusObject()->HitTest(dc, pt2, *pos, & hitObj, & contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS);
|
wxRichTextDrawingContext context((wxRichTextBuffer*) & GetBuffer());
|
||||||
|
int hit = ((wxRichTextCtrl*)this)->GetFocusObject()->HitTest(dc, context, pt2, *pos, & hitObj, & contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS);
|
||||||
|
|
||||||
if ((hit & wxRICHTEXT_HITTEST_BEFORE) && (hit & wxRICHTEXT_HITTEST_OUTSIDE))
|
if ((hit & wxRICHTEXT_HITTEST_BEFORE) && (hit & wxRICHTEXT_HITTEST_OUTSIDE))
|
||||||
return wxTE_HT_BEFORE;
|
return wxTE_HT_BEFORE;
|
||||||
@@ -2756,7 +2764,8 @@ wxRichTextCtrl::FindContainerAtPoint(const wxPoint pt, long& position, int& hit,
|
|||||||
wxPoint logicalPt = GetLogicalPoint(pt);
|
wxPoint logicalPt = GetLogicalPoint(pt);
|
||||||
|
|
||||||
wxRichTextObject* contextObj = NULL;
|
wxRichTextObject* contextObj = NULL;
|
||||||
hit = GetBuffer().HitTest(dc, logicalPt, position, &hitObj, &contextObj, flags);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
hit = GetBuffer().HitTest(dc, context, logicalPt, position, &hitObj, &contextObj, flags);
|
||||||
wxRichTextParagraphLayoutBox* container = wxDynamicCast(contextObj, wxRichTextParagraphLayoutBox);
|
wxRichTextParagraphLayoutBox* container = wxDynamicCast(contextObj, wxRichTextParagraphLayoutBox);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
@@ -3390,7 +3399,8 @@ int wxRichTextCtrl::PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool add
|
|||||||
if (pt != wxDefaultPosition)
|
if (pt != wxDefaultPosition)
|
||||||
{
|
{
|
||||||
wxPoint logicalPt = GetLogicalPoint(ScreenToClient(pt));
|
wxPoint logicalPt = GetLogicalPoint(ScreenToClient(pt));
|
||||||
int hit = GetBuffer().HitTest(dc, logicalPt, position, & hitObj, & contextObj);
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
int hit = GetBuffer().HitTest(dc, context, logicalPt, position, & hitObj, & contextObj);
|
||||||
|
|
||||||
if (hit == wxRICHTEXT_HITTEST_ON || hit == wxRICHTEXT_HITTEST_BEFORE || hit == wxRICHTEXT_HITTEST_AFTER)
|
if (hit == wxRICHTEXT_HITTEST_ON || hit == wxRICHTEXT_HITTEST_BEFORE || hit == wxRICHTEXT_HITTEST_AFTER)
|
||||||
{
|
{
|
||||||
@@ -3678,7 +3688,8 @@ bool wxRichTextCtrl::GetCaretPositionForIndex(long position, wxRect& rect, wxRic
|
|||||||
if (!container)
|
if (!container)
|
||||||
container = GetFocusObject();
|
container = GetFocusObject();
|
||||||
|
|
||||||
if (container->FindPosition(dc, position, pt, & height, m_caretAtLineStart))
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
|
if (container->FindPosition(dc, context, position, pt, & height, m_caretAtLineStart))
|
||||||
{
|
{
|
||||||
// Caret height can't be zero
|
// Caret height can't be zero
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
@@ -3758,9 +3769,10 @@ bool wxRichTextCtrl::LayoutContent(bool onlyVisibleRect)
|
|||||||
|
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
|
|
||||||
|
wxRichTextDrawingContext context(& GetBuffer());
|
||||||
GetBuffer().Defragment();
|
GetBuffer().Defragment();
|
||||||
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
|
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
|
||||||
GetBuffer().Layout(dc, availableSpace, availableSpace, flags);
|
GetBuffer().Layout(dc, context, availableSpace, availableSpace, flags);
|
||||||
GetBuffer().Invalidate(wxRICHTEXT_NONE);
|
GetBuffer().Invalidate(wxRICHTEXT_NONE);
|
||||||
|
|
||||||
if (!IsFrozen())
|
if (!IsFrozen())
|
||||||
|
@@ -67,7 +67,8 @@ void wxRichTextPrintout::OnPreparePrinting()
|
|||||||
{
|
{
|
||||||
GetRichTextBuffer()->Invalidate(wxRICHTEXT_ALL);
|
GetRichTextBuffer()->Invalidate(wxRICHTEXT_ALL);
|
||||||
|
|
||||||
GetRichTextBuffer()->Layout(*GetDC(), rect, rect, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
|
wxRichTextDrawingContext context(GetRichTextBuffer());
|
||||||
|
GetRichTextBuffer()->Layout(*GetDC(), context, rect, rect, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
|
||||||
|
|
||||||
// Now calculate the page breaks
|
// Now calculate the page breaks
|
||||||
|
|
||||||
@@ -300,7 +301,8 @@ void wxRichTextPrintout::RenderPage(wxDC *dc, int page)
|
|||||||
|
|
||||||
dc->SetClippingRegion(wxRect(textRect.x, textRect.y + yOffset, textRect.width, textRect.height));
|
dc->SetClippingRegion(wxRect(textRect.x, textRect.y + yOffset, textRect.width, textRect.height));
|
||||||
|
|
||||||
GetRichTextBuffer()->Draw(*dc, rangeToDraw, wxRichTextSelection(), textRect, 0 /* descent */, wxRICHTEXT_DRAW_IGNORE_CACHE|wxRICHTEXT_DRAW_PRINT /* flags */);
|
wxRichTextDrawingContext context(GetRichTextBuffer());
|
||||||
|
GetRichTextBuffer()->Draw(*dc, context, rangeToDraw, wxRichTextSelection(), textRect, 0 /* descent */, wxRICHTEXT_DRAW_IGNORE_CACHE|wxRICHTEXT_DRAW_PRINT /* flags */);
|
||||||
|
|
||||||
dc->DestroyClippingRegion();
|
dc->DestroyClippingRegion();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user