kzu_virtual_item_list.h File Reference

Classes

struct  KzuVirtualItemIterator
 Iterator for KzuVirtualItemList. More...
 

Typedefs

typedef float(* KzuVirtualItemWidthFunction) (const struct KzcVector3 *size)
 Function that returns a one-dimensional width of a virtual item, based on it's dimensions. More...
 
typedef kzsError(* KzuVirtualItemSizeFunction) (unsigned int index, void *userData, struct KzcVector3 *out_size)
 Function that returns size of an item in the list box. More...
 
typedef unsigned int(* KzuVirtualItemCountFunction) (void *userData)
 Function that returns item count of a list box. 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

kzBool kzuVirtualItemIteratorIsValid (const struct KzuVirtualItemIterator *iterator)
 Returns whether the virtual item iterator is valid. More...
 
void kzuVirtualItemIteratorInvalidate (struct KzuVirtualItemIterator *iterator)
 Sets the iterator invalid. More...
 
kzsError kzuVirtualItemIteratorUpdateWidth (struct KzuVirtualItemIterator *iterator)
 Asks the iterator to update its width. More...
 
float kzuVirtualItemIteratorGetRightEdge (const struct KzuVirtualItemIterator *iterator)
 Gets offset of the right edge of the item pointed by the the iterator. More...
 
float kzuVirtualItemIteratorGetCenter (const struct KzuVirtualItemIterator *iterator)
 Gets offset of the center 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 kzuVirtualItemIteratorGetIndex (const struct KzuVirtualItemIterator *iterator)
 Gets index of the item pointed by 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...
 
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...
 
kzsError kzuVirtualItemIteratorNext (struct KzuVirtualItemIterator *iterator)
 Iterates to the next item. More...
 
kzsError kzuVirtualItemIteratorPrevious (struct KzuVirtualItemIterator *iterator)
 Iterates to the previous item. More...
 
kzsError kzuVirtualItemListCreate (const struct KzcMemoryManager *memoryManager, 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...
 
void kzuVirtualItemListSetLooping (struct KzuVirtualItemList *itemList, kzBool looping)
 Sets whether the virtual item list is looping. More...
 
kzBool kzuVirtualItemListIsLooping (const struct KzuVirtualItemList *itemList)
 Gets 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...
 
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...
 

Typedef Documentation

typedef float(* KzuVirtualItemWidthFunction) (const struct KzcVector3 *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.

typedef kzsError(* KzuVirtualItemSizeFunction) (unsigned int index, void *userData, struct KzcVector3 *out_size)

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

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

Function that returns item count of a list box.

Enumeration Type Documentation

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

kzBool kzuVirtualItemIteratorIsValid ( const struct KzuVirtualItemIterator iterator)

Returns whether the virtual item iterator is valid.

void kzuVirtualItemIteratorInvalidate ( struct KzuVirtualItemIterator iterator)

Sets the iterator invalid.

kzsError kzuVirtualItemIteratorUpdateWidth ( struct KzuVirtualItemIterator iterator)

Asks the iterator to update its width.

float kzuVirtualItemIteratorGetRightEdge ( const struct KzuVirtualItemIterator iterator)

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

float kzuVirtualItemIteratorGetCenter ( const struct KzuVirtualItemIterator iterator)

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

float kzuVirtualItemIteratorGetLeftEdge ( const struct KzuVirtualItemIterator iterator)

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

unsigned int kzuVirtualItemIteratorGetIndex ( const struct KzuVirtualItemIterator iterator)

Gets index of the item pointed by the iterator.

kzBool kzuVirtualItemIteratorHasNext ( const struct KzuVirtualItemIterator iterator)

Returns whether the iterator has a next item.

kzBool kzuVirtualItemIteratorHasPrevious ( const struct KzuVirtualItemIterator iterator)

Returns whether the iterator has a previous item.

unsigned int kzuVirtualItemIteratorGetNextIndex ( const struct KzuVirtualItemIterator iterator)

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

unsigned int kzuVirtualItemIteratorGetPreviousIndex ( const struct KzuVirtualItemIterator iterator)

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

kzsError kzuVirtualItemIteratorNext ( struct KzuVirtualItemIterator iterator)

Iterates to the next item.

kzsError kzuVirtualItemIteratorPrevious ( struct KzuVirtualItemIterator iterator)

Iterates to the previous item.

kzsError kzuVirtualItemListCreate ( const struct KzcMemoryManager memoryManager,
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
widthFunctionReturns width from an object size.
sizeFunctionReturns size of an object by index.
countFunctionReturns total item count of virtual item list.
kzsError kzuVirtualItemListDelete ( struct KzuVirtualItemList itemList)

Deletes a virtual item list.

void kzuVirtualItemListSetLooping ( struct KzuVirtualItemList itemList,
kzBool  looping 
)

Sets whether the virtual item list is looping.

kzBool kzuVirtualItemListIsLooping ( const struct KzuVirtualItemList itemList)

Gets whether the virtual item list is looping.

void kzuVirtualItemListSetSpacing ( struct KzuVirtualItemList itemList,
float  spacing 
)

Sets spacing between items in the virtual item list.

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.