From dd48f3ce18dedcfe6b2e6db27338c7c824434e7c Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 14 Jan 2010 08:36:09 +0000 Subject: [PATCH] Draw: Improved AttrText (Set and operator= for texts) git-svn-id: svn://ultimatepp.org/upp/trunk@1893 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Display.h | 7 +++++++ uppsrc/Draw/src.tpp/Display$en-us.tpp | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/uppsrc/Draw/Display.h b/uppsrc/Draw/Display.h index be97151f9..9ea2aa7d6 100644 --- a/uppsrc/Draw/Display.h +++ b/uppsrc/Draw/Display.h @@ -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(); diff --git a/uppsrc/Draw/src.tpp/Display$en-us.tpp b/uppsrc/Draw/src.tpp/Display$en-us.tpp index f2205f094..22489450f 100644 --- a/uppsrc/Draw/src.tpp/Display$en-us.tpp +++ b/uppsrc/Draw/src.tpp/Display$en-us.tpp @@ -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]]}}&]