AttrText:conversion from Value

git-svn-id: svn://ultimatepp.org/upp/trunk@2723 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-09-28 07:51:39 +00:00
parent 4e8cf8758a
commit 01bc8d46a1
3 changed files with 18 additions and 1 deletions

View file

@ -13,6 +13,11 @@ AttrText::operator Value() const
return RawToValue(*this);
}
AttrText::AttrText(const Value& v)
{
*this = ValueTo<AttrText>(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;

View file

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

View file

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