diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 1b49d79c35..850bc882ea 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -4354,6 +4354,8 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); + virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context); + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual wxString GetTextForRange(const wxRichTextRange& range) const; diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 592a9802f6..2c78b0e1d8 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -6780,6 +6780,23 @@ bool wxRichTextPlainText::Layout(wxDC& dc, wxRichTextDrawingContext& context, co return true; } +// Adjusts the attributes for virtual attribute provision, collapsed borders, etc. +bool wxRichTextPlainText::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context) +{ + wxRichTextObject::AdjustAttributes(attr, context); + + if (!attr.HasTextColour()) + { + wxRichTextBuffer* buf = GetBuffer(); + if (buf && buf->GetDefaultStyle().HasTextColour()) + attr.SetTextColour(buf->GetDefaultStyle().GetTextColour()); + else + attr.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); + } + + return true; +} + /// Copy void wxRichTextPlainText::Copy(const wxRichTextPlainText& obj) {