Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::FocusScope::FocusChain Class Reference

The FocusChain contains the snapshot of the focus chain of a focus scope. More...

#include <kanzi/core.ui/input/focus_scope.hpp>

Inheritance diagram for kanzi::FocusScope::FocusChain:
[legend]

Public Types

using Container = flat_set< FocusChainNode, Comparator >
 The set that contains the focusable nodes of a focus scope. More...
 
using FocusedTuple = tuple< FocusChainSharedPtr, FocusChain::Iterator >
 The tuple that contains: More...
 
using Iterator = Container::const_iterator
 The const-qualified iterator of the focus chain. More...
 
using ReverseIterator = Container::const_reverse_iterator
 The const-qualified reverse iterator of the focus chain. More...
 

Public Member Functions

Iterator begin () const
 Returns the starting const-qualified iterator of the focus chain. More...
 
Iterator end () const
 Returns the ending const-qualified iterator of the focus chain. More...
 
Iterator getLastFocusedNodeIterator () const
 Returns the iterator to the last-focused node of the focus chain. More...
 
FocusedTuple getNestedEffectiveFocus ()
 Returns a tuple with the focus chain and the iterator in that focus chain to the nested effective focused node of a focus scope. More...
 
FocusedTuple getNestedFocus ()
 Returns a tuple with the focus chain and the iterator in that focus chain to the nested focused node of a focus scope. More...
 
bool isEmpty () const
 Returns whether the focus chain is empty. More...
 
bool isValid () const
 Returns whether the focus chain is valid. More...
 
ReverseIterator rbegin () const
 Returns the starting const-qualified reverse iterator of the focus chain. More...
 
ReverseIterator rend () const
 Returns the ending const-qualified reverse iterator of the focus chain. More...
 

Protected Types

using NestedFocusChainContainer = vector< shared_ptr< FocusChain > >
 The container with the nested focus chain snapshots. More...
 

Protected Member Functions

 FocusChain (FocusScope &scope)
 Constructor. More...
 

Protected Attributes

Container m_container
 The focus chain container. More...
 
FocusScopem_focusScope
 The focus scope which has this focus chain. More...
 
bool m_isValid
 Holds the validity of the focus chain. More...
 
NestedFocusChainContainer m_nestedChains
 The container with the nested focus chains visited while this focus chain is available. More...
 

Friends

class FocusScope
 

Detailed Description

The FocusChain contains the snapshot of the focus chain of a focus scope.

It contains the focusable nodes of a focus scope ordered by the focus order and focus order offset. You can use the focus chain snapshot to iterate through the focus chain.

To find the last-focused node in a focus scope using the iterated traversal method:

auto scope = node->getFocusScopeInfo();
auto focusChain = scope->getFocusChainSnapshot();
auto lastIndex = scope->getLastFocused();
auto it = find(focusChain->begin(), focusChain->end(), lastIndex);
if (it != focusChain->end())
{
// The focused node.
}

To visit a focus scope using UI scene traversal, see FocusScopeVisitor.

Since
Kanzi 3.9.0

Member Typedef Documentation

◆ Container

The set that contains the focusable nodes of a focus scope.

◆ Iterator

using kanzi::FocusScope::FocusChain::Iterator = Container::const_iterator

The const-qualified iterator of the focus chain.

◆ ReverseIterator

using kanzi::FocusScope::FocusChain::ReverseIterator = Container::const_reverse_iterator

The const-qualified reverse iterator of the focus chain.

◆ FocusedTuple

The tuple that contains:

  • The focus chain
  • The iterator that points to the focused node in the focus chain

◆ NestedFocusChainContainer

The container with the nested focus chain snapshots.

Constructor & Destructor Documentation

◆ FocusChain()

kanzi::FocusScope::FocusChain::FocusChain ( FocusScope scope)
explicitprotected

Constructor.

Member Function Documentation

◆ isValid()

bool kanzi::FocusScope::FocusChain::isValid ( ) const
inline

Returns whether the focus chain is valid.

The focus chain gets invalid when any of these happen:

Returns
Whether the focus chain is valid.

◆ isEmpty()

bool kanzi::FocusScope::FocusChain::isEmpty ( ) const

Returns whether the focus chain is empty.

Returns
If the focus chain is empty, true, otherwise false.

◆ begin()

Iterator kanzi::FocusScope::FocusChain::begin ( ) const

Returns the starting const-qualified iterator of the focus chain.

Returns
The iterator that points to the head of the focus chain.

◆ rbegin()

ReverseIterator kanzi::FocusScope::FocusChain::rbegin ( ) const

Returns the starting const-qualified reverse iterator of the focus chain.

Returns
The iterator that points to the tail of the focus chain.

◆ end()

Iterator kanzi::FocusScope::FocusChain::end ( ) const

Returns the ending const-qualified iterator of the focus chain.

Returns
The const-qualified iterator that points after the tail of the focus chain.

◆ rend()

ReverseIterator kanzi::FocusScope::FocusChain::rend ( ) const

Returns the ending const-qualified reverse iterator of the focus chain.

Returns
The iterator that points before the head of the focus chain.

◆ getLastFocusedNodeIterator()

Iterator kanzi::FocusScope::FocusChain::getLastFocusedNodeIterator ( ) const

Returns the iterator to the last-focused node of the focus chain.

Returns
The iterator to the last-focused node of the focus chain. If the focus scope has no last-focused node, returns the end iterator.

◆ getNestedFocus()

FocusedTuple kanzi::FocusScope::FocusChain::getNestedFocus ( )

Returns a tuple with the focus chain and the iterator in that focus chain to the nested focused node of a focus scope.

Returns
A tuple with the focus chain of the focus scope, and the iterator within that focus chain to the nested focused node. If the focus scope has no focused node, returns a tuple with a null focus chain pointer and invalid iterator.

◆ getNestedEffectiveFocus()

FocusedTuple kanzi::FocusScope::FocusChain::getNestedEffectiveFocus ( )

Returns a tuple with the focus chain and the iterator in that focus chain to the nested effective focused node of a focus scope.

Returns
A tuple with the focus chain of the focus scope, and the iterator within that focus chain to the nested effective focused node. If the focus scope has no focused node, returns a tuple with a null focus chain pointer and invalid iterator.

Friends And Related Function Documentation

◆ FocusScope

friend class FocusScope
friend

Member Data Documentation

◆ m_container

Container kanzi::FocusScope::FocusChain::m_container
protected

The focus chain container.

◆ m_nestedChains

NestedFocusChainContainer kanzi::FocusScope::FocusChain::m_nestedChains
protected

The container with the nested focus chains visited while this focus chain is available.

◆ m_focusScope

FocusScope* kanzi::FocusScope::FocusChain::m_focusScope
protected

The focus scope which has this focus chain.

◆ m_isValid

bool kanzi::FocusScope::FocusChain::m_isValid
protected

Holds the validity of the focus chain.


The documentation for this class was generated from the following file: