ZFFramework
Loading...
Searching...
No Matches
ZFUIListView.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUIListView_h_
7#define _ZFI_ZFUIListView_h_
8
9#include "ZFUICellAdapter.h"
10#include "ZFUICellUpdater.h"
12
13// ============================================================
14// ZFUIListView
16#define ZFSerializableKeyword_ZFUIListView_cellAdapter "cellAdapter"
17
18zfclassFwd _ZFP_ZFUIListViewPrivate;
44zfclass ZFLIB_ZFUIWidget ZFUIListView : zfextend ZFUIScrollView {
45 ZFOBJECT_DECLARE(ZFUIListView, ZFUIScrollView)
47
48public:
49 // ============================================================
50 // events
60 ZFEVENT(CellOnAttach)
70 ZFEVENT(CellOnDetach)
76 ZFEVENT(ListVisibleCellOnUpdate)
77
78public:
79 // ============================================================
80 // properties
99 )
100
105
110
119
126
127 // ============================================================
128 // override
129protected:
131 virtual void objectOnInit(void);
133 virtual void objectOnDealloc(void);
135 virtual void objectOnDeallocPrepare(void);
136
137protected:
155 return zffalse;
156 }
159 ZF_IN const ZFSerializableData &serializableData
160 , ZF_OUT_OPT zfstring *errorHint = zfnull
162 );
165 ZF_IN_OUT ZFSerializableData &serializableData
166 , ZF_OUT_OPT zfstring *errorHint = zfnull
167 , ZF_IN_OPT ZFSerializable *refOwner = zfnull
168 );
169
170protected:
172 virtual void layoutOnLayoutPrepare(ZF_IN const ZFUIRect &bounds);
174 virtual void layoutOnLayout(ZF_IN const ZFUIRect &bounds);
175
177 virtual void viewChildOnAdd(
178 ZF_IN ZFUIView *child
180 );
182 virtual void viewChildOnRemove(
183 ZF_IN ZFUIView *child
185 );
186
188 virtual void scrollAreaOnUpdate(void);
190 virtual void scrollContentFrameOnUpdate(void);
191
192protected:
194 virtual void scrollOnScrolledByUser(void);
196 virtual void scrollOnScrollEnd(void);
197
198 // ============================================================
199 // list control
200public:
221 , ZFMP_IN(zfindex, index)
223
224public:
239
240public:
251 , ZFMP_IN(zfindex, cellIndex)
252 , ZFMP_IN_OPT(zffloat, offset, 0)
253 , ZFMP_IN_OPT(zfbool, animated, zftrue)
259 , ZFMP_IN(zfindex, cellIndex)
260 , ZFMP_IN_OPT(zffloat, offset, 0)
261 , ZFMP_IN_OPT(zfbool, animated, zftrue)
263
264 // ============================================================
265 // events
266protected:
268 virtual inline void cellOnAttach(ZF_IN ZFUICell *cell) {
269 this->observerNotify(ZFUIListView::E_CellOnAttach(), ZFArgs().param0(cell));
270 }
271
272 virtual inline void cellOnDetach(ZF_IN ZFUICell *cell) {
273 this->observerNotify(ZFUIListView::E_CellOnDetach(), ZFArgs().param0(cell));
274 }
275
276 virtual void visibleCellsOnUpdate(void);
277
278private:
279 _ZFP_ZFUIListViewPrivate *d;
280 friend zfclassFwd _ZFP_ZFUIListViewPrivate;
281};
282
284#endif // #ifndef _ZFI_ZFUIListView_h_
285
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:210
#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:198
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:202
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:214
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_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 zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
_zft_zffloat zffloat
same as float, see zfindex
Definition ZFCoreTypeDef_CoreType.h:183
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#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_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:692
#define ZFMETHOD_DECLARE_3(ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMethod
Definition ZFMethodDeclare.h:1205
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:853
#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:122
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:324
#define ZFPROPERTY_ON_DETACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:249
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:120
#define ZFPROPERTY_RETAIN_READONLY(Type, Name, InitValueOrEmpty)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:107
#define ZFPROPERTY_ON_ATTACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:239
ZFSerializablePropertyType
serializable property type, see ZFSerializable::serializableOnCheckPropertyType
Definition ZFSerializable.h:40
#define ZFSTYLE_DEFAULT_DECLARE(YourStyle)
used to declare a default style, see ZFStyleable
Definition ZFStyleable.h:268
abstract cell adpater to supply cells for container view
utility to update ZFUICell
v_ZFUIOrientation::ZFEnumType ZFUIOrientation
see v_ZFUIOrientation
Definition ZFUITypeDef.h:1174
v_ZFUIViewChildLayer::ZFEnumType ZFUIViewChildLayer
see v_ZFUIViewChildLayer
Definition ZFUIViewType.h:522
#define ZFLIB_ZFUIWidget
used to export symbols
Definition ZFUIWidgetDef.h:17
listener data used by ZFListener
Definition ZFArgs.h:20
container of ZFObject, see ZFContainer
Definition ZFArray.h:22
light weight array
Definition ZFCoreArray.h:297
POD data to hold index range.
Definition ZFCoreTypeDef_OtherType.h:66
void observerNotify(zfidentity eventId, const ZFArgs &zfargs=ZFArgs())
notify the observer with eventId
info for a property for ZFObject, see ZFPROPERTY_RETAIN for more info
Definition ZFProperty.h:27
ZFSerializable's data container, see ZFSerializable.
Definition ZFSerializableData.h:74
base class of call serializable object
Definition ZFSerializable.h:163
abstract cell adpater to supply cells for container view
Definition ZFUICellAdapter.h:15
utility class to hold cell
Definition ZFUICell.h:21
virtual void scrollAreaOnUpdate(void)
see E_ScrollAreaOnUpdate
virtual zfbool reloadRequested()
true if list need reload
virtual void scrollCellToTail(zfindex cellIndex, zffloat offset=(0), zfbool animated=(_ZFT_t_zftrue))
scroll cell to bottom, see scrollCellToHead
virtual void viewChildOnRemove(ZFUIView *child, ZFUIViewChildLayer layer)
see E_ViewChildOnRemove
virtual void layoutOnLayoutPrepare(const ZFUIRect &bounds)
see E_ViewLayoutOnLayoutPrepare
virtual void scrollContentFrameOnUpdate(void)
see E_ScrollContentFrameOnUpdate
virtual const ZFIndexRange & visibleCellRange()
return first visible cell's index, valid only if reloadRequested is not true
virtual void visibleCellsOnUpdate(void)
see E_ListVisibleCellOnUpdate
virtual zfbool & bounceable()
whether auto update ZFUIScrollView::scrollBounceVertical series according to orientation,...
Definition ZFUIListView.h:124
virtual void layoutOnLayout(const ZFUIRect &bounds)
override ZFUIView to layout scroll view's internal view and content view
virtual void objectOnDealloc(void)
override this to destroy your object
virtual void cellOnAttach(ZFUICell *cell)
see E_CellOnAttach
Definition ZFUIListView.h:268
static zfidentity E_CellOnDetach(void)
see ZFObject::observerNotify
virtual void reload()
reload entire list cells
virtual void objectOnInit(void)
override this to init your object
virtual zfanyT< ZFUICellAdapter > & cellAdapter()
list adapter
Definition ZFUIListView.h:88
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
virtual void cellAdapterAutoRetain(ZFUICellAdapter *cellAdapter)
set and retain the list adapter
virtual void scrollCellToHead(zfindex cellIndex, zffloat offset=(0), zfbool animated=(_ZFT_t_zftrue))
scroll cell to top, do nothing if invalid or no need to scroll
virtual ZFSerializablePropertyType serializableOnCheckPropertyType(const ZFProperty *property)
see ZFSerializable::serializableOnCheckPropertyType
static zfidentity E_CellOnAttach(void)
see ZFObject::observerNotify
virtual zfbool serializableOnSerializeToData(ZFSerializableData &serializableData, zfstring *errorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
corresponding to serializableOnSerializeFromData, return whether the task is success,...
virtual void cellOnDetach(ZFUICell *cell)
see E_CellOnDetach
Definition ZFUIListView.h:272
virtual void viewChildOnAdd(ZFUIView *child, ZFUIViewChildLayer layer)
see E_ViewChildOnAdd
virtual void scrollOnScrollEnd(void)
see E_ScrollOnScrollEnd
virtual zfbool serializableOnCheckNeedSerializeChildren(void)
all child views would be ignored from serializable
Definition ZFUIListView.h:154
virtual ZFUIOrientation & orientation()
direction to layout children, v_ZFUIOrientation::e_Top by default
Definition ZFUIListView.h:117
virtual zfbool serializableOnSerializeFromData(const ZFSerializableData &serializableData, zfstring *errorHint=zft_zfnull, ZFSerializableData *errorPos=zft_zfnull)
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to s...
virtual void reloadCellAt(zfindex index)
reload cell at index immediately, do nothing if index not in visible range or reloadRequested
virtual void scrollOnScrolledByUser(void)
see E_ScrollOnScrolledByUser
virtual zfbool & cellAdapterSerializable()
whether the cellAdapter is serializable, false by default
Definition ZFUIListView.h:104
virtual ZFCoreArray< ZFUICell * > visibleCells()
return a list of current visible cells, valid only if reloadRequested is not true
virtual zfanyT< ZFArray > const & cellUpdater()
list updater to update list cells, holds ZFUICellUpdater
Definition ZFUIListView.h:109
2D rectangle
Definition ZFUITypeDef.h:667
zfanyT< ZFUILayoutParam > child(const zfany &view, zfindex atIndex=((zfindex) -1))
add child and return child's layoutParam
orientation types for UI in ZFFramework
Definition ZFUITypeDef.h:1164
see zfany
Definition zfany.h:113
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:72