with styleable logic, you may copy contents from another object easily
to declare a styleable, it's recommended to declare like this:
};
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFSTYLE_DEFAULT_DECLARE(YourStyle)
used to declare a default style, see ZFStyleable
Definition ZFStyleable.h:318
#define ZFSTYLE_DEFAULT_DEFINE(YourStyle)
see ZFSTYLE_DEFAULT_DECLARE
Definition ZFStyleable.h:321
once declared, object's style can be copied as styleable easily:
obj->styleableCopyFrom(anotherStyleableObject);
and you can access default style by the macro generated method:
YourStyle::DefaultStyle();
then, it's convenient to chain different styleable object to achieve simple style logic:
};
#define ZFPROPERTY_RETAIN(Type, Name,...)
declare a retain property
Definition ZFPropertyDeclare.h:103
Advanced styleable
styleable is useful to achieve advance skin logic, use ZFStyleable::styleKey to supply your style:
yourObj->styleKey("your_skin_key");
this code register yourObj to ZFStyleSet, once the skin value associated with "your_skin_key" has changed by ZFStyleChangeEnd, yourObj would be notified and copy style from it automatically
for non-ZFStyleable property, you may also attach to style if it's registered by ZFTYPEID_DECLARE
yourObj->styleKeyForProperty(
ZFPropertyAccess(YourObject, yourProperty),
"your_skin_key");
#define ZFPropertyAccess(OwnerClass, Name)
access the property directly, compile error if not declared
Definition ZFPropertyDeclare.h:19
also, thanks to ZFClass's instance observer, you may achieve more complex style logic:
MyStyleableObject *obj = zfargs.sender();
obj->myProperty(xxx);
obj->styleableCopyFrom(yyy);
MyStyleableObject::ClassData()->instanceObserverAdd(myObjCreated);
#define ZFLISTENER(name)
util to declare a ZFListener locally
Definition ZFListenerDeclare.h:53
#define ZFLISTENER_END()
see ZFLISTENER
Definition ZFListenerDeclare.h:17