styleable More...
Go to the source code of this file.
Classes | |
class | ZFStyleable |
styleable element that can apply style from another object More... | |
class | ZFStyle |
common styleable object More... | |
Namespaces | |
namespace | ZFGlobalEvent |
Macros | |
#define | ZFSTYLE_DEFAULT_DECLARE(YourStyle) |
used to declare a default style, see ZFStyleable | |
#define | ZFSTYLE_DEFAULT_DEFINE(YourStyle) |
see ZFSTYLE_DEFAULT_DECLARE | |
#define | ZFSTYLE_DEFAULT_AUTO_COPY() |
util macro to setup automatically copy style from ZFStyleable::defaultStyle | |
#define | ZFStyleUpdateBlock() |
util macro to call ZFStyleUpdateBegin/ZFStyleUpdateEnd | |
#define | ZFSTYLE_DECODER_DEFINE(registerSig, decodeAction, ...) |
register a custom decoder for ZFStyleSet | |
Functions | |
void | ZFStyleDefaultApplyAutoCopy (ZFStyleable *style) |
util method to setup automatically copy style from ZFStyleable::defaultStyle if its property value changed | |
void | ZFStyleSet (const zfstring &styleKey, ZFStyleable *styleValue) |
used to store style holder | |
zfauto | ZFStyleGet (const zfstring &styleKey) |
see ZFStyleSet | |
void | ZFStyleGetAll (ZFCoreArray< zfstring > &styleKey, ZFCoreArray< zfauto > &styleValue) |
get all styles, for debug use only, see ZFStyleSet | |
void | ZFStyleGetAllKeyT (ZFCoreArray< zfstring > &styleKey) |
see ZFStyleGetAll | |
ZFCoreArray< zfstring > | ZFStyleGetAllKey (void) |
see ZFStyleGetAll | |
void | ZFStyleGetAllValueT (ZFCoreArray< zfauto > &styleValue) |
see ZFStyleGetAll | |
ZFCoreArray< zfauto > | ZFStyleGetAllValue (void) |
see ZFStyleGetAll | |
void | ZFStyleRemoveAll (void) |
remove all styles, see ZFStyleSet | |
void | ZFStyleUpdateBegin () |
see ZFStyleSet | |
void | ZFStyleUpdateEnd () |
see ZFStyleSet | |
zfidentity | ZFGlobalEvent::E_ZFStyleOnUpdate (void) |
see ZFObject::observerNotify | |
zfidentity | ZFGlobalEvent::E_ZFStyleOnInvalid (void) |
see ZFObject::observerNotify | |
styleable
#define ZFSTYLE_DEFAULT_DECLARE | ( | YourStyle | ) |
used to declare a default style, see ZFStyleable
usage:
the macros above declare these types for you:
#define ZFSTYLE_DEFAULT_AUTO_COPY | ( | ) |
util macro to setup automatically copy style from ZFStyleable::defaultStyle
use ZFINTERFACE_ON_INIT_DECLARE to copy styles during init, and use ZFStyleDefaultApplyAutoCopy to ensure default style value changes would be applied
#define ZFSTYLE_DECODER_DEFINE | ( | registerSig, | |
decodeAction, | |||
... ) |
register a custom decoder for ZFStyleSet
usage:
all of the decoder would be executed once (order is not ensured) until success, if none returned true, builtin style map would be searched instead
|
extern |
util method to setup automatically copy style from ZFStyleable::defaultStyle if its property value changed
for performance, the default style won't be copied to each instance by default, by calling this method, when ZFStyleable::defaultStyle's property value changed, it would be copied to the registered instance
|
extern |
used to store style holder
typical style logic are implemented by:
example:
the style logic can also be used during serialization, when serializable contains key ZFSerializableKeyword_styleKey, the style would be copied during serialization, and restored when serialized back to data, a typical workflow:
by default, all ZFStyleable supports style logic, for non-ZFStyleable types, zfint for example, can also benifit from style logic if:
to apply style logic for these non-ZFStyleable types:
when style of yourStyleKey changed, yourPropertyName's setter method would be called to apply the style
note, by default, all styles would be cleared during ZFFrameworkCleanup as level ZFLevelZFFrameworkNormal
ADVANCED:
you may register your own style decoder by ZFSTYLE_DECODER_DEFINE to supply additional style logic
by default, we bundled a special load logic by ZFStyleDecoder_ZFObjectIO, which would load style from specified path info, for example:
see ZFStyleSet