From 01bc8d46a1577ae9df077228f11172ad4d651bef Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 28 Sep 2010 07:51:39 +0000 Subject: [PATCH] AttrText:conversion from Value git-svn-id: svn://ultimatepp.org/upp/trunk@2723 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Display.cpp | 7 ++++++- uppsrc/Draw/Display.h | 1 + uppsrc/Draw/src.tpp/Display$en-us.tpp | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/uppsrc/Draw/Display.cpp b/uppsrc/Draw/Display.cpp index a7be0d6f1..7fa2b9b96 100644 --- a/uppsrc/Draw/Display.cpp +++ b/uppsrc/Draw/Display.cpp @@ -13,6 +13,11 @@ AttrText::operator Value() const return RawToValue(*this); } +AttrText::AttrText(const Value& v) +{ + *this = ValueTo(v); +} + void AttrText::Init() { ink = Null; @@ -95,7 +100,7 @@ void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q, paper = t.paper; if(!IsNull(t.ink)) ink = t.ink; - if(!IsNull(t.normalink) && (s & (CURSOR|FOCUS)) != (CURSOR|FOCUS)) + if(!IsNull(t.normalink) && !(s & (CURSOR|SELECT|READONLY))) ink = t.normalink; if(!IsNull(t.font)) font = t.font; diff --git a/uppsrc/Draw/Display.h b/uppsrc/Draw/Display.h index 261508688..eb9e29afb 100644 --- a/uppsrc/Draw/Display.h +++ b/uppsrc/Draw/Display.h @@ -46,6 +46,7 @@ struct AttrText { AttrText& SetImage(const Image& m, int spc = 4) { img = m; imgspc = spc; return *this; } operator Value() const; + AttrText(const Value& v); AttrText(const char *text); AttrText(const wchar *text); diff --git a/uppsrc/Draw/src.tpp/Display$en-us.tpp b/uppsrc/Draw/src.tpp/Display$en-us.tpp index e0e3011ee..41e6975ff 100644 --- a/uppsrc/Draw/src.tpp/Display$en-us.tpp +++ b/uppsrc/Draw/src.tpp/Display$en-us.tpp @@ -158,6 +158,12 @@ perator`=([@(0.0.255) const]_[_^WString^ WString][@(0.0.255) `&]_[@3 s])&] [s7; [*/ Return value]-|`*this.&] [s3;%- &] [s4;%- &] +[s5;:AttrText`:`:NormalInk`(Color`):%- [_^AttrText^ AttrText][@(0.0.255) `&]_[* NormalInk]( +[_^Color^ Color]_[*@3 c])&] +[s2; Sets the text color to be used if the item is not in selected +nor focused nor read`-only state.&] +[s3; &] +[s4;%- &] [s5;:AttrText`:`:Paper`(Color`):%- [_^AttrText^ AttrText][@(0.0.255) `&]_Paper([_^Color^ Co lor]_[@3 c])&] [s2; Sets the paper color.&] @@ -200,6 +206,11 @@ SetImage([@(0.0.255) const]_[_^Image^ Image][@(0.0.255) `&]_[@3 m], [@(0.0.255) [s7; [*/ Return value]-|AttrText as raw Value.&] [s3;%- &] [s4;%- &] +[s5;:AttrText`:`:AttrText`(const Value`&`):%- [* AttrText]([@(0.0.255) const]_[_^Value^ Val +ue][@(0.0.255) `&]_[*@3 v])&] +[s2; Converts Value to AttrText.&] +[s3; &] +[s4;%- &] [s5;:AttrText`:`:AttrText`(const char`*`):%- AttrText([@(0.0.255) const]_[@(0.0.255) char ]_`*[@3 text])&] [s2; Constructs AttrText, assigning the text attribute and all other