kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView > Class Template Reference

#include <kanzi/ui/node/concept/list_box/list_box_trajectory_presenter.hpp>

Classes

struct  KzuTrajectoryLayoutSnapInfo
 

Public Types

typedef ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView > ListBoxTrajectoryPresenterType
 
typedef shared_ptr< TLayout > LayoutSharedPtr
 
typedef shared_ptr< TItemClass > ItemSharedPtr
 
typedef shared_ptr< TScrollView > ScrollViewSharedPtr
 

Public Member Functions

LayoutSharedPtr getLayout () const
 
void notifyItemAdded (unsigned int index)
 Implements kzuPresenterItemAdded for trajectory list box. More...
 
void notifyItemRemoved (unsigned int index)
 Implements kzuPresenterItemRemoved for trajectory list box. More...
 
void notifyItemReplaced (unsigned int index)
 Implements kzuPresenterItemReplaced for trajectory list box. More...
 
void notifyItemContainerChanged ()
 Invalidates layout if the item container is changed. More...
 
void initialize (TFinalClass *listBox, LayoutSharedPtr layout)
 
void update ()
 Updates presenter's state and visible items. More...
 
void setScroll (Vector2 scroll)
 
void addToLayout (ItemSharedPtr listBoxItem)
 
void removeFromLayout (ItemSharedPtr listBoxItem)
 
 ListBoxTrajectoryPresenter ()
 
 ~ListBoxTrajectoryPresenter ()
 
KzuVirtualItemIterator findMiddleIterator ()
 
Vector2 bringItemCenter (unsigned int selection)
 Brings given item to the selector position. More...
 
void snap (Vector2 position, Vector2 direction, bool changeTarget, Vector2 *out_position, int *out_itemIndex)
 Snaps towards given direction from given position. More...
 

Protected Member Functions

bool calculateVisibleRange ()
 Sets indices and offsets of first and last visible items and the number of visible elements. More...
 
void updateVisibleRange ()
 Asks the list box to update the items in the layout according to the currently set firstIndex and rangeSize, taking also the keep alive into account. More...
 
ItemSharedPtr getItem (size_t presenterIndex)
 
void iterateLeft (KzuVirtualItemIterator *it)
 Iterates left in virtual item list. More...
 
void iterateRight (KzuVirtualItemIterator *it)
 Iterates right in virtual item list. More...
 
void snapImprove (KzuTrajectoryLayoutSnapInfo *snap, unsigned int objectIndex, float offset, float selectorOffset, kzBool snapLeft, kzBool snapRight)
 
void extendVisibleItemRangeToItem (unsigned int index)
 Extends visible range of presenter to it includes specified item. More...
 
Vector3 getItemSize (unsigned int itemIndex)
 Returns size of an item specified by its index. More...
 
unsigned int getItemCount ()
 Gets number of items in presenters list box. More...
 
void iterateToIndex (KzuVirtualItemIterator *iterator, unsigned int index)
 Iterates the iterator to the given index. More...
 

Static Protected Member Functions

static float kzuTrajectoryLayoutPresenterItemWidthFunction_internal (const KzcVector3 *size)
 Gets object's width from its size for virtual item list. More...
 
static kzsError kzuTrajectoryLayoutPresenterItemListSizeFunction_internal (unsigned int index, void *userData, KzcVector3 *out_size)
 Gets object's size by index. More...
 
static unsigned int kzuTrajectoryLayoutPresenterItemCountFunction_internal (void *userData)
 Gets list box's total item count. More...
 

Member Typedef Documentation

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
typedef ListBoxTrajectoryPresenter<TFinalClass, TLayout, TItemClass, TScrollView> kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::ListBoxTrajectoryPresenterType
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
typedef shared_ptr<TLayout> kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::LayoutSharedPtr
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
typedef shared_ptr<TItemClass> kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::ItemSharedPtr
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
typedef shared_ptr<TScrollView> kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::ScrollViewSharedPtr

Constructor & Destructor Documentation

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::ListBoxTrajectoryPresenter ( )
inlineexplicit
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::~ListBoxTrajectoryPresenter ( )
inline

Member Function Documentation

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
LayoutSharedPtr kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::getLayout ( ) const
inline
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::notifyItemAdded ( unsigned int  index)
inline

Implements kzuPresenterItemAdded for trajectory list box.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::notifyItemRemoved ( unsigned int  index)
inline

Implements kzuPresenterItemRemoved for trajectory list box.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::notifyItemReplaced ( unsigned int  index)
inline

Implements kzuPresenterItemReplaced for trajectory list box.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::notifyItemContainerChanged ( )
inline

Invalidates layout if the item container is changed.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::initialize ( TFinalClass *  listBox,
LayoutSharedPtr  layout 
)
inline
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::update ( )
inline

Updates presenter's state and visible items.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::setScroll ( Vector2  scroll)
inline
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::addToLayout ( ItemSharedPtr  listBoxItem)
inline
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::removeFromLayout ( ItemSharedPtr  listBoxItem)
inline
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
KzuVirtualItemIterator kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::findMiddleIterator ( )
inline
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
Vector2 kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::bringItemCenter ( unsigned int  selection)
inline

Brings given item to the selector position.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::snap ( Vector2  position,
Vector2  direction,
bool  changeTarget,
Vector2 out_position,
int *  out_itemIndex 
)
inline

Snaps towards given direction from given position.

Returns snapping target and index of the object that scrolling snapped to, unless they're given as KZ_NULL. The changeTarget should be KZ_TRUE if the list box target is changed to the snapped item.

If snapping happened towards no object, index will be -1.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
bool kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::calculateVisibleRange ( )
inlineprotected

Sets indices and offsets of first and last visible items and the number of visible elements.

Sets the values of viewInternal member.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::updateVisibleRange ( )
inlineprotected

Asks the list box to update the items in the layout according to the currently set firstIndex and rangeSize, taking also the keep alive into account.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
ItemSharedPtr kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::getItem ( size_t  presenterIndex)
inlineprotected
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::iterateLeft ( KzuVirtualItemIterator it)
inlineprotected

Iterates left in virtual item list.

This operation might extend presenters range of visible items if the size of an item where iterator will be pointing to could not be determined otherwise.

Parameters
itIterator to iterate.
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::iterateRight ( KzuVirtualItemIterator it)
inlineprotected

Iterates right in virtual item list.

This operation might extend presenters range of visible items if the size of an item where iterator will be pointing to could not be determined otherwise.

Parameters
itIterator to iterate.
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::snapImprove ( KzuTrajectoryLayoutSnapInfo snap,
unsigned int  objectIndex,
float  offset,
float  selectorOffset,
kzBool  snapLeft,
kzBool  snapRight 
)
inlineprotected
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
static float kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::kzuTrajectoryLayoutPresenterItemWidthFunction_internal ( const KzcVector3 size)
inlinestaticprotected

Gets object's width from its size for virtual item list.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::extendVisibleItemRangeToItem ( unsigned int  index)
inlineprotected

Extends visible range of presenter to it includes specified item.

If item is already inside the visible range, then the range will remain unchanged.

Parameters
indexIndex of the item which should be included into the range.
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
Vector3 kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::getItemSize ( unsigned int  itemIndex)
inlineprotected

Returns size of an item specified by its index.

If the item is outside of presenters range of visible items and its size could not be determined by list box, the visible range will be extended so list box can acquire the item and determine its size.

Parameters
itemIndexIndex of an item whose size should be returned.
Returns
size of an item.
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
unsigned int kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::getItemCount ( )
inlineprotected

Gets number of items in presenters list box.

Returns
item count.
template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
static kzsError kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::kzuTrajectoryLayoutPresenterItemListSizeFunction_internal ( unsigned int  index,
void *  userData,
KzcVector3 out_size 
)
inlinestaticprotected

Gets object's size by index.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
static unsigned int kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::kzuTrajectoryLayoutPresenterItemCountFunction_internal ( void *  userData)
inlinestaticprotected

Gets list box's total item count.

template<typename TFinalClass , typename TLayout , typename TItemClass , typename TScrollView >
void kanzi::ListBoxTrajectoryPresenter< TFinalClass, TLayout, TItemClass, TScrollView >::iterateToIndex ( KzuVirtualItemIterator iterator,
unsigned int  index 
)
inlineprotected

Iterates the iterator to the given index.


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