WithDropChoice: Set/Remove entry in drop-down list

git-svn-id: svn://ultimatepp.org/upp/trunk@11201 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-06-24 13:20:01 +00:00
parent 4d3d53fada
commit 154cfdf4fd
3 changed files with 21 additions and 0 deletions

View file

@ -114,6 +114,12 @@ void DropChoice::Add(const Value& s) {
EnableDrop(true);
}
void DropChoice::Remove(int i)
{
list.Remove(i);
EnableDrop(list.GetCount());
}
void DropChoice::Clear() {
list.Clear();
EnableDrop(always_drop);

View file

@ -181,6 +181,8 @@ public:
void Clear();
void Add(const Value& data);
void Set(int i, const Value& data) { list.Set(i, 0, data); }
void Remove(int i);
void SerializeList(Stream& s);
int GetCount() const { return list.GetCount(); }
@ -241,6 +243,8 @@ public:
void ClearList() { select.Clear(); }
void AddList(const Value& data) { select.Add(data); }
void Set(int i, const Value& data) { select.Set(i, data); }
void Remove(int i) { select.Remove(i); }
void SerializeList(Stream& s) { select.SerializeList(s); }
int GetCount() const { return select.GetCount(); }

View file

@ -48,6 +48,17 @@ onst]_[_^Value^ Value][@(0.0.255) `&]_[*@3 data])&]
[s2;%% Adds [%-*@3 data] to the drop`-down list.&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:WithDropChoice`:`:Set`(int`,const Upp`:`:Value`&`): [@(0.0.255) void]_[* Set](
[@(0.0.255) int]_[*@3 i], [@(0.0.255) const]_[_^Upp`:`:Value^ Value][@(0.0.255) `&]_[*@3 data
])&]
[s2;%% Sets entry [%-*@3 i] in drop`-down list to [%-*@3 data] .&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:WithDropChoice`:`:Remove`(int`): [@(0.0.255) void]_[* Remove]([@(0.0.255) int]_
[*@3 i])&]
[s2;%% Removes entry [%-*@3 i] in drop`-down list.&]
[s3;%% &]
[s4; &]
[s5;:WithDropChoice`:`:SerializeList`(Stream`&`): [@(0.0.255) void]_[* SerializeList]([_^Stream^ S
tream][@(0.0.255) `&]_[*@3 s])&]
[s2;%% Serializes the drop`-down list content.&]