ZFFramework
 
Loading...
Searching...
No Matches
ZFUICellArray.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUICellArray_h_
7#define _ZFI_ZFUICellArray_h_
8
9#include "ZFUICellAdapter.h"
11
12// ============================================================
14#define ZFSerializableKeyword_ZFUICellArray_cell "ZFSerializableKeyword_ZFUICellArray_cell"
15
27zfclass ZFLIB_ZFUIWidget ZFUICellArray : zfextend ZFStyle, zfimplement ZFUICellAdapter {
28 ZFOBJECT_DECLARE(ZFUICellArray, ZFStyle)
29 ZFIMPLEMENT_DECLARE(ZFUICellAdapter)
30
31protected:
33 virtual void objectOnInit(void) {
35 d = zfAlloc(ZFArray);
36 }
38 virtual void objectOnDealloc(void) {
39 zfRelease(d);
41 }
43 virtual void objectOnDeallocPrepare(void) {
44 this->cellRemoveAll();
46 }
47
48public:
54 return d;
55 }
56
59 ZFMETHOD_INLINE_1(void, cell
60 , ZFMP_IN(ZFUICell *, cell)
61 ) {
62 d->add(cell);
63 }
64
67 ZFMETHOD_INLINE_2(void, cell
68 , ZFMP_IN(ZFUICell *, cell)
69 , ZFMP_IN(zfindex, index)
70 ) {
71 d->add(cell, index);
72 }
73
76 ZFMETHOD_INLINE_2(void, cellRemove
77 , ZFMP_IN(zfindex, index)
78 , ZFMP_IN_OPT(zfindex, count, 1)
79 ) {
80 d->remove(index, count);
81 }
82
85 ZFMETHOD_INLINE_1(void, cellRemoveElement
86 , ZFMP_IN(ZFUICell *, cell)
87 ) {
88 d->removeElement(cell);
89 }
90
94 d->removeAll();
95 }
96
97public:
99 virtual zfindex cellCount(void) {
100 return d->count();
101 }
104 return d->get(index);
105 }
106
107protected:
110 return d->get(index);
111 }
112
113protected:
116 ZF_IN const ZFSerializableData &serializableData
117 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
118 , ZF_OUT_OPT ZFSerializableData *outErrorPos = zfnull
119 );
122 ZF_IN_OUT ZFSerializableData &serializableData
123 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
124 , ZF_IN_OPT ZFSerializable *refOwner = zfnull
125 );
126
127private:
128 ZFArray *d;
129};
130
132#endif // #ifndef _ZFI_ZFUICellArray_h_
133
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:192
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_INLINE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1095
#define ZFMETHOD_INLINE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:755
#define ZFMETHOD_INLINE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:920
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#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 ZFIMPLEMENT_DECLARE(ImplementedInterfaces,...)
see ZFINTERFACE_DECLARE
Definition ZFObjectInterface.h:169
#define zfimplement
shows class implement from interface, see ZFInterface
Definition ZFObjectInterface.h:24
#define zfRelease(obj)
release an object, see ZFObject
Definition ZFObjectRetain.h:148
#define zfAlloc(T_ZFObject,...)
alloc an object, see ZFObject
Definition ZFObjectRetain.h:104
abstract cell adpater to supply cells for container view
#define ZFLIB_ZFUIWidget
used to export symbols
Definition ZFUIWidgetDef.h:17
container of ZFObject, see ZFContainer
Definition ZFArray.h:17
virtual void objectOnInit(void)
override this to init your object
virtual void objectOnDealloc(void)
override this to destroy your object
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
Definition ZFObjectCore.h:758
ZFSerializable's data container, see ZFSerializable.
Definition ZFSerializableData.h:74
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
Definition ZFUICellArray.h:43
virtual zfautoT< ZFUICell > cellAt(zfindex index)
access cell at index, assert fail if return null object
Definition ZFUICellArray.h:103
virtual zfindex cellCount(void)
cell count
Definition ZFUICellArray.h:99
virtual zfauto cellCacheOnAccess(zfindex index)
try access cached cell, return null means no cache available, by default, no cache logic support
Definition ZFUICellArray.h:109
virtual zfbool serializableOnSerializeFromData(const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull)
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to s...
virtual ZFArray * cellArray()
directly access internal cell array, you may modify it directly, with caution
Definition ZFUICellArray.h:53
virtual zfbool serializableOnSerializeToData(ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
corresponding to serializableOnSerializeFromData, return whether the task is success,...
virtual void cell(ZFUICell *cell)
add cell
Definition ZFUICellArray.h:61
virtual void objectOnDealloc(void)
override this to destroy your object
Definition ZFUICellArray.h:38
virtual void objectOnInit(void)
override this to init your object
Definition ZFUICellArray.h:33
virtual void cellRemoveAll()
remove all cell
Definition ZFUICellArray.h:93
utility class to hold cell
Definition ZFUICell.h:21
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34
type restrict version of zfauto
Definition zfautoFwd.h:110