mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
bazaar: Propery fixes and some description in source, TypeOf helper template for some issues, CtrlProp fixes, first looks for WithAccessorMap iface
git-svn-id: svn://ultimatepp.org/upp/trunk@3722 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c5ede85067
commit
e43218f873
13 changed files with 371 additions and 48 deletions
|
|
@ -67,6 +67,7 @@ public:
|
|||
virtual Value GetData() const { return RawToValue(~ctrl); }
|
||||
Ctrl* GetCtrl() const { return ctrl; }
|
||||
void ClearCtrl() { ctrl = NULL; }
|
||||
void SetCtrl(Ctrl& c) { /*ASSERT(c.GetParent());*/ ctrl = &c; }
|
||||
|
||||
int flags;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define _CtrlProp_CtrlProp_h_
|
||||
|
||||
#include "CtrlPropCommon.h"
|
||||
#include "CtrlPropEdit.h"
|
||||
#include "PropList.h"
|
||||
#include "PropEdit.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@ uses
|
|||
|
||||
file
|
||||
CtrlPropCommon.h,
|
||||
CtrlPropEdit.h,
|
||||
CtrlPropEdit.cpp,
|
||||
CtrlPropEdit.lay,
|
||||
PropList.h,
|
||||
PropList.cpp,
|
||||
PropList.lay,
|
||||
PropEdit.h,
|
||||
PropEdit.cpp,
|
||||
PropEdit.lay,
|
||||
CtrlProp.h,
|
||||
Props readonly separator,
|
||||
Ctrl.icpp,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _CtrlProp_CtrlPropCommon_h
|
||||
#define _CtrlProp_CtrlPropCommon_h
|
||||
|
||||
#include <CtrlCore/CtrlCore.h>
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
using namespace Upp;
|
||||
|
||||
#include <Property/Property.h>
|
||||
|
|
|
|||
147
bazaar/CtrlProp/PropEdit.cpp
Normal file
147
bazaar/CtrlProp/PropEdit.cpp
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
#include "PropEdit.h"
|
||||
|
||||
PropEditCtrl::PropEditCtrl()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
ac.AddColumn("Property");
|
||||
ac.AddColumn("Value");
|
||||
//ac.WhenUpdateRow = THISBACK(OnUpdateRow);
|
||||
}
|
||||
|
||||
void PropEditCtrl::Visit(Ctrl& e)
|
||||
{
|
||||
V::Visit(e);
|
||||
|
||||
ac.Clear();
|
||||
vsav.Clear();
|
||||
am.Clear();
|
||||
|
||||
//init local accessor map
|
||||
//prefer the dynamic access
|
||||
//fall back to the static accessors from Props<>
|
||||
GetAccessorMapI* ami = dynamic_cast<GetAccessorMapI*>(&e);
|
||||
if(ami)
|
||||
am <<= ami->GetAccessorMap();
|
||||
else
|
||||
if(!Props<Ctrl>::SetupAccessorMap(e, am)) return;
|
||||
|
||||
for(int i = 0, k = 0; i < am.GetCount(); i++)
|
||||
{
|
||||
String tag = am.GetKey(i);
|
||||
ValueAccessor& a = am[i];
|
||||
Value v;
|
||||
|
||||
if(a.get && !a.get(v)) //if cant get a gettable
|
||||
continue;
|
||||
|
||||
ac.Set(k, 0, tag);
|
||||
ac.Set(k, 1, v); //forwarded to controls when specified
|
||||
|
||||
if(a.get && a.set)
|
||||
{
|
||||
Tuple2<bool, Value>& tv = vsav.Add(tag);
|
||||
tv.a = false; tv.b = v; //save old values
|
||||
|
||||
Ctrl* pc;
|
||||
if(!v.IsNull())
|
||||
{
|
||||
pc = DefaultValueEditor(v);
|
||||
{
|
||||
//LogPosCtrl needs instance to live show changes
|
||||
LogPosCtrl* ple = dynamic_cast<LogPosCtrl*>(pc);
|
||||
if(ple) ple->Set(e);
|
||||
}
|
||||
}
|
||||
else pc = new ValueCtrl();
|
||||
(*pc) <<= THISBACK(OnUpdateRow);
|
||||
|
||||
ac.SetCtrl(k, 1, pc); //owned
|
||||
++k;
|
||||
}
|
||||
else
|
||||
if(a.get)
|
||||
{
|
||||
StaticText* pc = new StaticText();
|
||||
pc->SetText(AsString(v));
|
||||
|
||||
ac.SetCtrl(k, 1, pc); //owned
|
||||
++k;
|
||||
}
|
||||
else
|
||||
if(a.set)
|
||||
{
|
||||
//FIXME needs to know which type
|
||||
//meanwhile, we let user choose
|
||||
ValueCtrl* pc = new ValueCtrl();
|
||||
(*pc) <<= THISBACK(OnUpdateRow);
|
||||
|
||||
ac.SetCtrl(k, 1, pc); //owned
|
||||
++k;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(0); //Property without accessors
|
||||
++k;
|
||||
}
|
||||
}
|
||||
ac.Layout();
|
||||
//ac.UpdateRefresh();
|
||||
}
|
||||
|
||||
void PropEditCtrl::Clear()
|
||||
{
|
||||
V::Clear();
|
||||
ac.Clear();
|
||||
vsav.Clear();
|
||||
}
|
||||
|
||||
void PropEditCtrl::Reload()
|
||||
{
|
||||
V::Reload();
|
||||
for(int i = 0; i < ac.GetCount(); i++)
|
||||
{
|
||||
Value v;
|
||||
int ii = am.Find(ac.Get(i, 0));
|
||||
if(ii<0) continue;
|
||||
if(!am[ii].get(v)) continue;
|
||||
ac.Set(i, 1, v);
|
||||
}
|
||||
}
|
||||
|
||||
void PropEditCtrl::OnUpdateRow()
|
||||
{
|
||||
if(IsEmpty()) return;
|
||||
if(!ac.IsCursor()) return; //FIXME Option Focus issue
|
||||
int ii = am.Find(ac.Get(0));
|
||||
if(ii<0) return;
|
||||
am[ii].set(ac.Get(1));
|
||||
vsav.GetAdd(ac.Get(0)).a = true; //dirty
|
||||
Action();
|
||||
Get().UpdateActionRefresh(); //propagate user action
|
||||
}
|
||||
|
||||
void PropEditCtrl::Restore()
|
||||
{
|
||||
if(!IsEmpty())
|
||||
{
|
||||
for(int i = 0; i < vsav.GetCount(); i++)
|
||||
if(vsav[i].a)
|
||||
{
|
||||
int ii = am.Find(vsav.GetKey(i));
|
||||
if(ii<0) continue;
|
||||
am[ii].set(vsav[i].b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropEdit::PropEdit()
|
||||
{
|
||||
SetRect(pec.GetRect());
|
||||
Add(pec.HSizePos().VSizePos(0,20));
|
||||
Add(ok.RightPos(60,60).BottomPos(0,20));
|
||||
Add(cancel.RightPos(0,60).BottomPos(0,20));
|
||||
ok <<= THISBACK(Acceptor);
|
||||
cancel <<= THISBACK(Rejector);
|
||||
ok.SetLabel("OK");
|
||||
cancel.SetLabel("Cancel");
|
||||
}
|
||||
51
bazaar/CtrlProp/PropEdit.h
Normal file
51
bazaar/CtrlProp/PropEdit.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef _CtrlProp_PropEdit_h_
|
||||
#define _CtrlProp_PropEdit_h_
|
||||
|
||||
#include "CtrlPropCommon.h"
|
||||
|
||||
#include <LogPosCtrl/LogPosCtrl.h>
|
||||
#include <ValueCtrl/ValueCtrl.h>
|
||||
|
||||
#include <Gen/Gen.h>
|
||||
|
||||
#define LAYOUTFILE <CtrlProp/PropEdit.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class PropEditCtrl : public WithPropEditLay<ParentCtrl>, public Visiting<Ctrl>
|
||||
{
|
||||
public:
|
||||
typedef PropEditCtrl CLASSNAME;
|
||||
typedef Visiting<Ctrl> V;
|
||||
PropEditCtrl();
|
||||
|
||||
virtual void Visit(Ctrl& e);
|
||||
virtual void Reload();
|
||||
virtual void Clear();
|
||||
virtual void Restore();
|
||||
|
||||
void OnUpdateRow();
|
||||
|
||||
protected:
|
||||
ArrayMap<String, Tuple2<bool, Value> > vsav;
|
||||
AccessorMap am;
|
||||
};
|
||||
|
||||
class PropEdit : public PopUpC
|
||||
{
|
||||
public:
|
||||
typedef PropEdit CLASSNAME;
|
||||
PropEdit();
|
||||
|
||||
virtual void Deactivate() {} //let other popups open
|
||||
|
||||
void PopUp(Ctrl* owner, Ctrl& e) { pec.Visit(e); PopUpC::PopUp(owner); }
|
||||
|
||||
virtual void Rejector() { pec.Restore(); pec.Clear(); PopUpC::Rejector(); }
|
||||
virtual void Acceptor() { pec.Clear(); PopUpC::Acceptor(); }
|
||||
|
||||
protected:
|
||||
PropEditCtrl pec;
|
||||
Button ok, cancel;
|
||||
};
|
||||
|
||||
#endif
|
||||
4
bazaar/CtrlProp/PropEdit.lay
Normal file
4
bazaar/CtrlProp/PropEdit.lay
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
LAYOUT(PropEditLay, 400, 200)
|
||||
ITEM(ArrayCtrl, ac, HSizePosZ(0, 0).VSizePosZ(0, 0))
|
||||
END_LAYOUT
|
||||
|
||||
50
bazaar/CtrlProp/PropList.cpp
Normal file
50
bazaar/CtrlProp/PropList.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#include "PropList.h"
|
||||
|
||||
PropListCtrl::PropListCtrl()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
}
|
||||
|
||||
void PropListCtrl::Reload()
|
||||
{
|
||||
V::Reload();
|
||||
Ctrl& e = Get();
|
||||
|
||||
Value v;
|
||||
bool b;
|
||||
String t;
|
||||
|
||||
b = Props<Ctrl>::Get(e, "listset", v);
|
||||
ValueArray vs = v;
|
||||
t << "Set Properties: (" << vs.GetCount() << ")\n" << v;
|
||||
gl.SetData(t);
|
||||
|
||||
v = Value();
|
||||
b = Props<Ctrl>::Get(e, "listget", v);
|
||||
t.Clear();
|
||||
ValueArray vg = v;
|
||||
t << "Get Properties: (" << vg.GetCount() << ")\n";
|
||||
{
|
||||
for(int i = 0; i < vg.GetCount(); i++)
|
||||
{
|
||||
String s = vg.Get(i);
|
||||
Value v;
|
||||
t << s << " = ";
|
||||
b = Props<Ctrl>::Get(e, s, v);
|
||||
if(b) t << v;
|
||||
else t << "##ERR##";
|
||||
t << "\n";
|
||||
}
|
||||
}
|
||||
sl.SetData(t);
|
||||
}
|
||||
|
||||
PropList::PropList()
|
||||
{
|
||||
SetRect(plc.GetRect());
|
||||
Add(plc.HSizePos().VSizePos(0,20));
|
||||
Add(exit.RightPos(0, 64).BottomPos(0, 20));
|
||||
exit.SetLabel("Close");
|
||||
exit <<= THISBACK(Acceptor);
|
||||
//cancel <<= THISBACK(Rejector);
|
||||
}
|
||||
38
bazaar/CtrlProp/PropList.h
Normal file
38
bazaar/CtrlProp/PropList.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef _CtrlProp_PropList_h_
|
||||
#define _CtrlProp_PropList_h_
|
||||
|
||||
#include "CtrlPropCommon.h"
|
||||
|
||||
#include <LogPosCtrl/LogPosCtrl.h>
|
||||
#include <ValueCtrl/ValueCtrl.h>
|
||||
|
||||
#include <Gen/Gen.h>
|
||||
|
||||
#define LAYOUTFILE <CtrlProp/PropList.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class PropListCtrl : public WithPropListLay<ParentCtrl>, public Visiting<Ctrl>
|
||||
{
|
||||
public:
|
||||
typedef PropListCtrl CLASSNAME;
|
||||
typedef Visiting<Ctrl> V;
|
||||
PropListCtrl();
|
||||
|
||||
virtual void Reload();
|
||||
};
|
||||
|
||||
class PropList : public PopUpC
|
||||
{
|
||||
public:
|
||||
typedef PropList CLASSNAME;
|
||||
PropList();
|
||||
|
||||
void PopUp(Ctrl* owner, Ctrl& e) { plc.Visit(e); PopUpC::PopUp(owner); }
|
||||
virtual void Acceptor() { plc.Clear(); PopUpC::Acceptor(); }
|
||||
|
||||
protected:
|
||||
PropListCtrl plc;
|
||||
Button exit;
|
||||
};
|
||||
|
||||
#endif
|
||||
5
bazaar/CtrlProp/PropList.lay
Normal file
5
bazaar/CtrlProp/PropList.lay
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
LAYOUT(PropListLay, 400, 200)
|
||||
ITEM(DocEdit, gl, WantFocus(false).SetEditable(false).LeftPosZ(0, 168).VSizePosZ(0, 0))
|
||||
ITEM(DocEdit, sl, WantFocus(false).SetEditable(false).HSizePosZ(168, 0).VSizePosZ(0, 0))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
@ -5,118 +5,118 @@
|
|||
#include "ValueCtrl/init"
|
||||
#include "Gen/init"
|
||||
#include "Property/init"
|
||||
#define BLITZ_INDEX__ FFC2270AB0FB33D678F5561A07F438A77
|
||||
#define BLITZ_INDEX__ F423AD2792B14563D52EFE32833EDC900
|
||||
#include "Ctrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FB4183220157DADB51535992BE9ADFC12
|
||||
#define BLITZ_INDEX__ F00634B60DEB942CA101A48F77BBFBF41
|
||||
#include "Pusher.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F4BC91299C20A6B9D8543A53AC29C4DD4
|
||||
#define BLITZ_INDEX__ FF817C39FFB838ADC97294B862481174C
|
||||
#include "Button.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F5F54889575415D7DA9E011B22CAD4677
|
||||
#define BLITZ_INDEX__ FC3DC2476000BF5153164A452796DC931
|
||||
#include "ButtonOption.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FAB6FBE1CC30704B6E85F4C560F470868
|
||||
#define BLITZ_INDEX__ F80059F62B02AFD1BBBB9F971CB73BDC5
|
||||
#include "Option.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F19FC452F7E8FC5DF9AF5FAB26E19CDC4
|
||||
#define BLITZ_INDEX__ F1BFB7E06904B7E20A6431C56DD12B199
|
||||
#include "Switch.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FE5BA8D3795F0AEA139224D0CE165D7B5
|
||||
#define BLITZ_INDEX__ F5741135C4F94C1F634791721B18990D4
|
||||
#include "EditField.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F2B034460C632BA9E18DCCEF898064609
|
||||
#define BLITZ_INDEX__ F8932F7477E38109BE3CC39E443C5C4EE
|
||||
#include "EditString.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FCE260609A5532B2A1E3CF5D3E6B44E48
|
||||
#define BLITZ_INDEX__ F2B7C03AFF7E9674EBF3D100432DB3202
|
||||
#include "EditInt.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FBF49E638A7C7E464F03424D1AFF39E22
|
||||
#define BLITZ_INDEX__ F311BA29969CF95F06F39390CB9E2B642
|
||||
#include "EditInt64.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F3132A0EDB96002892759BB2DBEF1CC9F
|
||||
#define BLITZ_INDEX__ F80514AD98DD1DBDAB25EE296AF36515E
|
||||
#include "EditDouble.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FE0D87E3E2113BEA9B177CD5A2786B002
|
||||
#define BLITZ_INDEX__ F5680D3382C7734D861E2D613719B407A
|
||||
#include "EditStringNotNull.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F0ECB3DDD44A907D388AF81DBFB2A6C93
|
||||
#define BLITZ_INDEX__ F40777EB797C54E908D69BD32E79F7696
|
||||
#include "EditIntNotNull.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F5397628FE5A93A84D77BEFC1ECA67EA6
|
||||
#define BLITZ_INDEX__ F3204F90B35FE5F6164F66EC89DC137F9
|
||||
#include "EditInt64NotNull.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F5F589B1CE1B79516B109AD1AD14BBBDE
|
||||
#define BLITZ_INDEX__ F55A752B0FE5DE8F73A97291177D08634
|
||||
#include "EditDoubleNotNull.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FE06FB7B5E32C6D2828597A81ACAEF624
|
||||
#define BLITZ_INDEX__ F51935E7D4262562452CB137F90BC63B4
|
||||
#include "EditIntSpin.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F4617D89FBF7F0381ED15A40F31611221
|
||||
#define BLITZ_INDEX__ F1110C162CA2321E237CF22D3F7EF200B
|
||||
#include "EditInt64Spin.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F4EF437BC4BDF79A5BE083049E0903B72
|
||||
#define BLITZ_INDEX__ F4A2813D3877DC56F758DB9C3B1DFE684
|
||||
#include "EditDoubleSpin.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F4446E8336B47C63BD2DCA7BD57595C9D
|
||||
#define BLITZ_INDEX__ FF45065BF938CBD5054FD41F8544FFBF4
|
||||
#include "EditIntNotNullSpin.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F509BE4B7BB17734D065674715E03B86F
|
||||
#define BLITZ_INDEX__ FF0CA019C025673B30B6DD746DCF0370E
|
||||
#include "EditInt64NotNullSpin.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FD5D326864DA1DD80729FDC51D7C5CA78
|
||||
#define BLITZ_INDEX__ F7CA3B38624C6B268919B4D8CA91F58EE
|
||||
#include "EditDoubleNotNullSpin.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F09F8F48362E6C915B81A36386271E80B
|
||||
#define BLITZ_INDEX__ F6DE340D1511A3F31B7DB2BF1A524D1E4
|
||||
#include "EditDate.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FE6E5B6C3F6BAB1A7201A5123CDE2305C
|
||||
#define BLITZ_INDEX__ FEB810C23B5E5B493F8F6D1926DB0273D
|
||||
#include "EditTime.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F60DCD6B01D912776843181D1D3724D1E
|
||||
#define BLITZ_INDEX__ F96681D29784D0C8399084812F3B067EE
|
||||
#include "EditDateNotNull.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F7D709718A03B1A9E0AC038DFBEDE79CE
|
||||
#define BLITZ_INDEX__ F9D263D6BC9AACA7C2DEBB3144A257539
|
||||
#include "EditTimeNotNull.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F9AE32D2324197279D4FCF442CDF6C0ED
|
||||
#define BLITZ_INDEX__ F636739565641BD1C7D4BB6F6C522DB13
|
||||
#include "TextCtrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F4F3878C4A91F673762FB3A63F26182D7
|
||||
#define BLITZ_INDEX__ F843BA51FB1969778C50DB670664F3AB6
|
||||
#include "LineEdit.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F26C70D98845F1C603D404C5CD2C161D5
|
||||
#define BLITZ_INDEX__ F1EE91039333A2D0BDD71AAC35E2ED4EC
|
||||
#include "DocEdit.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F79087F1CC260466FFA1EAD8914E36E9F
|
||||
#define BLITZ_INDEX__ F6916C09DA7176809B829758480DF0783
|
||||
#include "StaticText.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FF876FA80BC41C8BC263238671A0075CF
|
||||
#define BLITZ_INDEX__ F948D5DC5F7BA399A93861F27B9F25DA0
|
||||
#include "Label.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F57E0A8F51EA69357C483096AE268C95A
|
||||
#define BLITZ_INDEX__ F151E6742B33E072479A0E57AE1DDEFA4
|
||||
#include "LabelBox.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F6582304123ECBEE22680EA2F77A51451
|
||||
#define BLITZ_INDEX__ F2751C4E67158719586EE8A07F02CAE35
|
||||
#include "ParentCtrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F1532A61E89187887BCBB051F1D0C44ED
|
||||
#define BLITZ_INDEX__ FC8C1C46AA374C1F25F2B53AF8B7A7D28
|
||||
#include "StaticRect.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ FFD30132CA05AA27133EC27B2C07E5ED1
|
||||
#define BLITZ_INDEX__ F42BDAE6EA439EC3076287B3FDBCC1614
|
||||
#include "ImageCtrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F2CE5D540E87DAE77F2D959612019FCC8
|
||||
#define BLITZ_INDEX__ F0EB2CDA1FBD95280264B7E0C8ECFE286
|
||||
#include "DisplayCtrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F0E31EDFC7BADB57A6116CA552C17DD50
|
||||
#define BLITZ_INDEX__ FD0916C7E73D2C73A0548F6D8D210E686
|
||||
#include "Picture.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F4540B0520E33F322636959BD513569CF
|
||||
#define BLITZ_INDEX__ F52B11034669874B724AB30363D607E6E
|
||||
#include "SeparatorCtrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F2C3719B6302762034D27F7F463A33ACE
|
||||
#define BLITZ_INDEX__ F04EE6B20FED7A5309CEA02CDD5F2835E
|
||||
#include "SliderCtrl.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ public:
|
|||
static VectorMap<Value, InstancerType>& Map() { static VectorMap<Value, InstancerType> map; return map; }
|
||||
};
|
||||
|
||||
template<class T> String TypeOfS(T* = NULL) { return String(typeid(T).name()); }
|
||||
template<class T> inline String TypeOfS(T* = 0) { return String(typeid(T).name()); }
|
||||
template<class T> inline String TypeOf(T* t = 0) { return TypeOfS<T>(t); }
|
||||
|
||||
//in polymorph environment, type info is needed, i.e. when xmlizing/serializing elements
|
||||
//to know later which one to instantiate..best used with Instancer
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ struct Property
|
|||
Property(const S& s, const G& g)
|
||||
: set(s), get(g) {}
|
||||
|
||||
const T& Set(const T& a) { ASSERT(set); set(a); return a; }
|
||||
const T& Set(const T& a) const { ASSERT(set); set(a); return a; }
|
||||
T Get() const { ASSERT(get); T t; get(t); return t; }
|
||||
|
||||
inline T operator= (const T& a) { return Set(a); }
|
||||
inline T operator= (const T& a) const { return Set(a); }
|
||||
inline operator T() const { return Get(); }
|
||||
|
||||
public:
|
||||
|
|
@ -36,7 +36,7 @@ struct Accessor
|
|||
Accessor(const S& s, const G& g)
|
||||
: set(s), get(g) {}
|
||||
|
||||
bool Set(const T& a) { ASSERT(set); return set(a); }
|
||||
bool Set(const T& a) const { ASSERT(set); return set(a); }
|
||||
bool Get(T& a) const { ASSERT(get); return get(a); }
|
||||
|
||||
public:
|
||||
|
|
@ -48,6 +48,26 @@ typedef Accessor<Value> ValueAccessor;
|
|||
|
||||
///
|
||||
|
||||
/*
|
||||
Accessor is used to offer set/get callbacks bound to an instance,
|
||||
which is hidden inside the callbacks, providing instance independant calls.
|
||||
they can be handled / grouped in a dictionary or passed to some algorithms, which dont care of instance.
|
||||
|
||||
PropKeeper<> is the interface used to declare hierarchy dependancies
|
||||
and create an instance bound AccessorMap from the PropTyper registered Handlers.
|
||||
corresponding PropTyper is set up with instance independant handlers in Init.
|
||||
PropKeeper and PropTyper are all strongtyped.
|
||||
|
||||
to be able to setup an AccessorMap from base level, there is Props<BaseT>.
|
||||
it uses the typeid to know 'where to start' to call into toplevel PropKeeper SetupAccessorMap
|
||||
dynamic_cast is used to verify only. could be changed to ASSERT.
|
||||
|
||||
to be able to 'browse' the registered handlers from the Base class level,
|
||||
typeid is used with Props<BaseT>. it uses another set of typename maps
|
||||
to know the toplevel class name, 'from where to start' to look for the instance independant handlers.
|
||||
it does not create or access any AccessorMap facilities.
|
||||
*/
|
||||
|
||||
typedef ArrayMap<String, Accessor<Value> > AccessorMap;
|
||||
|
||||
template<class T>
|
||||
|
|
@ -168,9 +188,11 @@ void PropKeeper<KLASS>::Init() \
|
|||
|
||||
|
||||
#define EXT_UNPROPERTY_SET(KLASS, name) \
|
||||
NEVER(); \
|
||||
|
||||
|
||||
#define EXT_UNPROPERTY_GET(KLASS, name) \
|
||||
NEVER(); \
|
||||
|
||||
|
||||
#define EXT_UNPROPERTY(KLASS, name) \
|
||||
|
|
@ -225,7 +247,7 @@ struct Props
|
|||
static bool SetupAccessorMap(T& c, AccessorMap& am)
|
||||
{
|
||||
int i = pmapam().Find(String(typeid(c).name()));
|
||||
if(i<0) i = pmapam().Find(String(typeid(T).name()));
|
||||
if(i<0) i = pmapam().Find(String(typeid(T).name())); //fallback to base only
|
||||
if(i<0) return false;
|
||||
return pmapam()[i](c,am);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue