bazaar: CtrlProp compile first try

git-svn-id: svn://ultimatepp.org/upp/trunk@14166 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
kohait 2020-03-14 21:21:21 +00:00
parent 735c17cac9
commit 2086859770
3 changed files with 10 additions and 10 deletions

View file

@ -15,7 +15,7 @@ bool PropFocus(const Value& v, Ctrl& o) { if(!IsNumber(v)) return false; bool b
bool PropHasFocus(Value& v, const Ctrl& o) { v = o.HasFocus(); return true; }
bool PropModify(const Value& v, Ctrl& o) { if(!IsNumber(v)) return false; bool b = v; if(b) o.SetModify(); else o.ClearModify(); return true; }
bool PropIsModified(Value& v, const Ctrl& o) { v = o.IsModified(); return true; }
bool PropResetModify(const Value& v, Ctrl& o) { if(!IsNumber(v)) return false; if(bool(v)) o.ResetModify(); return true; }
//bool PropResetModify(const Value& v, Ctrl& o) { if(!IsNumber(v)) return false; if(bool(v)) o.ResetModify(); return true; }
bool PropSetTip(const Value& v, Ctrl& o) { o.Tip(AsString(v)); return true; }
bool PropGetTip(Value& v, const Ctrl& o) { v = o.GetTip(); return true; }
bool PropWantFocus(const Value& v, Ctrl& o) { if(!IsNumber(v)) return false; o.WantFocus(v); return true; }
@ -43,7 +43,7 @@ PROPERTY("editable", PropEditable, PropIsEditable)
PROPERTY("logpos", PropSetLogPos, PropGetLogPos)
PROPERTY("focus", PropFocus, PropHasFocus)
PROPERTY("modify", PropModify, PropIsModified)
PROPERTY_SET("refresh", PropResetModify)
//PROPERTY_SET("refresh", PropResetModify)
PROPERTY("tip", PropSetTip, PropGetTip)
PROPERTY("wantfocus", PropWantFocus, PropIsWantFocus)
PROPERTY("initFocus", PropInitFocus, PropIsInitFocus)

View file

@ -8,8 +8,8 @@ NAMESPACE_UPP
template<class T>
struct Property
{
typedef Callback1<const T&> S;
typedef Callback1<T&> G;
typedef Function<void (const T&)> S;
typedef Function<void (T&)> G;
Property(const S& s, const G& g)
: set(s), get(g) {}
@ -31,8 +31,8 @@ typedef Property<Value> ValueProperty;
template<class T>
struct Accessor
{
typedef Gate1<const T&> S;
typedef Gate1<T&> G;
typedef Function<bool (const T&)> S;
typedef Function<bool (T&)> G;
Accessor(const S& s, const G& g)
: set(s), get(g) {}
@ -134,8 +134,8 @@ void PropKeeper<KLASS>::SetupAccessorMap(C& o, AccessorMap& am) \
const PropTyper<C>::TH& t = m[i]; \
am.Add(m.GetKey(i) \
, new Accessor<Value>( \
((t.a)?(callback1<const Value&, C&, C&>(t.a, o)):(Accessor<Value>::S::Empty())) \
, ((t.b)?(callback1<Value&, const C&, const C&>(t.b, o)):(Accessor<Value>::G::Empty())) \
[&o, &t](const Value& v) -> bool { return t.a(v, o); }, \
[&o, &t](Value& v) -> bool { return t.b(v, o); } \
) \
); \
} \

View file

@ -50,7 +50,7 @@ void ValueAccessorCtrl::UpdateTarget()
ASSERT(0); //Property without accessors
return;
}
(*oc) <<= THISBACK(OnAction);
(*oc).WhenAction = THISBACK(OnAction);
Add(oc->SizePos());
}
@ -127,7 +127,7 @@ void AccessorMapCtrl::UpdateMap()
ASSERT(ep);
ep->SetTarget(&a);
(*ep) <<= Proxy(WhenAction);
(*ep).WhenAction = Proxy(WhenAction);
ValueAccessorEdit& c = avae.Add(tag, ep);
ac.SetCtrl(i, 1, c, false); //independant control
}