CtrlLib: EditField::SetColor

git-svn-id: svn://ultimatepp.org/upp/trunk@8347 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-04-14 10:55:01 +00:00
parent 81e6470554
commit 2a299aa84f
4 changed files with 19 additions and 6 deletions

View file

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

View file

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

View file

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

View file

@ -17,9 +17,7 @@ trl][3 , ][@(0.0.255)3 private][3 _][*@3;3 TextArrayOps]&]
[s0;%% &]
[s2;%%
@@image:406&143
€γ€€€€€€€€€€<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>€<EFBFBD><EFBFBD>€<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>
(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