Kanzi  3.9.9
Kanzi Engine C++ 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...
 
bool containsOnlyEffectivelyVisibleNodes () const
 Returns whether the focus chain contains only effectively visible nodes, or also nodes that have the Node::VisibleProperty set to true but are effectively invisible. 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, bool onlyEffectivelyVisible)
 Constructor. More...
 
 FocusChain (FocusScope &scope)
 Constructor. More...
 

Protected Attributes

Container m_container
 The focus chain container. More...
 
const bool m_containsEffectivelyVisible
 Whether the focus chain contains only the effectively visible focusable nodes. 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

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

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

The const-qualified iterator of the focus chain.

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

The const-qualified reverse iterator of the focus chain.

The tuple that contains:

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

The container with the nested focus chain snapshots.

Constructor & Destructor Documentation

kanzi::FocusScope::FocusChain::FocusChain ( FocusScope scope,
bool  onlyEffectivelyVisible 
)
explicitprotected

Constructor.

Creates a focus chain snapshot which contains either only the effectively visible nodes, or all nodes that have the Node::VisibleProperty set to true.

Since
Kanzi 3.9.1
kanzi::FocusScope::FocusChain::FocusChain ( FocusScope scope)
inlineexplicitprotected

Constructor.

Member Function Documentation

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.
bool kanzi::FocusScope::FocusChain::isEmpty ( ) const

Returns whether the focus chain is empty.

Returns
If the focus chain is empty, true, otherwise false.
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.
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.
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.
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.
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.
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.
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.
bool kanzi::FocusScope::FocusChain::containsOnlyEffectivelyVisibleNodes ( ) const
inline

Returns whether the focus chain contains only effectively visible nodes, or also nodes that have the Node::VisibleProperty set to true but are effectively invisible.

Returns
If the focus chain contains only effectively visible nodes, true. If the focus chain contains also the visible but effectively invisible nodes, false.
Since
Kanzi 3.9.1

Friends And Related Function Documentation

friend class FocusScope
friend

Member Data Documentation

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

The focus chain container.

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

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

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

The focus scope which has this focus chain.

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

Holds the validity of the focus chain.

const bool kanzi::FocusScope::FocusChain::m_containsEffectivelyVisible
protected

Whether the focus chain contains only the effectively visible focusable nodes.

Since
Kanzi 3.9.1

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