ultimatepp/bazaar/FormEditorProperties/PropertiesMacro.h
Sc0rch 9959d8888c MapRender: First release (FormEditorCommon, FormEditorProperties, Map, MapBG, MapCommon, MapEditor, MapRenderTest.
git-svn-id: svn://ultimatepp.org/upp/trunk@4180 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-11-18 06:28:11 +00:00

65 lines
2.4 KiB
C

#ifndef FORM_EDITOR_PROPERTIES__PROPERTIES_MACRO_H
#define FORM_EDITOR_PROPERTIES__PROPERTIES_MACRO_H
///////////////////////////////////////////////////////////////////////////////////////////////
// Properties declaration macros
///////////////////////////////////////////////////////////////////////////////////////////////
#define PROPS_INIT_PROPERTIES virtual void InitProperties() \
{
#define PROPS_INIT_PROPERTIES_END \
}
#define PROPS_DEFINE_PROPERTY(MethodSet, MethodGet) \
GetProperties().Add().SetCalls(THISBACK(PropSet##MethodSet), THISBACK(PropGet##MethodGet)) \
PROPS_SET_NAME(#MethodSet)PROPS_GET_NAME(#MethodGet)
// Meta info for property
#define PROPS_SET_NAME(Name) .AddMetaInfo("SetMethodName", Name)
#define PROPS_GET_NAME(Name) .AddMetaInfo("GetMethodName", Name)
#define PROPS_GROUP(Group) .AddMetaInfo("Group", Group)
#define PROPS_NAME(Name) .AddMetaInfo("Name", Name)
#define PROPS_HINT(Hint) .AddMetaInfo("Hint", Hint)
#define PROPS_DEFAULT(Default) .SetDefault(Default)
#define PROPS_TYPE(EditType, Notify) .SetEdit(new EditType, Notify)
// Ends property description
#define PROPS_PROPERTY_END \
;
///////////////////////////////////////////////////////////////////////////////////////////////
// Properties implementation macros
///////////////////////////////////////////////////////////////////////////////////////////////
#define PROPS_METHOD_SET(MethodName, ...) \
void PropSet##MethodName(const Vector<Value>& args) \
{ \
SProperty c(args); \
PropertyCaller<CLASSNAME, __VA_ARGS__>::call(*this, &CLASSNAME::MethodName, c); \
}
#define PROPS_METHOD_GET(MethodName, ...) \
void PropGet##MethodName(Value& v, const Vector<Value>& args) \
{ \
SProperty c(args); \
PropertyCaller<CLASSNAME, __VA_ARGS__>::call(*this, &CLASSNAME::MethodName, c); \
v = c.Return; \
}
#define PROPS_CLASS_METHOD_SET(ClassName, MethodName, ...) \
void PropSet##MethodName(const Vector<Value>& args) \
{ \
SProperty c(args); \
PropertyCaller<ClassName, __VA_ARGS__>::call(GetCtrl(), &ClassName::MethodName, c); \
}
#define PROPS_CLASS_METHOD_GET(ClassName, MethodName, ...) \
void PropGet##MethodName(Value& v, const Vector<Value>& args) \
{ \
SProperty c(args); \
PropertyCaller<ClassName, __VA_ARGS__>::call(GetCtrl(), &ClassName::MethodName, c); \
v = c.Return; \
}
#endif