Kanzi Framework  3.9.0
Kanzi Engine API
kzu_virtual_item_list.h File Reference

Classes

struct  KzuVirtualItemIterator
 Iterator for KzuVirtualItemList. More...
 

Typedefs

typedef unsigned int(* KzuVirtualItemCountFunction) (void *userData)
 Function that returns item count of a list box. More...
 
typedef kzsError(* KzuVirtualItemSizeFunction) (unsigned int index, void *userData, kanzi::Vector3 &size)
 Function that returns size of an item in the list box. More...
 
typedef float(* KzuVirtualItemWidthFunction) (const kanzi::Vector3 size)
 Function that returns a one-dimensional width of a virtual item, based on it's dimensions. More...
 

Enumerations

enum  KzuVirtualItemListDirectionPreference { KZU_VIRTUAL_ITEM_LIST_PREFER_PREVIOUS, KZU_VIRTUAL_ITEM_LIST_PREFER_NEXT }
 Preferred element when exact match cannot be found. More...
 

Functions

float kzuVirtualItemIteratorGetCenter (const struct KzuVirtualItemIterator *iterator)
 Gets offset of the center of the item pointed by the iterator. More...
 
unsigned int kzuVirtualItemIteratorGetIndex (const struct KzuVirtualItemIterator *iterator)
 Gets index of the item pointed by the iterator. More...
 
float kzuVirtualItemIteratorGetLeftEdge (const struct KzuVirtualItemIterator *iterator)
 Gets offset of the left edge of the item pointed by the iterator. More...
 
unsigned int kzuVirtualItemIteratorGetNextIndex (const struct KzuVirtualItemIterator *iterator)
 Gets index of the item after the item pointed by the iterator. More...
 
unsigned int kzuVirtualItemIteratorGetPreviousIndex (const struct KzuVirtualItemIterator *iterator)
 Gets index of the item before the item pointed by the iterator. More...
 
float kzuVirtualItemIteratorGetRightEdge (const struct KzuVirtualItemIterator *iterator)
 Gets offset of the right edge of the item pointed by the the iterator. More...
 
kzBool kzuVirtualItemIteratorHasNext (const struct KzuVirtualItemIterator *iterator)
 Returns whether the iterator has a next item. More...
 
kzBool kzuVirtualItemIteratorHasPrevious (const struct KzuVirtualItemIterator *iterator)
 Returns whether the iterator has a previous item. More...
 
void kzuVirtualItemIteratorInvalidate (struct KzuVirtualItemIterator *iterator)
 Sets the iterator invalid. More...
 
kzBool kzuVirtualItemIteratorIsValid (const struct KzuVirtualItemIterator *iterator)
 Returns whether the virtual item iterator is valid. More...
 
kzsError kzuVirtualItemIteratorNext (struct KzuVirtualItemIterator *iterator)
 Iterates to the next item. More...
 
kzsError kzuVirtualItemIteratorPrevious (struct KzuVirtualItemIterator *iterator)
 Iterates to the previous item. More...
 
kzsError kzuVirtualItemIteratorUpdateWidth (struct KzuVirtualItemIterator *iterator)
 Asks the iterator to update its width. More...
 
kzsError kzuVirtualItemListCreate (KzuVirtualItemWidthFunction widthFunction, KzuVirtualItemSizeFunction sizeFunction, void *sizeFunctionUserData, KzuVirtualItemCountFunction countFunction, void *countFunctionUserData, struct KzuVirtualItemList **out_itemList)
 Creates a virtual item list that uses the given list box to provide item data. More...
 
kzsError kzuVirtualItemListDelete (struct KzuVirtualItemList *itemList)
 Deletes a virtual item list. More...
 
unsigned int kzuVirtualItemListGetIntervalElementCount (const struct KzuVirtualItemIterator *leftIterator, const struct KzuVirtualItemIterator *rightIterator)
 Gets the number of elements that are in between the left and right iterators, including the iterators. More...
 
kzBool kzuVirtualItemListIsLooping (const struct KzuVirtualItemList *itemList)
 Gets whether the virtual item list is looping. More...
 
void kzuVirtualItemListSetLooping (struct KzuVirtualItemList *itemList, kzBool looping)
 Sets whether the virtual item list is looping. More...
 
void kzuVirtualItemListSetSpacing (struct KzuVirtualItemList *itemList, float spacing)
 Sets spacing between items in the virtual item list. More...
 

Typedef Documentation

◆ KzuVirtualItemWidthFunction

typedef float(* KzuVirtualItemWidthFunction) (const kanzi::Vector3 size)

Function that returns a one-dimensional width of a virtual item, based on it's dimensions.

As an example, if used in a horizontal layout the function should return object's width. This value is used for determining how much space an item will need in the virtual item list.

◆ KzuVirtualItemSizeFunction

typedef kzsError(* KzuVirtualItemSizeFunction) (unsigned int index, void *userData, kanzi::Vector3 &size)

Function that returns size of an item in the list box.

◆ KzuVirtualItemCountFunction

typedef unsigned int(* KzuVirtualItemCountFunction) (void *userData)

Function that returns item count of a list box.

Enumeration Type Documentation

◆ KzuVirtualItemListDirectionPreference

Preferred element when exact match cannot be found.

Enumerator
KZU_VIRTUAL_ITEM_LIST_PREFER_PREVIOUS 

Prefer previous element.

KZU_VIRTUAL_ITEM_LIST_PREFER_NEXT 

Prefer next element.

Function Documentation

◆ kzuVirtualItemIteratorIsValid()

kzBool kzuVirtualItemIteratorIsValid ( const struct KzuVirtualItemIterator iterator)

Returns whether the virtual item iterator is valid.

◆ kzuVirtualItemIteratorInvalidate()

void kzuVirtualItemIteratorInvalidate ( struct KzuVirtualItemIterator iterator)

Sets the iterator invalid.

◆ kzuVirtualItemIteratorUpdateWidth()

kzsError kzuVirtualItemIteratorUpdateWidth ( struct KzuVirtualItemIterator iterator)

Asks the iterator to update its width.

◆ kzuVirtualItemIteratorGetRightEdge()

float kzuVirtualItemIteratorGetRightEdge ( const struct KzuVirtualItemIterator iterator)

Gets offset of the right edge of the item pointed by the the iterator.

◆ kzuVirtualItemIteratorGetCenter()

float kzuVirtualItemIteratorGetCenter ( const struct KzuVirtualItemIterator iterator)

Gets offset of the center of the item pointed by the iterator.

◆ kzuVirtualItemIteratorGetLeftEdge()

float kzuVirtualItemIteratorGetLeftEdge ( const struct KzuVirtualItemIterator iterator)

Gets offset of the left edge of the item pointed by the iterator.

◆ kzuVirtualItemIteratorGetIndex()

unsigned int kzuVirtualItemIteratorGetIndex ( const struct KzuVirtualItemIterator iterator)

Gets index of the item pointed by the iterator.

◆ kzuVirtualItemIteratorHasNext()

kzBool kzuVirtualItemIteratorHasNext ( const struct KzuVirtualItemIterator iterator)

Returns whether the iterator has a next item.

◆ kzuVirtualItemIteratorHasPrevious()

kzBool kzuVirtualItemIteratorHasPrevious ( const struct KzuVirtualItemIterator iterator)

Returns whether the iterator has a previous item.

◆ kzuVirtualItemIteratorGetNextIndex()

unsigned int kzuVirtualItemIteratorGetNextIndex ( const struct KzuVirtualItemIterator iterator)

Gets index of the item after the item pointed by the iterator.

◆ kzuVirtualItemIteratorGetPreviousIndex()

unsigned int kzuVirtualItemIteratorGetPreviousIndex ( const struct KzuVirtualItemIterator iterator)

Gets index of the item before the item pointed by the iterator.

◆ kzuVirtualItemIteratorNext()

kzsError kzuVirtualItemIteratorNext ( struct KzuVirtualItemIterator iterator)

Iterates to the next item.

◆ kzuVirtualItemIteratorPrevious()

kzsError kzuVirtualItemIteratorPrevious ( struct KzuVirtualItemIterator iterator)

Iterates to the previous item.

◆ kzuVirtualItemListCreate()

kzsError kzuVirtualItemListCreate ( KzuVirtualItemWidthFunction  widthFunction,
KzuVirtualItemSizeFunction  sizeFunction,
void *  sizeFunctionUserData,
KzuVirtualItemCountFunction  countFunction,
void *  countFunctionUserData,
struct KzuVirtualItemList **  out_itemList 
)

Creates a virtual item list that uses the given list box to provide item data.

Parameters
widthFunctionFunction that returns the width from an object size.
sizeFunctionFunction that returns the size of an object by index.
sizeFunctionUserDataUser data for the size function.
countFunctionFunction that returns total item count of virtual item list.
countFunctionUserDataUser data for the count function.
out_itemListThe created virtual item list.
Returns
Error code.

◆ kzuVirtualItemListDelete()

kzsError kzuVirtualItemListDelete ( struct KzuVirtualItemList itemList)

Deletes a virtual item list.

◆ kzuVirtualItemListSetLooping()

void kzuVirtualItemListSetLooping ( struct KzuVirtualItemList itemList,
kzBool  looping 
)

Sets whether the virtual item list is looping.

◆ kzuVirtualItemListIsLooping()

kzBool kzuVirtualItemListIsLooping ( const struct KzuVirtualItemList itemList)

Gets whether the virtual item list is looping.

◆ kzuVirtualItemListSetSpacing()

void kzuVirtualItemListSetSpacing ( struct KzuVirtualItemList itemList,
float  spacing 
)

Sets spacing between items in the virtual item list.

◆ kzuVirtualItemListGetIntervalElementCount()

unsigned int kzuVirtualItemListGetIntervalElementCount ( const struct KzuVirtualItemIterator leftIterator,
const struct KzuVirtualItemIterator rightIterator 
)

Gets the number of elements that are in between the left and right iterators, including the iterators.

For example:

  • kzuVirtualItemListGetIntervalElementCount(iterator, iterator) returns 1.
  • kzuVirtualItemListGetIntervalElementCount(current, next) returns 2.

Calling this function with invalid iterators results in undefined behavior.