ListBoxTrajectoryPresenter implements the List Box presenter that use Scroll View and the trajectory layout in their presentation. More...
#include <kanzi/ui/node/concept/list_box/list_box_trajectory_presenter.hpp>
Classes | |
| struct | TrajectoryLayoutSnapInfo |
| class | VirtualListBoxItem |
| Represents a virtual item within a ListBox. More... | |
Public Types | |
| using | BaseClass |
| using | ItemSharedPtr |
| using | LayoutSharedPtr |
| using | ListBoxTrajectoryPresenterType |
| using | ScrollViewSharedPtr |
Public Member Functions | |
| void | addToLayout (ItemSharedPtr listBoxItem) |
| void | bringItemCenter (size_t selection, bool smooth) |
| Brings given item to the selector position. | |
| void | enableKeyNavigation (bool enabled) |
| Enables directional key navigation on the Trajectory Presenter. | |
| size_t | getItemCount () const |
| Gets number of items in presenters list box. | |
| LayoutSharedPtr | getLayout () const |
| void | initialize (TFinalClass *listBox, LayoutSharedPtr layout) |
| Initializes the trajectory presenter for the list box. | |
| bool | isEffectivelyLooping () const |
| Returns whether presentation is in looping mode. | |
| ListBoxTrajectoryPresenter () | |
| void | notifyItemAdded (size_t index) |
| Implements notifyItemAdded for a trajectory list box. | |
| void | notifyItemContainerChanged () |
| Invalidates layout if the item container is changed. | |
| void | notifyItemRemoved (size_t index) |
| Implements notifyItemRemoved for a trajectory list box. | |
| void | notifyItemReplaced (size_t) |
| Invalidates layout if the item is replaced. | |
| void | removeFromLayout (ItemSharedPtr listBoxItem) |
| void | setScroll (Vector2 scroll) |
| ListBoxScrollPresenterConceptImpl::setScroll implementation. | |
| void | snap (Vector2 position, Vector2 direction, bool changeTarget, Vector2 *out_position, int *out_itemIndex) |
| Snaps from a given position towards a given direction. | |
| void | startNavigation (NavigationDirection direction) |
| Defines the behavior on navigational key press. | |
| void | tryMoveFocusInDirection (ListBoxConcept::FocusMoveTarget target, bool fallback=false) |
| Tries to move the focus to the next or previous item in a Trajectory List Box node. | |
| void | tryMoveFocusToEdge (ListBoxConcept::FocusMoveTarget target, bool fallback=false) |
| Tries to move the focus to the first or last item in a Trajectory List Box node. | |
| void | tryMoveFocusToPage (ListBoxConcept::FocusMoveTarget target, bool fallback=false) |
| void | update () |
| Updates presenter's state and visible items. | |
Public Member Functions inherited from kanzi::ListBoxScrollPresenterConceptImpl< TDerivedClass, TFinalClass, TScrollView > | |
| ScrollViewSharedPtr | getScrollView () const |
| Returns the Scroll View that the presenter uses. | |
| void | initialize (TFinalClass *listBox) |
| ListBoxScrollPresenterConceptImpl specific initialization. | |
| ListBoxScrollPresenterConceptImpl ()=default | |
| Constructor. | |
Protected Member Functions | |
| bool | calculateAliveItemsRange () |
| Sets indices and offsets of first and last alive items and the number of alive elements. | |
| void | extendAliveItemsRangeToItem (size_t index) |
| Extends the alive items range of the presenter to include the item at a given index. | |
| VirtualListBoxItem | findMiddleIterator () |
| ItemSharedPtr | getItem (size_t presenterIndex) const |
| Returns the item at the given index. | |
| Vector3 | getItemSize (size_t itemIndex) |
| Returns the size of an item at a given index. | |
| float | getItemSpacing () const |
| Returns list box item spacing. | |
| bool | isHorizontalScroll () const |
| Returns whether the Trajectory List Box is scrolling horizontally. | |
| void | iterateToIndex (VirtualListBoxItem &iterator, size_t index) |
| Iterates the virtual list box item to the given index. | |
| void | snapImprove (TrajectoryLayoutSnapInfo *snap, unsigned int objectIndex, float offset, float selectorOffset, bool snapLeft, bool snapRight) |
| Updates the snap info structure to point to the given object index if this object is closer to the selector offset and the snap in the corresponding direction is enabled. | |
| void | updateAliveItemsRange () |
Asks the List Box to update the items in the layout according to the currently set firstIndex and rangeSize, also taking into account the keep alive items. | |
Protected Member Functions inherited from kanzi::ListBoxScrollPresenterConceptImpl< TDerivedClass, TFinalClass, TScrollView > | |
| TDerivedClass * | getThisObject () |
| const TDerivedClass * | getThisObject () const |
| void | onClickBegin (ClickManipulator::ClickBeginMessageArguments &messageArguments) |
| Handles ClickManipulator::onClickBeginMessage. | |
| void | onItemSelected (ListBoxConcept::ItemSelectedMessageArguments &messageArguments) |
| Handles ListBoxConcept::ItemSelectedMessage. | |
| void | onScrolled (ScrollViewConcept::ScrolledMessageArguments &messageArguments) |
| Handles ScrollViewClass::ScrolledMessage. | |
| void | onScrollFinished (ScrollViewConcept::ScrollFinishedMessageArguments &messageArguments) |
| Handles ScrollViewClass::ScrollFinishedMessage. | |
| void | onScrollStarted (ScrollViewConcept::ScrollStartedMessageArguments &messageArguments) |
| Handles ScrollViewClass::ScrollStartedMessage. | |
| void | onSnapRequested (ScrollViewConcept::SnapRequestMessageArguments &messageArguments) |
| Handles ScrollViewClass::SnapRequestMessage. | |
| void | onUserScrollFinished (ScrollViewConcept::UserScrollFinishedMessageArguments &messageArguments) |
| Handles ScrollViewClass::UserScrollFinishedMessage. | |
| void | onUserScrollStarted (ScrollViewConcept::UserScrollStartedMessageArguments &messageArguments) |
| Handles ScrollViewClass::UserScrollStartedMessage. | |
| void | scrollToTargetItem (size_t itemIndex, Vector2 scrollPosition, bool smooth) const |
| Requests Scroll View to scroll to target item position. | |
| void | sendListBoxTargetChangedMessage (size_t targetItem) const |
| Sends ListBoxScrollPresenterConcept::TargetChangedMessage message to List Box. | |
| void | sendScrollViewSetScrollMessage (const Vector2 &scrollPosition) const |
| Sends ScrollViewConcept::SetScrollMessage message to Scroll View. | |
| void | sendScrollViewSetScrollTargetMessage (const Vector2 &scrollTarget) const |
| Sends ScrollViewConcept::SetScrollTargetMessage message to Scroll View. | |
Protected Attributes | |
| int | m_fixedPointIndex |
| Index of an item that is currently acting as a fixed point in the list. | |
| float | m_fixedPointOffset |
| The offset of the fixed point. | |
| size_t | m_lastItemCount |
| Item count from the previous update(), used to detect bulk item count decreases. | |
| size_t | m_rangeSize |
| Number of items in the visible area. | |
| float | m_scrollOffset |
| Offset of scrolling. In proportional space. | |
| VirtualListBoxItem | m_viewIntervalLeft |
| Virtual leftmost item in the visible area. | |
| VirtualListBoxItem | m_viewIntervalRight |
| Virtual rightmost item in the visible area. | |
Protected Attributes inherited from kanzi::ListBoxScrollPresenterConceptImpl< TDerivedClass, TFinalClass, TScrollView > | |
| TFinalClass * | m_listBox |
| List Box that owns this presenter. | |
ListBoxTrajectoryPresenter implements the List Box presenter that use Scroll View and the trajectory layout in their presentation.
You can change the scrolling behavior by subclassing and implementing the following functions:
You can change the navigational key press behavior by subclassing and implementing the following function:
To create a custom Trajectory Presenter:
| using kanzi::ListBoxTrajectoryPresenter< TDerivedClass, TFinalClass, TLayout, TItemClass, TScrollView >::ListBoxTrajectoryPresenterType |
| using kanzi::ListBoxTrajectoryPresenter< TDerivedClass, TFinalClass, TLayout, TItemClass, TScrollView >::BaseClass |
| using kanzi::ListBoxTrajectoryPresenter< TDerivedClass, TFinalClass, TLayout, TItemClass, TScrollView >::LayoutSharedPtr |
| using kanzi::ListBoxTrajectoryPresenter< TDerivedClass, TFinalClass, TLayout, TItemClass, TScrollView >::ItemSharedPtr |
| using kanzi::ListBoxTrajectoryPresenter< TDerivedClass, TFinalClass, TLayout, TItemClass, TScrollView >::ScrollViewSharedPtr |
|
inlineexplicit |
|
inline |
|
inline |
Gets number of items in presenters list box.
|
inline |
Returns whether presentation is in looping mode.
|
inline |
Implements notifyItemAdded for a trajectory list box.
Called by the ListBoxConceptImpl after the item has been added.
| index | Index of the item that was added. |
|
inline |
Implements notifyItemRemoved for a trajectory list box.
Called by the ListBoxConceptImpl after the item is removed.
| index | Index of the item that will be removed. |
|
inline |
Invalidates layout if the item is replaced.
|
inline |
Invalidates layout if the item container is changed.
|
inline |
Initializes the trajectory presenter for the list box.
| listBox | List box which items to present. |
| layout | The trajectory layout used in the List Box. |
|
inline |
Defines the behavior on navigational key press.
Default implementation moves focus in the specified direction.
| direction | Navigation direction. |
|
inline |
Enables directional key navigation on the Trajectory Presenter.
| enabled | To enable key navigation, pass true. To disable key navigation, pass false. |
|
inline |
Tries to move the focus to the next or previous item in a Trajectory List Box node.
| target | Where to move the focus:
|
| fallback | Whether to set the focus to the List Box node when there is no focusable list item in the target. |
|
inline |
|
inline |
Tries to move the focus to the first or last item in a Trajectory List Box node.
| target | Where to move the focus:
|
| fallback | Whether to set the focus to the List Box node when there is no focusable list item in the target. |
|
inline |
Updates presenter's state and visible items.
|
inline |
ListBoxScrollPresenterConceptImpl::setScroll implementation.
|
inline |
|
inline |
|
inline |
Brings given item to the selector position.
|
inline |
Snaps from a given position towards a given direction.
Returns the snapping target and the index of the item to which the scrolling snapped, unless they are given as nullptr. If the list box target changes to the snapped item, changeTarget is true. If the snapping did not target any item, the index is -1.
|
inlineprotected |
|
inlineprotected |
Sets indices and offsets of first and last alive items and the number of alive elements.
Sets the values of viewInternal member.
|
inlineprotected |
Returns the item at the given index.
| presenterIndex | Index of the item in the layout. |
|
inlineprotected |
Extends the alive items range of the presenter to include the item at a given index.
If the item is already in the alive items range, the range does not change.
| index | Index of the item to include in the alive items range. |
|
inlineprotected |
Returns the size of an item at a given index.
If the item is outside the alive items range of the presenter and the List Box cannot determine the size of the item, this operation extends the alive items range.
| itemIndex | The index of the item whose size you want to get. |
|
inlineprotected |
Asks the List Box to update the items in the layout according to the currently set firstIndex and rangeSize, also taking into account the keep alive items.
|
inlineprotected |
Updates the snap info structure to point to the given object index if this object is closer to the selector offset and the snap in the corresponding direction is enabled.
| snap | Snap structure to update. |
| objectIndex | The index of the object to test. |
| offset | The offset of the object to test. |
| selectorOffset | The selector offset. |
| snapLeft | Whether snap to the left is allowed. |
| snapRight | Whether snap to the right is allowed. |
|
inlineprotected |
Returns list box item spacing.
|
inlineprotected |
Iterates the virtual list box item to the given index.
|
inlineprotected |
Returns whether the Trajectory List Box is scrolling horizontally.
|
protected |
Offset of scrolling. In proportional space.
|
protected |
Number of items in the visible area.
|
protected |
Index of an item that is currently acting as a fixed point in the list.
|
protected |
The offset of the fixed point.
This maps all items to the their places in the list: even when object sizes change between updates, the location of the item in fixedPointIndex stays constant.
|
protected |
Item count from the previous update(), used to detect bulk item count decreases.
|
protected |
Virtual leftmost item in the visible area.
|
protected |
Virtual rightmost item in the visible area.