From ad4852ae89f62755d890a6ff12b90d4dac256391 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 29 Apr 2018 18:12:00 +0000 Subject: [PATCH] CtrlLib: TextCtrl::Append git-svn-id: svn://ultimatepp.org/upp/trunk@11919 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/TextEdit.h | 4 ++++ uppsrc/CtrlLib/src.tpp/TextCtrl_en-us.tpp | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/uppsrc/CtrlLib/TextEdit.h b/uppsrc/CtrlLib/TextEdit.h index 4ea624bff..93e2685ab 100644 --- a/uppsrc/CtrlLib/TextEdit.h +++ b/uppsrc/CtrlLib/TextEdit.h @@ -210,6 +210,10 @@ public: int Insert(int pos, const char *txt) { return Insert(pos, WString(txt)); } void Remove(int pos, int size); + int Append(const WString& txt) { return Insert(GetLength(), txt); } + int Append(const String& txt, byte charset = CHARSET_DEFAULT) { return Insert(GetLength(), txt, charset); } + int Append(const char *txt) { return Append(WString(txt)); } + void NextUndo(); void Undo(); void Redo(); diff --git a/uppsrc/CtrlLib/src.tpp/TextCtrl_en-us.tpp b/uppsrc/CtrlLib/src.tpp/TextCtrl_en-us.tpp index cf2f92400..62480110b 100644 --- a/uppsrc/CtrlLib/src.tpp/TextCtrl_en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/TextCtrl_en-us.tpp @@ -1,5 +1,4 @@ topic "TextCtrl"; -[2 $$0,0#00000000000000000000000000000000:Default] [i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] [l288;2 $$2,0#27521748481378242620020725143825:desc] [0 $$3,0#96390100711032703541132217272105:end] @@ -9,6 +8,7 @@ topic "TextCtrl"; [l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] +[2 $$0,0#00000000000000000000000000000000:Default] [{_} [ {{10000@3 [s0; [*@(229)4 TextCtrl]]}}&] [s3; &] @@ -363,6 +363,22 @@ nt]_[*@3 pos], [@(0.0.255) const]_[_^String^ String][@(0.0.255) `&]_[*@3 txt], [s2;%% Removes the text.&] [s3;%% &] [s4; &] +[s5;:Upp`:`:TextCtrl`:`:Append`(const Upp`:`:WString`&`): [@(0.0.255) int]_[* Append]([@(0.0.255) c +onst]_[_^Upp`:`:WString^ WString][@(0.0.255) `&]_[*@3 txt])&] +[s2;%% Same as Insert(GetLength(), [%-*@3 txt]).&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:TextCtrl`:`:Append`(const Upp`:`:String`&`,Upp`:`:byte`): [@(0.0.255) int]_ +[* Append]([@(0.0.255) const]_[_^Upp`:`:String^ String][@(0.0.255) `&]_[*@3 txt], +[_^Upp`:`:byte^ byte]_[*@3 charset]_`=_CHARSET`_DEFAULT)&] +[s2;%% Same as Insert(GetLength(), [%-*@3 txt], [%-*@3 charset]).&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:TextCtrl`:`:Append`(const char`*`): [@(0.0.255) int]_[* Append]([@(0.0.255) con +st]_[@(0.0.255) char]_`*[*@3 txt])&] +[s2;%% Same as Append(WString([%-*@3 txt])).&] +[s3;%% &] +[s4; &] [s5;:TextCtrl`:`:NextUndo`(`): [@(0.0.255) void]_[* NextUndo]()&] [s2;%% Marks the beginning of next undo block. All text altering operations (inserts and removes) are recorded into undo buffer