From 2a299aa84f1132e14fbd5f9799a315482cfe5159 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 14 Apr 2015 10:55:01 +0000 Subject: [PATCH] CtrlLib: EditField::SetColor git-svn-id: svn://ultimatepp.org/upp/trunk@8347 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Core.t | 2 +- uppsrc/CtrlLib/EditCtrl.h | 2 ++ uppsrc/CtrlLib/EditField.cpp | 10 +++++++++- uppsrc/CtrlLib/src.tpp/EditField$en-us.tpp | 11 +++++++---- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/uppsrc/Core/Core.t b/uppsrc/Core/Core.t index 376db0158..c54d6c973 100644 --- a/uppsrc/Core/Core.t +++ b/uppsrc/Core/Core.t @@ -291,7 +291,7 @@ zhTW("\345\233\233") T_("date\vFr") caES("Dive") -csCZ("Pa") +csCZ("P\303\241") deDE("Fr") esES("Vi") fiFI("Pe") diff --git a/uppsrc/CtrlLib/EditCtrl.h b/uppsrc/CtrlLib/EditCtrl.h index bd3d617fc..000eb7e16 100644 --- a/uppsrc/CtrlLib/EditCtrl.h +++ b/uppsrc/CtrlLib/EditCtrl.h @@ -119,6 +119,7 @@ protected: const Convert *convert; const Convert *inactive_convert; Font font; + Color textcolor; WString nulltext; Color nullink; @@ -233,6 +234,7 @@ public: bool IsAutoFormat() const { return autoformat; } EditField& SetCharset(byte cs) { charset = cs; return *this; } EditField& SetFont(Font _font); + EditField& SetColor(Color c); EditField& ClickSelect(bool b = true) { clickselect = b; return *this; } bool IsClickSelect() const { return clickselect; } EditField& InitCaps(bool b = true) { initcaps = b; return *this; } diff --git a/uppsrc/CtrlLib/EditField.cpp b/uppsrc/CtrlLib/EditField.cpp index 0a935da4a..2a6230c1a 100644 --- a/uppsrc/CtrlLib/EditField.cpp +++ b/uppsrc/CtrlLib/EditField.cpp @@ -308,7 +308,7 @@ void EditField::Paint(Draw& w) Color paper = enabled && !IsReadOnly() ? (HasFocus() ? style->focus : style->paper) : style->disabled; if(nobg) paper = Null; - Color ink = enabled ? style->text : style->textdisabled; + Color ink = enabled ? Nvl(textcolor, style->text) : style->textdisabled; if(enabled && (convert && convert->Scan(text).IsError() || errorbg)) paper = style->invalid; int fcy = font.GetCy(); @@ -1044,6 +1044,7 @@ void EditField::Reset() SetStyle(StyleDefault()); SetFrame(edge); font = StdFont(); + textcolor = Null; showspaces = false; no_internal_margin = false; fsell = fselh = -1; @@ -1056,6 +1057,13 @@ EditField& EditField::SetFont(Font _font) return *this; } +EditField& EditField::SetColor(Color c) +{ + textcolor = c; + Refresh(); + return *this; +} + EditField& EditField::NullText(const Image& icon, const char *text, Font fnt, Color ink) { nullicon = icon; diff --git a/uppsrc/CtrlLib/src.tpp/EditField$en-us.tpp b/uppsrc/CtrlLib/src.tpp/EditField$en-us.tpp index 61636dd43..812b76f0d 100644 --- a/uppsrc/CtrlLib/src.tpp/EditField$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/EditField$en-us.tpp @@ -17,9 +17,7 @@ trl][3 , ][@(0.0.255)3 private][3 _][*@3;3 TextArrayOps]&] [s0;%% &] [s2;%% @@image:406&143 -󫱐⻱˶ႆ១؋蒕Ϊళ -Ċ̅ǗῙȽ¡ȧྡ֓π݁߶ʒ -ű +(A0EAFwAAAAAAAAAAAHic7ZfBCYAwEASvcyuxEDuxBSE96MtH7uJhgoZd2GEfIeSxwwUx5diLgpFl3egSFU4qpOAwsw+7vUQKDkwF18pumjuACrGtW0eXKa0reqeQ7HMpNG/X0+G/GVBI5kKhkJSkUMgngqngPqFWE88AKvQihTH0p4pAU4Eu89+2SpILMkWx/w==) &] [s0; &] [s9;%% This widget is used whenever there is a type of value that @@ -280,9 +278,14 @@ onst]&] [s4; &] [s5;:EditField`:`:SetFont`(Font`): [_^EditField^ EditField][@(0.0.255) `&]_[* SetFont]([_^Font^ F ont]_[*@3 `_font])&] -[s2;%% [%- Sets the ][%-*@3 font]. Returns `*this.&] +[s2;%% [%- Sets the ][%-*@3 font] of displayed text. Returns `*this.&] [s3; &] [s4; &] +[s5;:EditField`:`:SetColor`(Color`): [_^EditField^ EditField][@(0.0.255) `&]_[* SetColor]([_^Color^ C +olor]_[*@3 c])&] +[s2;%% [%- Sets the color] of displayed text. Returns `*this.&] +[s3;%% &] +[s4; &] [s5;:EditField`:`:ClickSelect`(bool`): [_^EditField^ EditField][@(0.0.255) `&]_[* ClickSele ct]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&] [s2; In ClickSelect mode, all the text of EditField is select when