Kanzi framework  3.9.1
Kanzi Engine API
kanzi::ModalScope Class Reference

Implements the modal scopes. More...

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

Inheritance diagram for kanzi::ModalScope:
[legend]

Public Member Functions

void addToStack ()
 Adds the focus scope to the modal scope stack. More...
 
bool bringScopeToFront ()
 Brings a modal focus scope to the front of focus scopes. More...
 
FocusChainNode getEffectiveFocus () const
 Returns the effective focus node of a modal scope. More...
 
Node2DSharedPtr getHitTestRoot ()
 Returns the node from where the hit test iteration is started. More...
 
Node2DSharedPtr getKeyInputRoot ()
 Returns the node to which the key input is propagated. More...
 
FocusScopegetParent () const override
 Overrides FocusScope::getParent() by always returning nullptr, because modal scopes have no parent scopes. More...
 
FocusManager::FocusScopeType getType () const override
 Returns the type of the focus scope. More...
 
bool isForemostScope () const
 Checks whether the focus scope is the foremost scope of the modal scope stack. More...
 
bool isNodeInScope (const Node &node) const override
 Checks whether a node is in this modal scope. More...
 
 ModalScope (Node &root, FocusManager::ScopeStack &scopeStack)
 Constructor. More...
 
void removeFromStack (FocusManager::FocusReason reason)
 Removes the focus scope from the modal scope stack. More...
 
bool sendScopeToBack (FocusManager::FocusReason reason)
 Sends a focus scope to the end of the focus scope stack with a given reason value. More...
 
FocusChainNode tryMoveFocusAcrossNestedScopes (FocusManager::FocusChainDirection direction)
 Tries to set the focus to a node relative to the focused node of the popup-type focus scope passed as an argument, using the focus chain navigation. More...
 
FocusChainNode trySetFocus (Node &node)
 Tries to set the focus to a node of the focus scope. More...
 
 ~ModalScope () override
 Destructor. More...
 
- Public Member Functions inherited from kanzi::FocusFence
 FocusFence (Node &root)
 Constructor. More...
 
- Public Member Functions inherited from kanzi::FocusScope
bool canFocusEnter () const
 Returns whether the focus can enter the focus scope. More...
 
bool canFocusLeave () const
 Returns whether the focus can leave the focus scope. More...
 
bool canGetLastFocused () const
 Returns whether the focus scope node can be the last-focused node of its owning focus scope. More...
 
FocusChainNode getFocus () const
 Returns the focus node of a focus scope. More...
 
FocusChainSharedPtr getFocusChainSnapshot ()
 Returns a snapshot of the focus chain of a focus scope. More...
 
FocusChainSharedPtr getFocusChainSnapshot (bool onlyEffectivelyVisible)
 Returns a snapshot of the focus chain of a focus scope. More...
 
FocusNavigationManipulatorSharedPtr getFocusNavigationManipulator () const
 Returns the focus navigation manipulator of a focus scope. More...
 
ModalScopegetModalScope () const
 Returns the modal scope that owns the focus scope. More...
 
NodegetRoot () const
 Returns the focus scope node. More...
 
bool isAttached () const
 Returns whether a focus scope node is attached. More...
 
bool isFocusChainEmpty () const
 Returns whether the focus chain of a focus scope is empty. More...
 
bool isFocusChainEmpty (bool onlyEffectivelyVisible) const
 Returns whether the focus chain of a focus scope is empty. More...
 
void setFocusNavigationManipulator (FocusNavigationManipulatorSharedPtr newManipulator)
 Sets the focus navigation manipulator of the focus scope. More...
 
FocusChainNode tryMoveFocusInScope (FocusManager::FocusChainDirection direction)
 Tries to set the focus to a node relative to the current focus node of the focus scope using the focus chain navigation. More...
 
FocusChainNode tryRestoreScopeFocusedNode (FocusChainNode currentFocus, FocusManager::FocusReason reason, FocusManager::FocusChainDirection direction)
 Tries to restore the focus to the last-focused node of a focus scope. More...
 
Node::VisitorResult visitFocusChain (FocusScopeVisitor &visitor)
 Visits the focus chain of the focus scope, and calls the visitor on each node. More...
 
Node::VisitorResult visitFocusScope (FocusScopeVisitor &visitor)
 Visits the focusable nodes of the focus scope, including nested focus scope nodes. More...
 
virtual ~FocusScope ()
 Destructor. More...
 
FocusChainIndex getLastFocused () const
 Returns the focus chain index of the last-focused node of a focus scope. More...
 
void setLastFocused (const FocusChainIndex &lastFocus)
 Sets the focus chain index of the last-focused node of the focus scope. More...
 
void clearLastFocused ()
 Clears the focus chain index of the last-focused node of a focus scope. More...
 
FocusChainNode getLastFocusedNode () const
 Returns the last-focused node of a focus scope. More...
 
FocusChainNode setLastFocusedNode (const Node &lastFocused)
 Sets the last-focused node of a focus scope. More...
 
void clearLastFocusedNode ()
 Set the Node::FocusedProperty value to false, and clears the last-focused node of a focus scope. More...
 

Protected Member Functions

void joinScope (FocusScope &target) override
 Overrides FocusScope::joinScope();. More...
 
void notifyNodeAttached (Node &node) override
 Overrides FocusScope::notifyNodeAttached() for popups. More...
 
void notifyNodeDetached (Node &node) override
 Overrides FocusScope::notifyNodeDetached() for popups. More...
 
void notifyNodeVisibilityChanged (Node &node) override
 Overrides FocusScopeCore::notifyNodeVisibilityChanged(). More...
 
void notifyScopeInFront (ModalScope *previous, FocusManager::FocusReason reason)
 Notifies that this scope is brought to the front of the scope stack. More...
 
void notifyScopeSentToBack (ModalScope &next, FocusManager::FocusReason reason)
 Notifies that this scope is sent to the back of the scope stack. More...
 
void notifyScopeTypeChange (FocusScope &oldScopeData) override
 Overrides FocusScope::notifyScopeTypeChange();. More...
 
EventQueue::ProcessingResult processTouchPoint (const TouchPoint &point) override
 Overrides FocusScopeCore::processTouchPoint(). More...
 
void splitScope (FocusScope *source, FocusChainNode targetLastFocusNode) override
 Overrides FocusScope::splitScope();. More...
 
- Protected Member Functions inherited from kanzi::FocusFence
 FocusFence (Node &root, ScopeFlag flags)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::FocusScope
void focusNavigationHandler (FocusManager::MoveFocusMessageArguments &args)
 Navigates the focus in a scope. More...
 
 FocusScope (Node &scopeNode, ScopeFlag flags)
 Constructor. More...
 
void invalidateFocusChain () override
 Overrides FocusScopeCore::invalidateFocusChain(). More...
 
void joinScope (FocusScope &target) override
 Overrides FocusScopeCore::joinScope(). More...
 
void notifyNodeAttached (Node &node) override
 Overrides FocusScopeCore::notifyNodeAttached(). More...
 
void notifyNodeDetached (Node &node) override
 Overrides FocusScopeCore::notifyNodeDetached(). More...
 
void notifyScopeTypeChange (FocusScope &oldScopeData) override
 Overrides FocusScopeCore::notifyScopeTypeChange(). More...
 
void splitScope (FocusScope *target, FocusChainNode targetLastFocusedNode) override
 Overrides FocusScopeCore::splitScope(). More...
 
void swapScopeData (FocusScope &other)
 Swaps the focus scope data of this scope with the focus scope data of the source scope. More...
 

Protected Attributes

Node::MessageSubscriptionToken m_bringScopeToFrontMessageToken
 Message subscription token for FocusManager::BringScopeToFrontMessage. More...
 
Node2DWeakPtr m_rootForKey
 The root node until which the key messages are bubbled. More...
 
Node2DWeakPtr m_rootForTouch
 The root node where the touch hit testing is started for the modal scope. More...
 
FocusManager::ScopeStackm_scopeStack
 The focus scope stack. More...
 
Node::MessageSubscriptionToken m_sendScopeToBackMessageToken
 Message subscription token for FocusManager::SendScopeToBaskMessage. More...
 
- Protected Attributes inherited from kanzi::FocusScope
const ScopeFlag m_scopeFlags
 The scope flags. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::FocusScope
using FocusChainSharedPtr = shared_ptr< FocusChain >
 The focus chain pointer type. More...
 
- Static Public Member Functions inherited from kanzi::FocusScope
static FocusScopePtr create (FocusManager::FocusScopeType type, Node &rootNode, FocusManager::ScopeStack &scopeStack)
 Creates an instance of a focus scope type, with the rootNode as the focus scope node. More...
 
- Protected Types inherited from kanzi::FocusScope
enum  ScopeFlag {
  ScopeFlag::EnterFocusWithNavigationAllowed, ScopeFlag::LeaveFocusWithNavigationAllowed, ScopeFlag::CanGetLastFocusedNode, ScopeFlag::DisableAll,
  ScopeFlag::EnableAll
}
 Defines the scope flags. More...
 

Detailed Description

Implements the modal scopes.

Since
Kanzi 3.7.0

Constructor & Destructor Documentation

◆ ModalScope()

kanzi::ModalScope::ModalScope ( Node root,
FocusManager::ScopeStack scopeStack 
)
explicit

Constructor.

◆ ~ModalScope()

kanzi::ModalScope::~ModalScope ( )
override

Destructor.

Member Function Documentation

◆ getHitTestRoot()

Node2DSharedPtr kanzi::ModalScope::getHitTestRoot ( )

Returns the node from where the hit test iteration is started.

Returns
The node from where the InputManager starts the hit test iteration.

◆ getKeyInputRoot()

Node2DSharedPtr kanzi::ModalScope::getKeyInputRoot ( )

Returns the node to which the key input is propagated.

Returns
The node to which the key input is propagated.

◆ getType()

FocusManager::FocusScopeType kanzi::ModalScope::getType ( ) const
overridevirtual

Returns the type of the focus scope.

Returns
Returns FocusManager::FocusScopeType::Modal.

Reimplemented from kanzi::FocusFence.

Reimplemented in kanzi::PopupScope.

◆ getParent()

FocusScope* kanzi::ModalScope::getParent ( ) const
overridevirtual

Overrides FocusScope::getParent() by always returning nullptr, because modal scopes have no parent scopes.

Returns
Returns nullptr.

Reimplemented from kanzi::FocusScope.

◆ isForemostScope()

bool kanzi::ModalScope::isForemostScope ( ) const

Checks whether the focus scope is the foremost scope of the modal scope stack.

Returns
If the focus scope is the foremost modal scope, true, otherwise false.

◆ bringScopeToFront()

bool kanzi::ModalScope::bringScopeToFront ( )

Brings a modal focus scope to the front of focus scopes.

Kanzi automatically deactivates the previous foremost focus scope.

Returns
If the activation succeeds, true, otherwise false.
See also
isAttached()
Since
Kanzi 3.9.0

◆ sendScopeToBack()

bool kanzi::ModalScope::sendScopeToBack ( FocusManager::FocusReason  reason)

Sends a focus scope to the end of the focus scope stack with a given reason value.

If the focus scope is the foremost focus scope, the second foremost focus scope becomes the foremost focus scope.

Parameters
reasonThe reason the scope is sent to back.
Returns
If the focus scope is successfully sent to back, true, otherwise false.
Since
Kanzi 3.9.0

◆ addToStack()

void kanzi::ModalScope::addToStack ( )

Adds the focus scope to the modal scope stack.

Since
kanzi 3.9.0

◆ removeFromStack()

void kanzi::ModalScope::removeFromStack ( FocusManager::FocusReason  reason)

Removes the focus scope from the modal scope stack.

If the focus scope is the foremost focus scope, sends the scope to the back of the focus scope stack.

Since
kanzi 3.9.0

◆ getEffectiveFocus()

FocusChainNode kanzi::ModalScope::getEffectiveFocus ( ) const

Returns the effective focus node of a modal scope.

The effective focus node is the focus node of a scope that is visible.

Returns
The effective focus node of the focus scope.
Since
Kanzi 3.9.0

◆ trySetFocus()

FocusChainNode kanzi::ModalScope::trySetFocus ( Node node)

Tries to set the focus to a node of the focus scope.

Parameters
nodeThe node to which you want to set the focus.
Returns
The node to which Kanzi set the focus. This can be:
  • The node to which you set focus.
  • If you tried to set the focus to a focus scope node, one of its child nodes.
  • If the method cannot set the focus to any node, returns nullptr.
  • If the node is not within the focus scope boundaries, returns nullptr.
Since
Kanzi 3.9.0

◆ tryMoveFocusAcrossNestedScopes()

FocusChainNode kanzi::ModalScope::tryMoveFocusAcrossNestedScopes ( FocusManager::FocusChainDirection  direction)

Tries to set the focus to a node relative to the focused node of the popup-type focus scope passed as an argument, using the focus chain navigation.

The method takes the next focus candidate from the focus chain of the popup-type focus scope and its nested focus scopes in the given direction.

If the focus scope has no last-focused node set, the method sets the focus to:

The method fails if the popup-type focus scope has no focusable descendant node.

Parameters
directionThe direction in which to query for the next focusable node.
Returns
The node that has focus. If the scope has no focusable node in the requested direction, the method returns nullptr.
Since
Kanzi 3.9.0

◆ isNodeInScope()

bool kanzi::ModalScope::isNodeInScope ( const Node node) const
overridevirtual

Checks whether a node is in this modal scope.

Parameters
nodeThe node to check.
Returns
If the node is in this modal scope, true, otherwise false.

Reimplemented from kanzi::FocusScope.

◆ splitScope()

void kanzi::ModalScope::splitScope ( FocusScope source,
FocusChainNode  targetLastFocusNode 
)
overrideprotected

◆ joinScope()

void kanzi::ModalScope::joinScope ( FocusScope target)
overrideprotected

◆ notifyScopeTypeChange()

void kanzi::ModalScope::notifyScopeTypeChange ( FocusScope oldScopeData)
overrideprotected

◆ notifyNodeAttached()

void kanzi::ModalScope::notifyNodeAttached ( Node node)
overrideprotected

Overrides FocusScope::notifyNodeAttached() for popups.

◆ notifyNodeDetached()

void kanzi::ModalScope::notifyNodeDetached ( Node node)
overrideprotected

Overrides FocusScope::notifyNodeDetached() for popups.

◆ notifyNodeVisibilityChanged()

void kanzi::ModalScope::notifyNodeVisibilityChanged ( Node node)
overrideprotected

Overrides FocusScopeCore::notifyNodeVisibilityChanged().

◆ processTouchPoint()

EventQueue::ProcessingResult kanzi::ModalScope::processTouchPoint ( const TouchPoint point)
overrideprotected

Overrides FocusScopeCore::processTouchPoint().

◆ notifyScopeInFront()

void kanzi::ModalScope::notifyScopeInFront ( ModalScope previous,
FocusManager::FocusReason  reason 
)
protected

Notifies that this scope is brought to the front of the scope stack.

Parameters
previousThe previous foremost focus scope. If there is no previous foremost focus scope in Kanzi, pass nullptr.
reasonThe reason value the scope is brought to the front of the stack of scopes.

◆ notifyScopeSentToBack()

void kanzi::ModalScope::notifyScopeSentToBack ( ModalScope next,
FocusManager::FocusReason  reason 
)
protected

Notifies that this scope is sent to the back of the scope stack.

Parameters
nextThe next focus scope to become the foremost focus scope.
reasonThe reason value the scope is sent back to the stack of scopes.

Member Data Documentation

◆ m_rootForTouch

Node2DWeakPtr kanzi::ModalScope::m_rootForTouch
protected

The root node where the touch hit testing is started for the modal scope.

◆ m_rootForKey

Node2DWeakPtr kanzi::ModalScope::m_rootForKey
protected

The root node until which the key messages are bubbled.

◆ m_scopeStack

FocusManager::ScopeStack& kanzi::ModalScope::m_scopeStack
protected

The focus scope stack.

◆ m_bringScopeToFrontMessageToken

Node::MessageSubscriptionToken kanzi::ModalScope::m_bringScopeToFrontMessageToken
protected

Message subscription token for FocusManager::BringScopeToFrontMessage.

◆ m_sendScopeToBackMessageToken

Node::MessageSubscriptionToken kanzi::ModalScope::m_sendScopeToBackMessageToken
protected

Message subscription token for FocusManager::SendScopeToBaskMessage.


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