Added wxRichTextCtrl::DoLayoutBuffer so an application can perform custom tasks before or after layout.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2014-04-22 16:27:29 +00:00
parent 1a16259223
commit 90143c254c
3 changed files with 21 additions and 2 deletions

View File

@ -1418,6 +1418,11 @@ public:
*/
virtual bool LayoutContent(bool onlyVisibleRect = false);
/**
Implements layout. An application may override this to perform operations before or after layout.
*/
virtual void DoLayoutBuffer(wxRichTextBuffer& buffer, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int flags);
/**
Move the caret to the given character position.

View File

@ -1374,6 +1374,11 @@ public:
*/
virtual bool LayoutContent(bool onlyVisibleRect = false);
/**
Implements layout. An application may override this to perform operations before or after layout.
*/
virtual void DoLayoutBuffer(wxRichTextBuffer& buffer, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int flags);
/**
Move the caret to the given character position.

View File

@ -468,7 +468,11 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
{
dc.SetUserScale(GetScale(), GetScale());
GetBuffer().Layout(dc, context, availableSpace, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
GetBuffer().Defragment(context);
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
DoLayoutBuffer(GetBuffer(), dc, context, availableSpace, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
GetBuffer().Invalidate(wxRICHTEXT_NONE);
dc.SetUserScale(1.0, 1.0);
@ -4058,7 +4062,7 @@ bool wxRichTextCtrl::LayoutContent(bool onlyVisibleRect)
wxRichTextDrawingContext context(& GetBuffer());
GetBuffer().Defragment(context);
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
GetBuffer().Layout(dc, context, availableSpace, availableSpace, flags);
DoLayoutBuffer(GetBuffer(), dc, context, availableSpace, availableSpace, flags);
GetBuffer().Invalidate(wxRICHTEXT_NONE);
dc.SetUserScale(1.0, 1.0);
@ -4073,6 +4077,11 @@ bool wxRichTextCtrl::LayoutContent(bool onlyVisibleRect)
return true;
}
void wxRichTextCtrl::DoLayoutBuffer(wxRichTextBuffer& buffer, wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int flags)
{
buffer.Layout(dc, context, rect, parentRect, flags);
}
/// Is all of the selection, or the current caret position, bold?
bool wxRichTextCtrl::IsSelectionBold()
{