From 80046688587bc715a93a4abc7e243f4bd13a2c5a Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 13 May 2018 12:00:18 +0000 Subject: [PATCH] CtrlLib: RichText TextColor setting git-svn-id: svn://ultimatepp.org/upp/trunk@11939 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/RichText.h | 2 ++ uppsrc/CtrlLib/RichTextView.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/uppsrc/CtrlLib/RichText.h b/uppsrc/CtrlLib/RichText.h index 8719efa3b..4f667aafe 100644 --- a/uppsrc/CtrlLib/RichText.h +++ b/uppsrc/CtrlLib/RichText.h @@ -18,6 +18,7 @@ public: private: Rect margin; Color background; + Color textcolor; Zoom zoom; int cx; ScrollBar sb; @@ -89,6 +90,7 @@ public: RichTextView& PageWidth(int cx); RichTextView& SetZoom(Zoom z); RichTextView& Background(Color _color); + RichTextView& TextColor(Color _color); RichTextView& VCenter(bool b = true); RichTextView& NoVCenter() { return VCenter(false); } RichTextView& Margins(const Rect& m); diff --git a/uppsrc/CtrlLib/RichTextView.cpp b/uppsrc/CtrlLib/RichTextView.cpp index 790b93dee..e1918fa0a 100644 --- a/uppsrc/CtrlLib/RichTextView.cpp +++ b/uppsrc/CtrlLib/RichTextView.cpp @@ -26,6 +26,7 @@ void RichTextView::Paint(Draw& w) pi.indexentry = Null; pi.highlightpara = highlight; pi.zoom = GetZoom(); + pi.textcolor = textcolor; int q = sb * pi.zoom; scroller.Set(q); w.Offset(0, -q); @@ -372,6 +373,13 @@ RichTextView& RichTextView::Background(Color c) return *this; } +RichTextView& RichTextView::TextColor(Color _color) +{ + textcolor = _color; + Refresh(); + return *this; +} + RichTextView& RichTextView::VCenter(bool b) { vcenter = b; @@ -416,6 +424,7 @@ RichTextView::RichTextView() sb.WhenScroll = THISBACK(Scroll); zoom = Null; background = SColorPaper; + textcolor = Null; vcenter = false; margin = Rect(0, 0, 0, 0); highlight = -1;