diff --git a/uppsrc/CtrlLib/Button.cpp b/uppsrc/CtrlLib/Button.cpp index 1703fe60b..471b46849 100644 --- a/uppsrc/CtrlLib/Button.cpp +++ b/uppsrc/CtrlLib/Button.cpp @@ -596,12 +596,14 @@ void Option::PerformAction() { RefreshPush(); } -void Option::Set(int b) { +Option& Option::Set(int b) +{ if(b != option) { option = b; Update(); RefreshPush(); } + return *this; } Option::Option() { diff --git a/uppsrc/CtrlLib/PushCtrl.h b/uppsrc/CtrlLib/PushCtrl.h index c9bf90367..9943691e4 100644 --- a/uppsrc/CtrlLib/PushCtrl.h +++ b/uppsrc/CtrlLib/PushCtrl.h @@ -179,8 +179,8 @@ protected: bool showlabel; public: - void Set(int b); - int Get() const { return option; } + Option& Set(int b); + int Get() const { return option; } operator int() const { return option; } void operator=(int b) { Set(b); } diff --git a/uppsrc/CtrlLib/TreeCtrl.cpp b/uppsrc/CtrlLib/TreeCtrl.cpp index 72be805da..3a2c18c74 100644 --- a/uppsrc/CtrlLib/TreeCtrl.cpp +++ b/uppsrc/CtrlLib/TreeCtrl.cpp @@ -1612,14 +1612,21 @@ int OptionTree::Insert(int parentid, int i, const Image& img, Option& opt, const return id; } -int OptionTree::Add(int parentid, const Image& img, const char *text) -{ - return Insert(parentid, GetChildCount(parentid), img, text); -} int OptionTree::Insert(int parentid, int i, const Image& img, const char *text) { - return Insert(parentid, i, img, aux.Add().NoNotNull(), text); + return Insert(parentid, i, img, aux.Add().NoNotNull().Set(Get(parentid)), text); +} + +int OptionTree::Insert(int parentid, int i, const char *text) +{ + return Insert(parentid, i, aux.Add().NoNotNull().Set(Get(parentid)), text); +} + + +int OptionTree::Add(int parentid, const Image& img, const char *text) +{ + return Insert(parentid, GetChildCount(parentid), img, text); } int OptionTree::Add(int parentid, Option& opt, const char *text) @@ -1637,11 +1644,6 @@ int OptionTree::Add(int parentid, const char *text) return Insert(parentid, GetChildCount(parentid), text); } -int OptionTree::Insert(int parentid, int i, const char *text) -{ - return Insert(parentid, i, aux.Add().NoNotNull(), text); -} - void OptionTree::SetLabel(int id, const char *text) { Node n = GetNode(id); diff --git a/uppsrc/CtrlLib/src.tpp/Option$en-us.tpp b/uppsrc/CtrlLib/src.tpp/Option$en-us.tpp index 9a19e8c08..6e369c312 100644 --- a/uppsrc/CtrlLib/src.tpp/Option$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/Option$en-us.tpp @@ -50,7 +50,7 @@ and standard appearance.&] [s0; &] [ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&] [s3; &] -[s5;:Option`:`:Set`(int`): [@(0.0.255) void]_[* Set]([@(0.0.255) int]_[*@3 b])&] +[s5;:Option`:`:Set`(int`): [_^Option^ Option][@(0.0.255) `&]_[* Set]([@(0.0.255) int]_[*@3 b])&] [s2;%% Sets Option to the specified state (0, 1 or Null).&] [s7;%% [%-*C@3 b]-|State.&] [s3;%% &]