ZFFramework
 
Loading...
Searching...
No Matches
ZFUICellAdapter Class Referenceabstract

abstract cell adpater to supply cells for container view More...

#include <ZFUICellAdapter.h>

Inheritance diagram for ZFUICellAdapter:
ZFInterface ZFUICellAdapterBasic ZFUICellArray

Public Member Functions

virtual ZFUIOrientation orientation ()
 owner view's orientation
 
virtual const ZFUISizecontainerSize ()
 container's size
 
virtual zffloatcellSizeHint ()
 cell's hint size, use -1 to measure by cell, ZFUIGlobalStyle::itemSizeCell by default
 
virtual void cellSizeHint (zffloat const &propertyValue)
 see cellSizeHint
 
virtual zfboolcellSizeFill ()
 if cellSizeHint not set, whether fill cell size to containerSize, false by default
 
virtual void cellSizeFill (zfbool const &propertyValue)
 see cellSizeFill
 
virtual void cellAdapterNotifyReload (zfindex atIndexOrMax=(((zfindex) -1)))
 see E_CellAdapterOnReload
 
virtual zfindex cellCount (void)=0
 cell count
 
virtual zfautoT< ZFUICellcellAt (zfindex index)=0
 access cell at index, assert fail if return null object
 
virtual zffloat cellSizeAt (zfindex index, ZFUICell *cell)
 check cell size at index
 
void notifyContainerUpdate (ZFUIOrientation orientation, const ZFUISize &containerSize)
 for impl to notify state update
 
void notifyCellAdapterReload (zfindex atIndexOrMax=((zfindex) -1))
 for impl to notify reload
 
void notifyCellUpdate (zfindex atIndex, ZFUICell *cell)
 for impl to notify cell update
 
zfauto notifyCellCacheAccess (zfindex index)
 for impl to notify cell cache access
 
void notifyCellCacheRecycle (ZFUICell *cell)
 for impl to notify cell cache access
 
virtual zfautoT< ZFUICellcellCacheDefaultAccess (const zfstring &key)
 see cellCacheOnRecycle
 
virtual void cellCacheDefaultRecycle (const zfstring &key, ZFUICell *cell)
 see cellCacheOnRecycle
 
- Public Member Functions inherited from ZFInterface
virtual const ZFClassclassData (void)=0
 get instance's class info
 
virtual ZFObjecttoObject (void)=0
 convert to ZFObject type
 

Static Public Member Functions

static const ZFClassClassData (void)
 get class info
 
static zfidentity E_CellAdapterOnReload (void)
 see ZFObject::observerNotify
 
static zfidentity E_CellOnUpdate (void)
 see ZFObject::observerNotify
 
static zfidentity E_CellCacheOnRecycle (void)
 see ZFObject::observerNotify
 
- Static Public Member Functions inherited from ZFInterface
static const ZFClassClassData (void)
 get class info
 

Protected Types

typedef ZFInterface zfsuper
 typedef for super (always ZFInterface for an interface type)
 
typedef ZFUICellAdapter zfself
 typedef for self
 
- Protected Types inherited from ZFInterface
typedef _ZFP_ObjI_Base zfsuper
 typedef for super (always ZFInterface for an interface type)
 
typedef ZFInterface zfself
 typedef for self
 

Protected Member Functions

virtual void cellAdapterOnReload (zfindex atIndexOrMax=((zfindex) -1))
 see E_CellAdapterOnReload
 
virtual void cellOnUpdate (zfindex atIndex, ZFUICell *cell)
 see E_CellOnUpdate
 
virtual zfauto cellCacheOnAccess (zfindex index)
 try access cached cell, return null means no cache available, by default, no cache logic support
 
virtual void cellCacheOnRecycle (ZFUICell *cell)
 recycle cell or do nothing if you don't need recycle logic
 

Detailed Description

abstract cell adpater to supply cells for container view

Member Function Documentation

◆ E_CellAdapterOnReload()

static zfidentity ZFUICellAdapter::E_CellAdapterOnReload ( void )
static

see ZFObject::observerNotify

called when cell adapter's content changed and owner container view needs to be updated, param0 is null to update entire container, or a v_zfindex shows which cell to reload
typically, this event would be fired by cellAdapterNotifyReload which would be called by cell adapter impl

◆ E_CellOnUpdate()

static zfidentity ZFUICellAdapter::E_CellOnUpdate ( void )
static

see ZFObject::observerNotify

called when update cell, param0 is the ZFUICell, param1 is the index of the cell (as v_zfindex)

◆ E_CellCacheOnRecycle()

static zfidentity ZFUICellAdapter::E_CellCacheOnRecycle ( void )
static

see ZFObject::observerNotify

called when recycle cell, param0 is the cell

◆ cellSizeHint()

virtual zffloat & ZFUICellAdapter::cellSizeHint ( )
inlinevirtual

cell's hint size, use -1 to measure by cell, ZFUIGlobalStyle::itemSizeCell by default

setting cellSizeFill would override this property, and use containerSize to layout each cell

◆ cellSizeFill()

virtual zfbool & ZFUICellAdapter::cellSizeFill ( )
inlinevirtual

if cellSizeHint not set, whether fill cell size to containerSize, false by default

this property is useful when combined with ZFUIScrollView::scrollAlignToPageHorizontal series

◆ cellCount()

virtual zfindex ZFUICellAdapter::cellCount ( void )
pure virtual

cell count

Implemented in ZFUICellAdapterBasic, and ZFUICellArray.

◆ cellAt()

virtual zfautoT< ZFUICell > ZFUICellAdapter::cellAt ( zfindex index)
pure virtual

access cell at index, assert fail if return null object

Implemented in ZFUICellAdapterBasic, and ZFUICellArray.

◆ cellSizeAt()

virtual zffloat ZFUICellAdapter::cellSizeAt ( zfindex index,
ZFUICell * cell )
virtual

check cell size at index

for performance, this method is ensured to be called for visible cells only, to check the cell's actual size
while cell is not visible, a predicted hint size (or previous size) would be used util it's coming to visible
return a -1 size to measure the cell automatically, otherwise, the cell's size is fixed
return cellSizeHint according to cellSizeFill by default

Reimplemented in ZFUICellAdapterBasic.

◆ cellCacheOnAccess()

virtual zfauto ZFUICellAdapter::cellCacheOnAccess ( zfindex index)
inlineprotectedvirtual

try access cached cell, return null means no cache available, by default, no cache logic support

see cellCacheOnRecycle for more info

Reimplemented in ZFUICellAdapterBasic, and ZFUICellArray.

◆ cellCacheOnRecycle()

virtual void ZFUICellAdapter::cellCacheOnRecycle ( ZFUICell * cell)
inlineprotectedvirtual

recycle cell or do nothing if you don't need recycle logic

to achieve recycle logic, you should:

  1. override cellCacheOnRecycle and store the cell manually
  2. during cellCacheOnAccess, return your cached cell if exist

by default, we have cellCacheDefaultAccess and cellCacheDefaultRecycle that would suit for most case


The documentation for this class was generated from the following file: