OptionTree behaviour improved

git-svn-id: svn://ultimatepp.org/upp/trunk@1932 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-01-24 13:40:38 +00:00
parent 1562f322a9
commit 55a8cd9dc4
4 changed files with 18 additions and 14 deletions

View file

@ -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() {

View file

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

View file

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

View file

@ -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;%% &]