ListBoxConceptImpl provides common base implementation for different list boxes. More...
#include <kanzi/ui/node/concept/list_box.hpp>
Public Types | |
typedef ListBoxTraits::TScrollViewClass | ScrollViewClass |
typedef ListBoxTraits::TItemClass | ItemClass |
typedef ListBoxTraits::TItemContainerClass | ItemContainerClass |
typedef ListBoxTraits::TPresenterClass | PresenterClass |
typedef ListBoxTraits::TItemGeneratorClass | ItemGeneratorClass |
typedef ListBoxTraits::TItemContainerGeneratorClass | ItemContainerGeneratorClass |
typedef TBaseClass::LayoutVectorType | LayoutVectorType |
typedef shared_ptr< ScrollViewClass > | ScrollViewSharedPtr |
typedef shared_ptr< ItemClass > | ItemSharedPtr |
typedef shared_ptr< ItemContainerClass > | ItemContainerSharedPtr |
typedef shared_ptr< DefaultListBoxItemGenerator< ItemGeneratorClass > > | DefaultItemGeneratorSharedPtr |
typedef shared_ptr< ItemGeneratorClass > | ItemGeneratorSharedPtr |
typedef shared_ptr< ItemContainerGeneratorClass > | ItemContainerGeneratorSharedPtr |
typedef shared_ptr< PresenterClass > | PresenterSharedPtr |
Public Types inherited from kanzi::ListBoxConcept | |
enum | SelectionBehavior { SelectionBehaviorNone, SelectionBehaviorBringToCenter } |
Behaviors for list box when an item in the list box is selected. More... | |
Public Member Functions | |
virtual bool | addContentItem (NodeSharedPtr abstractItem) KZ_OVERRIDE |
virtual bool | removeContentItem (NodeSharedPtr abstractItem) KZ_OVERRIDE |
virtual void | removeAllContentItems () KZ_OVERRIDE |
virtual size_t | getContentItemCount () KZ_OVERRIDE |
virtual NodeSharedPtr | getContentItem (size_t index) KZ_OVERRIDE |
PresenterSharedPtr | getPresenter () const |
size_t | getItemCount () |
Returns the total item count of the list box. Includes all virtual items. More... | |
optional< pair< size_t, size_t > > | getAliveRange () |
Returns the range of items being alive in the buffer (based on the KeepItemsAlive property). More... | |
bool | isEmpty () |
Returns true if the list box has no items. More... | |
LayoutVectorType | getItemSize (size_t index) |
Returns size of the item at the given index or unbounded layout value if size could not be determined without acquiring the item first. More... | |
optional< size_t > | getItemIndex (ItemSharedPtr item) |
Returns index of the given item. If the item does not exist currently, returns empty. More... | |
ItemSharedPtr | getItem (size_t index) |
Gets the item at the given index in a list box. More... | |
void | insertItem (size_t index, ItemSharedPtr item) |
Inserts an item at the given index in a list box when using the default object generator. More... | |
void | removeItem (size_t index) |
Removes the item at the given index from a list box when using the default object generator. More... | |
void | replaceItem (size_t index, ItemSharedPtr item) |
Replaces the item at the given index from a list box when using the default object generator. More... | |
void | addItem (ItemSharedPtr item) |
Adds an item at the end of a list box when using the default object generator. More... | |
void | removeLastItem () |
Removes the last item from a list box when using the default object generator. More... | |
void | removeAllItems () |
Removes all items from a list box when using the default object generator. More... | |
void | selectItem (optional< size_t > itemIndex) |
Requests the list box to select the item in the given index. More... | |
virtual void | notifyItemAdded (size_t index) KZ_OVERRIDE |
Virtual functions for notifying item changes to list. More... | |
virtual void | notifyItemRemoved (size_t index) KZ_OVERRIDE |
virtual void | notifyItemReplaced (size_t index) KZ_OVERRIDE |
virtual void | notifyItemCountChanged () KZ_OVERRIDE |
void | notifyItemContainerChanged () |
virtual LayoutVectorType | measureOverride (LayoutVectorType availableSize) KZ_OVERRIDE |
virtual void | arrangeOverride (LayoutVectorType actualSize) KZ_OVERRIDE |
void | updateVisibleRangeQuiet (size_t beginIndex, size_t itemCount) |
Requests items from the item generator. More... | |
void | updateVisibleRange (size_t beginIndex, size_t itemCount) |
Requests items from the item generator. More... | |
void | updateVisibleRange (size_t beginIndex, size_t itemCount, bool sendMessages) |
ScrollViewSharedPtr | getScrollView () const |
Returns scroll view used for scrolling list box. More... | |
void | bringItemCenter (size_t itemIndex, bool smooth) |
Requests the list box to focus on the item in the given index. More... | |
int | getKeepAliveItemCount () const |
Gets the value of #KeepAliveItemCount. More... | |
void | setKeepAliveItemCount (int value) |
Sets the value of #KeepAliveItemCount. More... | |
int | getSelectedItemIndex () const |
Gets the value of #SelectedItemIndex. More... | |
void | setSelectedItemIndex (int value) |
Sets the value of #SelectedItemIndex. More... | |
SelectionBehavior | getSelectionBehavior () const |
Gets the value of SelectionBehavior. More... | |
void | setSelectionBehavior (SelectionBehavior value) |
Sets the value of SelectionBehavior. More... | |
string | getItemGeneratorTypeName () const |
Gets the value of #ObjectGeneratorTypeName. More... | |
void | setItemGeneratorTypeName (string_view value) |
Sets the value of #ObjectGeneratorTypeName. More... | |
string | getItemContainerGeneratorTypeName () const |
Gets the value of #ItemContainerGeneratorTypeName. More... | |
void | setItemContainerGeneratorTypeName (string_view value) |
Sets the value of #ItemContainerGeneratorTypeName. More... | |
PrefabTemplateSharedPtr | getItemTemplate () const |
Gets the value of #ItemTemplate. More... | |
void | setItemTemplate (PrefabTemplateSharedPtr value) |
Sets the value of #ItemTemplate. More... | |
PrefabTemplateSharedPtr | getItemContainerTemplate () const |
Gets the value of #ItemContainerTemplate. More... | |
void | setItemContainerTemplate (PrefabTemplateSharedPtr value) |
Sets the value of #ItemContainerTemplate. More... | |
void | setItemGenerator (ItemGeneratorSharedPtr itemGenerator) |
Sets the list box item generator. More... | |
void | setItemContainerGenerator (ItemContainerGeneratorSharedPtr itemContainerGenerator) |
Sets the list box item container generator. More... | |
Public Member Functions inherited from kanzi::ContentItemCollectionModel | |
virtual | ~ContentItemCollectionModel () |
Static Public Member Functions | |
static Vector2 | doMeasure (Node2D &node) |
static Vector3 | doMeasure (Node3D &node) |
Static Public Member Functions inherited from kanzi::ListBoxConcept | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
Protected Member Functions | |
ListBoxConceptImpl (Domain *domain, string_view name) | |
~ListBoxConceptImpl () | |
void | initialize (ScrollViewSharedPtr scroll, PresenterSharedPtr pres) |
void | onClicked (ClickManipulator::ClickMessageArguments &messageArguments) |
void | onScrolled (ScrollViewConcept::ScrollMessageArguments &messageArguments) |
void | onSnapRequested (ScrollViewConcept::SnapRequestMessageArguments &messageArguments) |
void | sendScrollViewScrollTargetMessage (const Vector2 &scrollTarget) |
Sends new scroll target to scroll view. More... | |
void | sendSetScrollViewScrollMessage (const Vector2 &scrollPosition) |
Sends new current scroll position to scroll view. More... | |
void | sendListBoxTargetChangedMessage (size_t targetItem) |
Sends new current scroll position to scroll view. More... | |
virtual void | onAttached () KZ_OVERRIDE |
Node::onAttached() implementation. More... | |
virtual void | onDetached () KZ_OVERRIDE |
Node::onDetached() implementation. More... | |
virtual void | onNodePropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason) KZ_OVERRIDE |
Node::onNodePropertyChanged() implementation. More... | |
void | applySelectionBehavior (size_t itemIndex, bool smooth) |
Applies selection behavior to specified item. More... | |
void | assignItemGenerator (ItemGeneratorSharedPtr itemGenerator) |
Assigns list box item generator to list box. More... | |
void | setItemGeneratorByProperty () |
Creates and assigns item generator by ItemGeneratorTypeName property value. More... | |
void | assignItemContainerGenerator (ItemContainerGeneratorSharedPtr itemContainerGenerator) |
Assigns list box item container generator to list box. More... | |
void | setItemContainerGeneratorByProperty () |
Creates and assigns item container generator by ItemGeneratorTypeName property value. More... | |
void | updateGenerators (ItemGeneratorSharedPtr itemGenerator, ItemContainerGeneratorSharedPtr itemContainerGenerator) |
Replaces item and item container generators with new objects. Updates items and layout accordingly. More... | |
void | synchronizeSelectedItemIndexProperty () |
Updates SelectedItemIndex property after selected item index changes internally by list box. More... | |
Static Protected Member Functions | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
ListBoxConceptImpl provides common base implementation for different list boxes.
List box is a layout node that contain other nodes as items. The list box provides an invisible hit testable area that listens to input and reacts when the user pans the area. The list box then scrolls the items so that new items become visible and old items disappear. How this actually happens depends on the specific list boxes.
The list box gets its items from an item generator. By default the list box uses the DefaultListBoxItemGenerator that simply stores the items that have been added to it. It is possible to create dynamic content for the list box by replacing the item generator with a custom implementation.
The list box wraps its items in container nodes that are created by an item container generator. The default item generator creates invisible nodes that don't do anything.
typedef ListBoxTraits::TScrollViewClass kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ScrollViewClass |
typedef ListBoxTraits::TItemClass kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemClass |
typedef ListBoxTraits::TItemContainerClass kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemContainerClass |
typedef ListBoxTraits::TPresenterClass kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::PresenterClass |
typedef ListBoxTraits::TItemGeneratorClass kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemGeneratorClass |
typedef ListBoxTraits::TItemContainerGeneratorClass kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemContainerGeneratorClass |
typedef TBaseClass::LayoutVectorType kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::LayoutVectorType |
typedef shared_ptr<ScrollViewClass> kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ScrollViewSharedPtr |
typedef shared_ptr<ItemClass> kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemSharedPtr |
typedef shared_ptr<ItemContainerClass> kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemContainerSharedPtr |
typedef shared_ptr<DefaultListBoxItemGenerator<ItemGeneratorClass> > kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::DefaultItemGeneratorSharedPtr |
typedef shared_ptr<ItemGeneratorClass> kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemGeneratorSharedPtr |
typedef shared_ptr<ItemContainerGeneratorClass> kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemContainerGeneratorSharedPtr |
typedef shared_ptr<PresenterClass> kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::PresenterSharedPtr |
|
explicitprotected |
|
protected |
|
virtual |
Implements kanzi::ContentItemCollectionModel.
|
virtual |
Implements kanzi::ContentItemCollectionModel.
|
virtual |
Implements kanzi::ContentItemCollectionModel.
|
virtual |
Implements kanzi::ContentItemCollectionModel.
|
virtual |
Implements kanzi::ContentItemCollectionModel.
|
inline |
size_t kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemCount | ( | ) |
Returns the total item count of the list box. Includes all virtual items.
optional< pair< size_t, size_t > > kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getAliveRange | ( | ) |
Returns the range of items being alive in the buffer (based on the KeepItemsAlive property).
Returned pair contains the index of the first and the item count. If the virtual range does not exist, returns empty.
bool kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::isEmpty | ( | ) |
Returns true if the list box has no items.
ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::LayoutVectorType kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemSize | ( | size_t | index | ) |
Returns size of the item at the given index or unbounded layout value if size could not be determined without acquiring the item first.
optional< size_t > kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemIndex | ( | ItemSharedPtr | item | ) |
Returns index of the given item. If the item does not exist currently, returns empty.
ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ItemSharedPtr kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItem | ( | size_t | index | ) |
Gets the item at the given index in a list box.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::insertItem | ( | size_t | index, |
ItemSharedPtr | item | ||
) |
Inserts an item at the given index in a list box when using the default object generator.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::removeItem | ( | size_t | index | ) |
Removes the item at the given index from a list box when using the default object generator.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::replaceItem | ( | size_t | index, |
ItemSharedPtr | item | ||
) |
Replaces the item at the given index from a list box when using the default object generator.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::addItem | ( | ItemSharedPtr | item | ) |
Adds an item at the end of a list box when using the default object generator.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::removeLastItem | ( | ) |
Removes the last item from a list box when using the default object generator.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::removeAllItems | ( | ) |
Removes all items from a list box when using the default object generator.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::selectItem | ( | optional< size_t > | itemIndex | ) |
Requests the list box to select the item in the given index.
itemIndex | The index of the selected item. Set to empty to clear the selection. |
|
virtual |
Virtual functions for notifying item changes to list.
Implements kanzi::ListBoxConcept.
|
virtual |
Implements kanzi::ListBoxConcept.
|
virtual |
Implements kanzi::ListBoxConcept.
|
virtual |
Implements kanzi::ListBoxConcept.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::notifyItemContainerChanged | ( | ) |
|
static |
|
static |
|
virtual |
|
virtual |
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::updateVisibleRangeQuiet | ( | size_t | beginIndex, |
size_t | itemCount | ||
) |
Requests items from the item generator.
Called by the presenter when new items are displayed or old items hidden.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::updateVisibleRange | ( | size_t | beginIndex, |
size_t | itemCount | ||
) |
Requests items from the item generator.
Called by the presenter when new items are displayed or old items hidden. Sends messages about hidden and revealed items.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::updateVisibleRange | ( | size_t | beginIndex, |
size_t | itemCount, | ||
bool | sendMessages | ||
) |
ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::ScrollViewSharedPtr kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getScrollView | ( | ) | const |
Returns scroll view used for scrolling list box.
Use it to access properties of the scroll view or modify the scrolling behaviour.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::bringItemCenter | ( | size_t | itemIndex, |
bool | smooth | ||
) |
Requests the list box to focus on the item in the given index.
itemIndex | The index of the focused item. |
smooth | If set to true, the list box scroll to the target item smoothly. If set to false, the list box jumps to the target item immediately. |
int kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getKeepAliveItemCount | ( | ) | const |
Gets the value of #KeepAliveItemCount.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setKeepAliveItemCount | ( | int | value | ) |
Sets the value of #KeepAliveItemCount.
int kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getSelectedItemIndex | ( | ) | const |
Gets the value of #SelectedItemIndex.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setSelectedItemIndex | ( | int | value | ) |
Sets the value of #SelectedItemIndex.
ListBoxConcept::SelectionBehavior kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getSelectionBehavior | ( | ) | const |
Gets the value of SelectionBehavior.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setSelectionBehavior | ( | SelectionBehavior | value | ) |
Sets the value of SelectionBehavior.
string kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemGeneratorTypeName | ( | ) | const |
Gets the value of #ObjectGeneratorTypeName.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemGeneratorTypeName | ( | string_view | value | ) |
Sets the value of #ObjectGeneratorTypeName.
string kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemContainerGeneratorTypeName | ( | ) | const |
Gets the value of #ItemContainerGeneratorTypeName.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemContainerGeneratorTypeName | ( | string_view | value | ) |
Sets the value of #ItemContainerGeneratorTypeName.
PrefabTemplateSharedPtr kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemTemplate | ( | ) | const |
Gets the value of #ItemTemplate.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemTemplate | ( | PrefabTemplateSharedPtr | value | ) |
Sets the value of #ItemTemplate.
PrefabTemplateSharedPtr kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemContainerTemplate | ( | ) | const |
Gets the value of #ItemContainerTemplate.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemContainerTemplate | ( | PrefabTemplateSharedPtr | value | ) |
Sets the value of #ItemContainerTemplate.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemGenerator | ( | ItemGeneratorSharedPtr | itemGenerator | ) |
Sets the list box item generator.
itemGenerator | New item generator. |
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemContainerGenerator | ( | ItemContainerGeneratorSharedPtr | itemContainerGenerator | ) |
Sets the list box item container generator.
itemContainerGenerator | New item container generator. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Sends new scroll target to scroll view.
|
protected |
Sends new current scroll position to scroll view.
|
protected |
Sends new current scroll position to scroll view.
|
protectedvirtual |
Node::onAttached() implementation.
Reimplemented in kanzi::GridListBox3D, kanzi::GridListBox2D, and kanzi::TrajectoryListBox3D.
|
protectedvirtual |
Node::onDetached() implementation.
|
protectedvirtual |
Node::onNodePropertyChanged() implementation.
|
protected |
Applies selection behavior to specified item.
itemIndex | index of the item to which selection behavior should be applied. |
smooth | indicates if selection should be immediate or smooth. |
|
protected |
Assigns list box item generator to list box.
|
protected |
Creates and assigns item generator by ItemGeneratorTypeName property value.
|
protected |
Assigns list box item container generator to list box.
|
protected |
Creates and assigns item container generator by ItemGeneratorTypeName property value.
|
protected |
Replaces item and item container generators with new objects. Updates items and layout accordingly.
|
protected |
Updates SelectedItemIndex property after selected item index changes internally by list box.
|
inlinestaticprotected |