mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
CtrlLib: CtrRetriever now has Set method
git-svn-id: svn://ultimatepp.org/upp/trunk@11925 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f6089085d3
commit
dfa7fc3138
3 changed files with 15 additions and 2 deletions
|
|
@ -274,6 +274,12 @@ Event<> CtrlRetriever::operator<<(Event<> cb)
|
|||
return cb;
|
||||
}
|
||||
|
||||
void CtrlRetriever::Set()
|
||||
{
|
||||
for(int i = 0; i < item.GetCount(); i++)
|
||||
item[i].Set();
|
||||
}
|
||||
|
||||
void CtrlRetriever::Retrieve()
|
||||
{
|
||||
for(int i = 0; i < item.GetCount(); i++)
|
||||
|
|
|
|||
|
|
@ -394,6 +394,7 @@ public:
|
|||
class CtrlRetriever {
|
||||
public:
|
||||
struct Item {
|
||||
virtual void Set() = 0;
|
||||
virtual void Retrieve() = 0;
|
||||
virtual ~Item() {}
|
||||
};
|
||||
|
|
@ -407,6 +408,7 @@ private:
|
|||
struct CtrlItem : CtrlItem0 {
|
||||
T *value;
|
||||
|
||||
virtual void Set() { *ctrl <<= *value; }
|
||||
virtual void Retrieve() { *value = ~*ctrl; }
|
||||
virtual ~CtrlItem() {}
|
||||
};
|
||||
|
|
@ -422,6 +424,7 @@ public:
|
|||
template <class T>
|
||||
CtrlRetriever& operator()(Ctrl& ctrl, T& val) { Put(ctrl, val); return *this; }
|
||||
|
||||
void Set();
|
||||
void Retrieve();
|
||||
|
||||
Event<> operator^=(Event<> cb);
|
||||
|
|
@ -439,7 +442,7 @@ void CtrlRetriever::Put(Ctrl& ctrl, T& val)
|
|||
CtrlItem<T> *m = new CtrlItem<T>();
|
||||
m->ctrl = &ctrl;
|
||||
m->value = &val;
|
||||
ctrl <<= val;
|
||||
m->Set();
|
||||
Put(m);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
topic "CtrlRetriever";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
|
|
@ -9,6 +8,7 @@ topic "CtrlRetriever";
|
|||
[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@(113.42.0) [s0;%% [*@7;4 CtrlRetriever]]}}&]
|
||||
[s0; &]
|
||||
|
|
@ -33,6 +33,10 @@ ator()]([_^Upp`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[*@3 ctrl], [*@4 T][@(0.0.255) `&]_
|
|||
data mappings (to be used by Retrieve).&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:CtrlRetriever`:`:Set`(`): [@(0.0.255) void]_[* Set]()&]
|
||||
[s2;%% Reassigns values to widgets.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:CtrlRetriever`:`:Retrieve`(`): [@(0.0.255) void]_[* Retrieve]()&]
|
||||
[s2;%% Moves data mapped using Put from widgets back to variables.&]
|
||||
[s3; &]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue