ListBoxConceptImpl provides the common base implementation for the List Box nodes, such as GridListBox2D, GridListBox3D, and TrajectoryListBox3D. More...
#include <kanzi/ui/node/concept/list_box.hpp>
Public Types | |
typedef shared_ptr< DefaultListBoxItemGenerator< ItemGeneratorClass > > | DefaultItemGeneratorSharedPtr |
typedef ListBoxTraits::TItemClass | ItemClass |
typedef ListBoxTraits::TItemContainerClass | ItemContainerClass |
typedef ListBoxTraits::TItemContainerGeneratorClass | ItemContainerGeneratorClass |
typedef shared_ptr< ItemContainerGeneratorClass > | ItemContainerGeneratorSharedPtr |
typedef shared_ptr< ItemContainerClass > | ItemContainerSharedPtr |
typedef ListBoxTraits::TItemGeneratorClass | ItemGeneratorClass |
typedef shared_ptr< ItemGeneratorClass > | ItemGeneratorSharedPtr |
typedef shared_ptr< ItemClass > | ItemSharedPtr |
typedef TBaseClass::LayoutVectorType | LayoutVectorType |
typedef ListBoxTraits::TPresenterClass | PresenterClass |
typedef shared_ptr< PresenterClass > | PresenterSharedPtr |
Public Types inherited from kanzi::ListBoxConcept | |
enum | SelectionBehavior { SelectionBehaviorNone, SelectionBehaviorBringToCenter } |
Behaviors for the List Box when an item in the List Box is selected. More... | |
Public Member Functions | |
bool | addContentItem (NodeSharedPtr abstractItem) override |
void | addItem (ItemSharedPtr item) |
Adds an item at the end of a List Box when using the default object generator. More... | |
void | arrangeOverride (LayoutVectorType actualSize) override |
void | bringItemCenter (size_t itemIndex, bool smooth) |
Requests the List Box to bring the item in the passed itemIndex to the center of the list box area. More... | |
void | enableKeyNavigation (bool enabled) |
Enables directional key navigation on the List Box. More... | |
optional< pair< size_t, size_t > > | getAliveRange () |
Returns the range of list items that are alive. More... | |
NodeSharedPtr | getContentItem (size_t index) override |
size_t | getContentItemCount () override |
ItemSharedPtr | getItem (size_t index) |
Gets the item at the given index in a List Box. More... | |
string | getItemContainerGeneratorTypeName () const |
Gets the value of ItemContainerGeneratorTypeNameProperty. More... | |
PrefabTemplateSharedPtr | getItemContainerTemplate () const |
Gets the value of ItemContainerTemplateProperty. More... | |
size_t | getItemCount () const |
Returns the value of the ItemCountProperty. More... | |
string | getItemGeneratorTypeName () const |
Gets the value of ItemGeneratorTypeNameProperty. More... | |
optional< size_t > | getItemIndex (ItemSharedPtr item) |
Returns the index of the given item. If the item does not exist, returns empty. More... | |
LayoutVectorType | getItemSize (size_t index) |
Returns the size of the item at the given index. More... | |
PrefabTemplateSharedPtr | getItemTemplate () const |
Gets the value of ItemTemplateProperty. More... | |
int | getKeepAliveItemCount () const |
Gets the value of KeepAliveItemCountProperty. More... | |
PresenterSharedPtr | getPresenter () const |
int | getSelectedItemIndex () const |
Gets the value of SelectedItemIndexProperty. More... | |
SelectionBehavior | getSelectionBehavior () const |
Gets the value of SelectionBehavior. 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... | |
bool | isEmpty () |
Indicates whether a List Box has no items. More... | |
LayoutVectorType | measureOverride (LayoutVectorType availableSize) override |
void | notifyItemAdded (size_t index) override |
Virtual functions for notifying item changes to list. More... | |
void | notifyItemContainerChanged () |
void | notifyItemCountChanged () override |
void | notifyItemRemoved (size_t index) override |
void | notifyItemReplaced (size_t index) override |
void | removeAllContentItems () override |
void | removeAllItems () |
Removes all items from a List Box when using the default object generator. More... | |
bool | removeContentItem (NodeSharedPtr abstractItem) override |
void | removeItem (size_t index) |
Removes the item at the given index from 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 | replaceItem (size_t index, ItemSharedPtr item) |
Replaces the item at the given index in a List Box when using the default object generator. More... | |
void | selectItem (optional< size_t > itemIndex) |
Requests the List Box to select the item at the given index. More... | |
void | setItemContainerGenerator (ItemContainerGeneratorSharedPtr itemContainerGenerator) |
Sets the list box item container generator. More... | |
void | setItemContainerGeneratorTypeName (string_view value) |
Sets the value of ItemContainerGeneratorTypeNameProperty. More... | |
void | setItemContainerTemplate (PrefabTemplateSharedPtr value) |
Sets the value of ItemContainerTemplateProperty. More... | |
void | setItemGenerator (ItemGeneratorSharedPtr itemGenerator) |
Sets the list box item generator. More... | |
void | setItemGeneratorTypeName (string_view value) |
Sets the value of ItemGeneratorTypeNameProperty. More... | |
void | setItemTemplate (PrefabTemplateSharedPtr value) |
Sets the value of ItemTemplateProperty. More... | |
void | setKeepAliveItemCount (int value) |
Sets the value of KeepAliveItemCountProperty. More... | |
void | setSelectedItemIndex (int value) |
Sets the value of SelectedItemIndexProperty. More... | |
void | setSelectionBehavior (SelectionBehavior value) |
Sets the value of SelectionBehavior. 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) |
void | updateVisibleRangeQuiet (size_t beginIndex, size_t itemCount) |
Requests items from the item 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 | |
void | applySelectionBehavior (size_t itemIndex, bool smooth) |
Applies selection behavior to the selected item. More... | |
void | assignItemContainerGenerator (ItemContainerGeneratorSharedPtr itemContainerGenerator) |
Assigns list box item container generator to list box. More... | |
void | assignItemGenerator (ItemGeneratorSharedPtr itemGenerator) |
Assigns list box item generator to list box. More... | |
void | initialize (PresenterSharedPtr presenter) |
ListBoxConceptImpl (Domain *domain, string_view name) | |
void | onAttached () override |
Node::onAttached() implementation. More... | |
void | onClicked (ClickManipulator::ClickMessageArguments &messageArguments) |
Handles ClickManipulator::ClickMessage. More... | |
void | onDetached () override |
Node::onDetached() implementation. More... | |
void | onNodePropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason) override |
Node::onNodePropertyChanged() implementation. More... | |
void | setItemContainerGeneratorByProperty () |
Creates and assigns item container generator by ItemGeneratorTypeName property value. More... | |
void | setItemGeneratorByProperty () |
Creates and assigns item generator by ItemGeneratorTypeName property value. More... | |
void | synchronizeItemCountProperty () |
Updates the ItemCountProperty. More... | |
void | synchronizeSelectedItemIndexProperty () |
Updates the SelectedItemIndexProperty after the List Box internally changes the selected item index. More... | |
void | updateGenerators (ItemGeneratorSharedPtr itemGenerator, ItemContainerGeneratorSharedPtr itemContainerGenerator) |
Replaces item and item container generators with new objects. Updates items and layout accordingly. More... | |
~ListBoxConceptImpl () override | |
Static Protected Member Functions | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
Additional Inherited Members | |
Static Public Attributes inherited from kanzi::ListBoxConcept | |
static MessageType< ItemHiddenMessageArguments > | ItemHiddenMessage |
List Box node dispatches this message whenever the List Box hides one of its items. More... | |
static MessageType< ItemSelectedMessageArguments > | ItemSelectedMessage |
List Box node dispatches this message whenever an item in the List Box is selected. More... | |
static MessageType< ItemVisibleMessageArguments > | ItemVisibleMessage |
List Box node dispatches this message whenever the List Box brings one of its items visible. More... | |
static PropertyType< int > | ItemCountProperty |
Reports the number of items in a List Box, including virtual items. More... | |
static PropertyType< int > | KeepAliveItemCountProperty |
Sets the size of the buffer for invisible List Box items. More... | |
static PropertyType< ListBoxConcept::SelectionBehavior > | SelectionBehaviorProperty |
Sets how a List Box node behaves when the user selects an item. More... | |
static PropertyType< string > | ItemGeneratorTypeNameProperty |
Sets the name of the item generator type to use to provide items dynamically for a List Box node. More... | |
static PropertyType< string > | ItemContainerGeneratorTypeNameProperty |
Sets the name of the item container generator type to use to provide item containers dynamically for a List Box node. More... | |
static PropertyType< ResourceSharedPtr > | ItemTemplateProperty |
Sets the prefab template to use for the List Box items. More... | |
static PropertyType< ResourceSharedPtr > | ItemContainerTemplateProperty |
Sets the ListBoxItemContainer prefab that sets the appearance and behavior of the List Box items. More... | |
static PropertyType< int > | SelectedItemIndexProperty |
Sets and reports the index of the item that is currently selected in a List Box node. More... | |
ListBoxConceptImpl provides the common base implementation for the List Box nodes, such as GridListBox2D, GridListBox3D, and TrajectoryListBox3D.
Use the List Box nodes to create lists of selectable items. For example, use the List Box nodes to create contact lists, playlists in a media player, or car settings lists.
A List Box node provides an invisible hit testable area that listens to input and reacts when the user pans the area to browse the list. When the user browses the list, the List Box moves the items so that new items become visible and old items disappear. How this happens depends on the specific List Box.
To disable a List Box node, set the Node::EnabledProperty to false. A disabled List Box does not respond to input. To visually indicate the disabled state of a List Box node, create a state manager and use the Node::EffectivelyEnabledProperty as its controller property. When Kanzi disables a List Box node, it cancels the ongoing gestures and preserves the position of that List Box node.
A List Box node gets its items from an item generator. By default the List Box uses the DefaultListBoxItemGenerator which simply stores the items that are added to it. To create dynamic content for a List Box, replace the item generator with a custom implementation.
A List Box node wraps its items in container nodes that are created by an item container generator. The default item generator creates invisible nodes that do nothing.
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<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 |
|
overrideprotected |
|
overridevirtual |
Implements kanzi::ContentItemCollectionModel.
|
overridevirtual |
Implements kanzi::ContentItemCollectionModel.
|
overridevirtual |
Implements kanzi::ContentItemCollectionModel.
|
overridevirtual |
Implements kanzi::ContentItemCollectionModel.
|
overridevirtual |
Implements kanzi::ContentItemCollectionModel.
|
inline |
optional< pair< size_t, size_t > > kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getAliveRange | ( | ) |
Returns the range of list items that are alive.
By using virtualization a List Box node keeps alive and in memory only the items that are visible and the number of items that you set with the KeepAliveItemCountProperty. The returned pair contains the index of the first item and the number of items. If there are no alive items in the List Box, returns (0, 0). If there are no items in the List Box, returns nullopt.
bool kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::isEmpty | ( | ) |
Indicates whether a List Box has no items.
ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::LayoutVectorType kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemSize | ( | size_t | index | ) |
Returns the size of the item at the given index.
If it is not possible to determine the size without first acquiring the item, returns an unbound layout value.
optional< size_t > kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemIndex | ( | ItemSharedPtr | item | ) |
Returns the index of the given item. If the item does not exist, 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 in 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 at the given index.
itemIndex | The index of the selected item. To clear the selection, set to empty. |
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::enableKeyNavigation | ( | bool | enabled | ) |
Enables directional key navigation on the List Box.
enabled | To enable key navigation, pass true. To disable key navigation, pass false. |
|
overridevirtual |
Virtual functions for notifying item changes to list.
Implements kanzi::ListBoxConcept.
|
overridevirtual |
Implements kanzi::ListBoxConcept.
|
overridevirtual |
Implements kanzi::ListBoxConcept.
|
overridevirtual |
Implements kanzi::ListBoxConcept.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::notifyItemContainerChanged | ( | ) |
|
static |
|
static |
|
override |
|
override |
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 | ||
) |
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::bringItemCenter | ( | size_t | itemIndex, |
bool | smooth | ||
) |
Requests the List Box to bring the item in the passed itemIndex to the center of the list box area.
itemIndex | The index of the focused item. |
smooth | To animate the movement of the target item to the center of the list box area, set to true. To move the target item to the center of the list box area immediately, set to false. |
size_t kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemCount | ( | ) | const |
Returns the value of the ItemCountProperty.
int kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getKeepAliveItemCount | ( | ) | const |
Gets the value of KeepAliveItemCountProperty.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setKeepAliveItemCount | ( | int | value | ) |
Sets the value of KeepAliveItemCountProperty.
int kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getSelectedItemIndex | ( | ) | const |
Gets the value of SelectedItemIndexProperty.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setSelectedItemIndex | ( | int | value | ) |
Sets the value of SelectedItemIndexProperty.
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 ItemGeneratorTypeNameProperty.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemGeneratorTypeName | ( | string_view | value | ) |
Sets the value of ItemGeneratorTypeNameProperty.
string kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemContainerGeneratorTypeName | ( | ) | const |
Gets the value of ItemContainerGeneratorTypeNameProperty.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemContainerGeneratorTypeName | ( | string_view | value | ) |
Sets the value of ItemContainerGeneratorTypeNameProperty.
PrefabTemplateSharedPtr kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemTemplate | ( | ) | const |
Gets the value of ItemTemplateProperty.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemTemplate | ( | PrefabTemplateSharedPtr | value | ) |
Sets the value of ItemTemplateProperty.
PrefabTemplateSharedPtr kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::getItemContainerTemplate | ( | ) | const |
Gets the value of ItemContainerTemplateProperty.
void kanzi::ListBoxConceptImpl< TBaseClass, TDerivedClass, ListBoxTraits >::setItemContainerTemplate | ( | PrefabTemplateSharedPtr | value | ) |
Sets the value of ItemContainerTemplateProperty.
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 |
Handles ClickManipulator::ClickMessage.
|
overrideprotected |
Node::onAttached() implementation.
|
overrideprotected |
Node::onDetached() implementation.
|
overrideprotected |
Node::onNodePropertyChanged() implementation.
|
protected |
Applies selection behavior to the selected item.
itemIndex | The index of the item to which you want to apply selection behavior. |
smooth | For a List Box whose SelectionBehaviorProperty is set to ListBoxConcept::SelectionBehaviorBringToCenter, this parameter determines whether to animate the movement of the selected item to the center of the List Box area. To bring the item to the center immediately, pass false. |
|
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 the SelectedItemIndexProperty after the List Box internally changes the selected item index.
|
protected |
Updates the ItemCountProperty.
|
inlinestaticprotected |