From 567f5d09ace8f4e0e997d74e83ab3ef659ff1351 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 15 Dec 2016 12:42:19 +0000 Subject: [PATCH] CtrlLib: ArrayCtrl::SetLineColor git-svn-id: svn://ultimatepp.org/upp/trunk@10549 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/ArrayCtrl.cpp | 7 +++++++ uppsrc/CtrlLib/ArrayCtrl.h | 5 ++++- uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/uppsrc/CtrlLib/ArrayCtrl.cpp b/uppsrc/CtrlLib/ArrayCtrl.cpp index 705c4aa16..c2f56c0f7 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.cpp +++ b/uppsrc/CtrlLib/ArrayCtrl.cpp @@ -631,6 +631,11 @@ void ArrayCtrl::SetLineCy(int i, int cy) } } +void ArrayCtrl::SetLineColor(int i, Color c) +{ + array.At(i).paper = c; +} + int ArrayCtrl::GetTotalCy() const { int i = GetCount(); @@ -802,6 +807,8 @@ const Display& ArrayCtrl::GetCellInfo(int i, int j, bool f0, bg = i & 1 ? evenpaper : oddpaper; if(nobg) bg = Null; + if(i < array.GetCount() && !IsNull(array[i].paper)) + bg = array[i].paper; fg = i & 1 ? evenink : oddink; if((st & Display::SELECT) || !multiselect && (st & Display::CURSOR) && !nocursor || diff --git a/uppsrc/CtrlLib/ArrayCtrl.h b/uppsrc/CtrlLib/ArrayCtrl.h index 0c2faad02..923b8d8ec 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.h +++ b/uppsrc/CtrlLib/ArrayCtrl.h @@ -173,9 +173,10 @@ private: bool select:1; bool enabled:1; bool visible:1; + Color paper; Vector line; - Line() { select = false; enabled = true; visible = true; } + Line() { select = false; enabled = true; visible = true; paper = Null; } }; Vector array; @@ -573,6 +574,8 @@ public: int GetLineCy(int i) const; int GetTotalCy() const; int GetLineAt(int y) const; + + void SetLineColor(int i, Color c); Rect GetScreenCellRect(int i, int col) const; Rect GetScreenCellRectM(int i, int col) const; diff --git a/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp b/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp index 919f1f4c7..5154817a5 100644 --- a/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp @@ -1549,6 +1549,11 @@ GetLineCy(r) > y]).&] [s7; [*C@3 y]-|vertical pixel coordinate to locate&] [s7; [*/ Return value]-|zero`-based row number or `-1 when not found&] [s3; &] +[s4;%- &] +[s5;:Upp`:`:ArrayCtrl`:`:SetLineColor`(int`,Upp`:`:Color`):%- [@(0.0.255) void]_[* SetLin +eColor]([@(0.0.255) int]_[*@3 i], [_^Upp`:`:Color^ Color]_[*@3 c])&] +[s2; Sets the background color of line [%-*@3 i] to [%-*@3 c].&] +[s3; &] [s4; &] [s5;:ArrayCtrl`:`:GetClickColumn`(`)const: [@(0.0.255) int]_[* GetClickColumn]()_[@(0.0.255) c onst]&]