CtrlLib: RichText TextColor setting

git-svn-id: svn://ultimatepp.org/upp/trunk@11939 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-05-13 12:00:18 +00:00
parent 4d00c90ffe
commit 8004668858
2 changed files with 11 additions and 0 deletions

View file

@ -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);

View file

@ -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;