Draw: Improved AttrText (Set and operator= for texts)

git-svn-id: svn://ultimatepp.org/upp/trunk@1893 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-01-14 08:36:09 +00:00
parent 7b5f333a45
commit dd48f3ce18
2 changed files with 26 additions and 0 deletions

View file

@ -28,6 +28,12 @@ struct AttrText {
Image img;
int imgspc;
AttrText& Set(const char *s) { text = s; return *this; }
AttrText& Set(const wchar *s) { text = s; return *this; }
AttrText& Set(const WString& s) { text = s; return *this; }
AttrText& operator=(const char *s) { text = s; return *this; }
AttrText& operator=(const wchar *s) { text = s; return *this; }
AttrText& operator=(const WString& s) { text = s; return *this; }
AttrText& Ink(Color c) { ink = c; return *this; }
AttrText& Paper(Color c) { paper = c; return *this; }
AttrText& SetFont(Font f) { font = f; return *this; }
@ -42,6 +48,7 @@ struct AttrText {
AttrText(const char *text);
AttrText(const wchar *text);
AttrText(const WString& text);
AttrText() { Init(); }
private:
void Init();

View file

@ -132,6 +132,21 @@ ALIGN`_CENTER.&]
[s2; Space between icon and text.&]
[s7;%- &]
[s8;%- &]
[s5;:AttrText`:`:Set`(const char`*`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _Set(][@(0.0.255) c
onst][@0 _][@(0.0.255) char][@0 _`*][@3 s][@0 )]&]
[s5;:AttrText`:`:Set`(const wchar`*`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _Set(][@(0.0.255) c
onst][@0 _][_^wchar^@0 wchar][@0 _`*][@3 s][@0 )]&]
[s5;:AttrText`:`:Set`(const WString`&`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _Set(
][@(0.0.255) const][@0 _][_^WString^@0 WString][@(0.0.255) `&][@0 _][@3 s][@0 )]&]
[s5;:AttrText`:`:operator`=`(const char`*`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _
operator`=(][@(0.0.255) const][@0 _][@(0.0.255) char][@0 _`*][@3 s][@0 )]&]
[s5;:AttrText`:`:operator`=`(const wchar`*`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _
operator`=(][@(0.0.255) const][@0 _][_^wchar^@0 wchar][@0 _`*][@3 s][@0 )]&]
[s5;:AttrText`:`:operator`=`(const WString`&`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _
operator`=(][@(0.0.255) const][@0 _][_^WString^@0 WString][@(0.0.255) `&][@0 _][@3 s][@0 )]&]
[s2; Sets the text to [%-*@3 s].&]
[s7; &]
[s8;%- &]
[s5;:AttrText`:`:Ink`(Color`):%- [_^AttrText^@0 AttrText][@(0.0.255) `&][@0 _Ink(][_^Color^@0 C
olor][@0 _][@3 c][@0 )]&]
[s2; Sets the text color.&]
@ -197,6 +212,10 @@ attributes to zero.&]
String][@(0.0.255) `&][@0 _][@3 text][@0 )]&]
[s2; Constructs AttrText, assigning the text attribute and all other
attributes to zero.&]
[s7; &]
[s8;%- &]
[s5;:AttrText`:`:AttrText`(`):%- [@0 AttrText()]&]
[s2; Default constructor.&]
[s0; &]
[s0;%- &]
[ {{10000t/25b/25@3 [s0;%- [*@(229)4 Standard displays]]}}&]