Focus Manager enables you to set and change the key focus between attached nodes. More...
#include <kanzi/core.ui/input/focus_manager.hpp>
Public Types | |
using | FocusChainDirection = kanzi::FocusChainDirection |
Specifies the direction of the focus move. More... | |
using | FocusReason = kanzi::FocusReason |
Specifies the reason the node is focused. More... | |
using | FocusScopeType = kanzi::FocusScopeType |
Specifies the type of the focus scope. More... | |
Public Member Functions | |
void | attach (Screen &screen) |
Attaches a screen node to a focus manager. More... | |
KZ_DEPRECATED FocusScopePtr | createFocusScopeInfo (Node &rootNode) |
Creates a focus scope info with the rootNode as the focus scope node. More... | |
void | detach (Screen &screen) |
Detaches a screen node from an focus manager. More... | |
FocusManager () | |
Creates a FocusManager instance. More... | |
NodeSharedPtr | getFocus () const |
Returns the key focus node of the application. More... | |
OverlayScope * | getFocusedOverlay () const |
Returns the focused overlay focus scope. More... | |
OverlayScope * | getForemostOverlay () const |
Returns the foremost overlay focus scope. More... | |
NodeSharedPtr | getForemostOverlayNode () const |
Returns the root node of the foremost overlay focus scope. More... | |
OverlayScope * | getOverlayBelow (const OverlayScope &scope) const |
Returns the overlay focus scope that precedes in the overlay scope stack the overlay focus scope that you pass as an argument. More... | |
void | removeFocus () |
Removes key focus from the application by removing the focused status from the focused node. More... | |
KZ_DEPRECATED NodeSharedPtr | tryMoveActiveFocus (ModalScope &popupScope, kanzi::FocusChainDirection direction) |
Tries to set the focus to a node relative to the current key focus node of the overlay focus scope passed as an argument using the focus chain navigation. More... | |
KZ_DEPRECATED NodeSharedPtr | tryMoveActiveFocus (kanzi::FocusChainDirection direction) |
NodeSharedPtr | tryMoveFocus (OverlayScope &overlayScope, kanzi::FocusChainDirection direction) |
Tries to set the focus to a node relative to the current key focus node of the overlay focus scope passed as an argument using the focus chain navigation. More... | |
NodeSharedPtr | tryMoveFocus (kanzi::FocusChainDirection direction) |
Tries to set the focus to a node relative to the current key focus node of the application using the focus chain navigation. More... | |
NodeSharedPtr | tryMoveFocusBackward () |
The method is a specialization of the tryMoveFocus(FocusChainDirection) moving and moves the focus from the current key focus node in the backward direction. More... | |
NodeSharedPtr | tryMoveFocusForward () |
The method is a specialization of the tryMoveFocus(FocusChainDirection) method and moves the focus from the current key focus node in the forward direction. More... | |
NodeSharedPtr | tryMoveFocusInScope (FocusScope &scope, kanzi::FocusChainDirection direction) |
Tries to set the focus to a node relative to the current key focus node of the focus scope using the focus navigation. More... | |
KZ_DEPRECATED NodeSharedPtr | trySetActiveFocus (ModalScope &popupScope, NodeSharedPtr newFocusNode, kanzi::FocusReason reason) |
Tries to set the focus on an overlay focus scope. More... | |
KZ_DEPRECATED NodeSharedPtr | trySetActiveFocus (NodeSharedPtr newFocusNode, kanzi::FocusReason reason) |
Tries to set the focus node of the foremost overlay focus scope to the newFocusNode and specifies the reason for moving the focus. More... | |
KZ_DEPRECATED NodeSharedPtr | trySetActiveFocus (NodeSharedPtr newFocusNode) |
An overload of trySetActiveFocus() using FocusReason::Force to move the focus. More... | |
NodeSharedPtr | trySetFocus (NodeSharedPtr newFocusNode) |
Tries to set the focus to the newFocusNode. More... | |
NodeSharedPtr | trySetFocus (NodeSharedPtr newFocusNode, FocusFallback fallbackOption) |
Tries to set the focus to the newFocusNode using trySetFocus() but with a fallback behavior in case the node does not gain focus. More... | |
Static Public Member Functions | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
Creates the property editor info for the FocusManager. More... | |
Friends | |
class | Node |
class | OverlayScope |
Properties | |
static PropertyType< FocusOnPress > | FocusOnPressProperty |
Sets where to set the focus when the user presses a node that has this property. More... | |
static PropertyType< int > | FocusOrderProperty |
Sets the focus chain order of the node to which the property is attached. More... | |
static PropertyType< bool > | CyclicFocusNavigationProperty |
Sets whether the focus chain navigation is cyclic in a focus scope. More... | |
static PropertyType< FocusScopeType > | FocusScopeTypeProperty |
Sets the focus scope type of the node to which this property is attached. More... | |
static FocusOnPress | getFocusOnPress (const Node &node) |
Gets the value of FocusOnPressProperty. More... | |
static void | setFocusOnPress (Node &node, FocusOnPress focusOnPress) |
Set the value of the FocusOnPressProperty. More... | |
static size_t | getFocusOrder (const Node &node) |
Returns the value of the FocusOrderProperty. More... | |
static void | setFocusOrder (Node &node, size_t index) |
Sets the value of the FocusOrderProperty. More... | |
static void | clearFocusOrder (Node &node) |
Clears the local value of the FocusOrderProperty. More... | |
static bool | getCyclicFocusNavigation (const Node &node) |
Returns the value of the CyclicFocusNavigationProperty. More... | |
static void | setCyclicFocusNavigation (Node &node, bool cyclic) |
Sets the value of the CyclicFocusNavigationProperty. More... | |
static void | clearCyclicFocusNavigation (Node &node) |
Clears the local value of the CyclicFocusNavigationProperty. More... | |
static FocusScopeType | getFocusScopeType (const Node &node) |
Returns the value of the FocusScopeTypeProperty. More... | |
static void | setFocusScopeType (Node &node, FocusScopeType type) |
Sets the value of the FocusScopeTypeProperty. More... | |
static KZ_DEPRECATED bool | isFocusScope (const Node &node) |
If a node has the FocusScopeTypeProperty attached, returns whether that node is a focus scope. More... | |
static KZ_DEPRECATED void | setFocusScope (Node &node, bool isScope) |
Sets the value of the FocusScopeTypeProperty property for a node to set that node to either become or not become a focus scope. More... | |
static KZ_DEPRECATED bool | isFocusFence (const Node &node) |
If a node has the FocusScopeTypeProperty attached, returns whether that node is a focus fence. More... | |
static KZ_DEPRECATED void | setFocusFence (Node &node, bool isFence) |
Sets the value of the FocusScopeTypeProperty property for a node to set that node to either become or not become a focus fence. More... | |
Messages | |
Message arguments for post-focus messages. Contains the reason the focus move is initiated.
| |
using | ScopeBroughtToFrontMessageArguments = OverlayBroughtToFrontMessageArguments |
using | ScopeSentToBackMessageArguments = OverlaySentToBackMessageArguments |
static MessageType< PreFocusMessageArguments > | AboutToLoseFocusMessage |
The message dispatched to the key focus node and its ascendants before losing focus. More... | |
static MessageType< PreFocusMessageArguments > | AboutToGainFocusMessage |
The message dispatched to the next focusable node. More... | |
static MessageType< PostFocusMessageArguments > | FocusLostMessage |
Informs the old key focus node about losing the focus. More... | |
static MessageType< PostFocusMessageArguments > | FocusGainedMessage |
Informs the new key focus node about getting the focus. More... | |
static MessageType< OverlayBroughtToFrontMessageArguments > | OverlayBroughtToFrontMessage |
Kanzi dispatches this message when an overlay scope becomes the foremost overlay scope. More... | |
static MessageType< ScopeBroughtToFrontMessageArguments > | ScopeBroughtToFrontMessage |
Kanzi dispatches this message when an overlay scope becomes the foremost overlay scope. More... | |
static MessageType< OverlaySentToBackMessageArguments > | OverlaySentToBackMessage |
Kanzi dispatches this message when an overlay scope is no longer the foremost overlay scope. More... | |
static MessageType< ScopeSentToBackMessageArguments > | ScopeSentToBackMessage |
Kanzi dispatches this message when an overlay scope is no longer the foremost overlay scope. More... | |
static MessageType< FocusEnteredFocusScopeMessageArguments > | FocusEnteredFocusScopeMessage |
When focus enters a focus scope, Kanzi sends this message to the focus scope node that contains the node which gains focus. More... | |
static MessageType< FocusLeftFocusScopeMessageArguments > | FocusLeftFocusScopeMessage |
When focus leaves a focus scope, Kanzi sends this message to the focus scope node that contains the node which loses focus. More... | |
static MessageType< OverlayGainedFocusMessageArguments > | OverlayGainedFocusMessage |
When an overlay scope gains focus, Kanzi sends this message to the overlay scope node that contains the node which gains focus. More... | |
static MessageType< OverlayLostFocusMessageArguments > | OverlayLostFocusMessage |
When an overlay scope loses focus, Kanzi sends this message to the overlay scope node that contains the node which loses focus. More... | |
static MessageType< MoveFocusMessageArguments > | MoveScopeFocusForwardMessage |
A focus scope node handles this message to move the focus to the next focusable node of the focus scope in forward direction. More... | |
static MessageType< MoveFocusMessageArguments > | MoveScopeFocusBackwardMessage |
A focus scope node handles this message to move the focus to the next focusable node of the focus scope in backward direction. More... | |
static MessageType< InputOutsideOverlayMessageArguments > | InputOutsideOverlayMessage |
Kanzi dispatches this message when an input event occurs outside of an overlay scope node area. More... | |
Focus Manager enables you to set and change the key focus between attached nodes.
Each domain can have only one instance of a Focus Manager.
A focusable node is a node that is attached to the scene graph and has the Node::FocusableProperty set to true. Kanzi can set focus only to focusable nodes. When a node has the Node::FocusableProperty set to false, Kanzi excludes that node from the focus management. This is the default setting.
The key focus node of an application is the node that receives all the key input, and has the read-only Node::FocusedProperty set to true. Kanzi controls the value of the Node::FocusedProperty internally. Changing the value of the property does not set the key focus node. To set the key focus node, use trySetFocus() or tryMoveFocus() or one of its variants.
A focus chain is the sequence of nodes that defines the order in which Kanzi applies focus to nodes when the application user moves the focus in a focus scope using the focus chain navigation methods. Each focus scope node has its own focus chain.
To set the order of a node in a focus chain, use the FocusOrderProperty. When you do not set the value of the FocusOrderProperty, the node tree order determines the order of the node in a focus chain.
Kanzi organizes nodes in focus scopes. Focus scopes are nodes which assist in focus chain navigation handling. Focus scopes group their child nodes and drive the focus navigation within that group. They also act like a focus proxy, forwarding the focus to one of their focusable child nodes.
When a focus scope receives focus, Kanzi tries to move the focus to the last-focused node of the focus scope. If focus has not yet visited the focus scope, Kanzi tries to focus:
The first focusable node of the focus chain, if the reason the focus scope receives the focus is not backward focus chain navigation.
The first focusable node is either the node with the smallest value of the FocusOrderProperty, or the first node in the node tree of the focus scope.
The last focusable node of the focus chain, if the focus scope receives the focus because of backward focus chain navigation.
The last focusable node is either the node with the largest value of the FocusOrderProperty, or the last node in the node tree of the focus scope.
When you move the focus away from a focus scope, that scope remembers its last-focused child node.
For more details on focus navigation with scopes, see Setting focus to focus scope nodes and focus navigation in focus scopes.
Kanzi defines these focus scope types:
Focus group groups focusable nodes. This is the simplest type of focus scope. You can move the focus to the focus group and out of the focus group.
To make a node a focus group, in that node set the FocusScopeTypeProperty to FocusScopeType::Group.
Focus fence keeps the focus navigation inside the scope and does not allow the focus navigation to enter or leave that scope.
To make a node a focus fence, in that node set the FocusScopeTypeProperty to FocusScopeType::Fence.
Overlay focus scope types:
Modal overlay blocks the key and touch input that originates from outside its boundaries and keeps the focus navigation within the overlay boundaries, just like a focus fence. Every Kanzi application has at least one modal overlay: the Screen node.
To make a node a modal overlay, in that node set the FocusScopeTypeProperty to FocusScopeType::Modal.
Modeless overlay propagates the key and touch input that originates from outside its boundaries, but keeps the focus navigation within the focus scope boundaries, just like a modal overlay.
To make a node a modeless overlay, in that node set the FocusScopeTypeProperty to FocusScopeType::Modeless.
Auto-closing modal overlay is similar to modal overlay, except that when the overlay is an Activity in a Parallel Activity Host, the Parallel Activity Host deactivates that Activity when user input originates from outside the boundaries of that Activity.
To make a node an auto-closing modal overlay, in that node set the FocusScopeTypeProperty to FocusScopeType::AutoClosingModal.
Auto-closing modeless overlay is similar to modeless overlay, except that when the overlay is an Activity in a Parallel Activity Host, the Parallel Activity Host deactivates that Activity when:
To make a node an auto-closing modal overlay, in that node set the FocusScopeTypeProperty to FocusScopeType::AutoClosingModeless.
One overlay at a time can be the focused overlay. The focus node of the focused overlay is the key focus node of the application and receives key input.
The focus node of an overlay that is currently not the focused overlay is the logical focus node of that overlay. This node was the key focus node before the overlay lost focus. Once the overlay regains focus, the logical focus node becomes the key focus node of the application.
When user input originates from a node that is outside the node tree of an overlay focus scope, that overlay focus scope sends the InputOutsideOverlayMessage message. A Parallel Activity Host automatically handles the InputOutsideOverlayMessage message sent by an Activity which is an auto-closing overlay. For an overlay focus scope node that is not an Activity you can handle the InputOutsideOverlayMessage message manually. For example, you can make a modeless overlay invisible when user input originates from outside its boundaries.
An overlay focus scope has no parent focus scope.
Kanzi organizes nodes in a tree of nodes and organizes focus scopes in the same tree. This enables you to create focus scopes inside focus scopes, that is, nested focus scopes. A nested focus scope behaves the same way as any other focus scope: it forwards and remembers the focus of its child node the same way, regardless of its nested state. When the last-focused node of a focus scope is a nested focus scope, if the nested focus scope is a focus group or a focus fence, Kanzi forwards the focus to the last-focused node of that focus group or focus fence.
Kanzi does not include the nested overlay focus scopes from the focus chain, and does not remember these overlay scope nodes as last-focused nodes. To learn how Kanzi handles these scope types, see Overlay focus scope stack and input delivery.
To set focus to a node:
Attach the node to the node tree of a focus scope that is either the foremost modal overlay in your application or a modeless overlay on top of the foremost modal overlay.
For example, attach the node to the Screen or a Viewport2D node.
Kanzi can set focus to a node that is in the process of being attached to the node tree, but not to a node that is not attached to the node tree.
To set focus to a node:
To retrieve the node that has the key focus, use the getFocus() method.
Kanzi uses these properties to indicate if a node is the focus node of an overlay or if a focus scope contains the focus node of an overlay:
For example, you can use the Node::FocusedProperty or Node::FocusStateProperty in a binding or as a controller property in a state manager to change the look and behavior of the node that has the key focus or is the logical focus of an overlay.
When you hide a node that has focus, by setting the Node::VisibleProperty to false:
You cannot set the focus to a hidden node.
When you disable a node that has focus, by setting the Node::EnabledProperty to false, the Focus Manager keeps the focus on that node and continues to deliver input events to its attached Input Manipulators. UI nodes are responsible for checking their enabled state when receiving input events, and deciding whether to handle those events. You cannot set focus to a disabled node.
Unless you want to override the default behavior, or you want to provide other triggers to move the focus across the nodes, you do not need to care about the default key navigation. You can override the default key navigation by customizing the FocusNavigationManipulator installed on the focus scope, or setting your own focus navigation manipulator to the focus scope. Other means of focus chain navigation you can use are actions that are triggered by property changes, state changes on nodes, and so on.
The default chain navigation keys are the Tab and BackTab keys. The forward direction navigates the focus from the node with smaller value of the attached FocusOrderProperty to the nodes with higher value of the attached FocusOrderProperty, while backwards direction navigates the focus in the opposite direction.
Kanzi restricts the focus chain navigation to within a specific overlay focus scope and, when performing focus chain navigation, skips the nested focus fences, the focus groups with empty focus chain, and overlay focus scopes.
Kanzi automatically includes in the focus chain all nodes in a focus scope that have the Node::FocusableProperty, Node::EnabledProperty, and Node::VisibleProperty set to true. To move the focus to the next node in the focus chain, call the tryMoveFocus() method or one of its overrides.
When Tab and BackTab keys are functional keys of a node, that node consumes the keys used by the focus chain navigation. When such node receives focus, the Focus Manager is no longer able to move the focus from that node through the key input events. To use keys to move focus from such node, you must install a FocusNavigationManipulator to that node, and set custom keys to move the focus from the node.
To move focus in focus chain from a node that consumes the Tab and BackTab keys:
When you set the focus to a focus scope node, Kanzi tries to restore the focus on the last-focused node of the focus scope.
When you set the focus to a focus scope node using the tryMoveFocusBackward() method, and the focus scope has no last-focused node remembered, Kanzi tries to move the focus to the last focusable node of the focus chain of the focus scope.
When you set the focus to a focus scope node using trySetFocus() or any other variant of the tryMoveFocus() methods, and the focus scope has no last-focused node remembered, Kanzi tries to move the focus to the first focusable node of the focus chain of the focus scope.
To set the focus on the last focusable child node of a scope:
When you move the focus out from a focus scope, the focus scope remembers the focus state of its last-focused node. This way when you return the focus to the focus scope using the trySetFocus() or tryMoveFocus() method, Kanzi restores the focus on this node, unless the last-focused node is detached from the UI scene.
To move the focus back to the last-focused node of a focus scope:
When you set the focus to a focus scope using the focus chain navigation methods, such as tryMoveFocus() and its overrides, the focus scope forwards the focus to its last-focused child node. Further calls on the method move the focus in the direction specified, to the next or previous node in the focus chain, including nested focus scopes.
When a node gets focus, all its ascendant focus scopes get their focus state set to true. The focus scopes keep the focus state as long as the focus node remains in their scope. When you move the focus away from a node, all its ascendant focus scopes get their focus state set to false.
This example shows this scenario:
Kanzi skips focus scopes in the focus chain navigation, because a focus scope does not get focus as long as it has child nodes that can get focus. The child nodes of a focus scope node that is hidden or disabled cannot get focus. You can exclude a focus scope node from the focus chain by setting either the Node::EnabledProperty or the Node::VisibleProperty to false.
You can route the default focus chain navigation in the same way as regular focus nodes. In that case, focus chain navigation follows the routed nodes and focuses the nodes or focus scopes routed when the focus navigation leaves the focus scope:
Use a focus fence (FocusScopeType::Fence) when you want to keep the focus chain navigation within the boundaries of a focus scope.
Kanzi keeps the focus chain navigation inside a focus fence and skips fences when the focus chain navigation happens outside of those focus fences. Kanzi also ignores the focus routing to focus fences. You can move the focus from within a focus fence to a node outside of the focus fence, and the other way around, only using the trySetFocus() method.
This example shows the focus fence behavior:
By default, Kanzi delivers touch input to all nodes in an overlay focus scope, including the nested focus scopes that are not overlay focus scopes. Kanzi keeps track of the overlay focus scopes of an application that are attached to the node tree, and organizes them in the form of a stack. If the foremost overlay focus scope is a modeless overlay, Kanzi delivers the touch input that occurs outside of the foremost overlay focus scope boundaries to the overlay focus scopes that precede the foremost overlay scope.
When Kanzi detects touch input that originates outside an overlay scope, it sends the InputOutsideOverlayMessage message. To enable Kanzi to detect the origin of the touch input, you must set the Node::HitTestableProperty to true on the overlay scopes.
Kanzi delivers the key input to the foremost overlay scope first. If the foremost overlay scope does not consume the key input, and that scope is a modeless overlay, Kanzi propagates the key input to the overlay scopes that precede the foremost overlay scope. If the key is handled in one of the propagated overlay scopes, and the scope is a modeless overlay, Kanzi sends the InputOutsideOverlayMessage message.
When you attach an overlay scope node to the UI scene, Kanzi inserts that overlay scope to the overlay scope stack according to the rendering order of the nodes in the UI scene. The overlay scope receives:
When you hide an overlay scope node by setting Node::VisibleProperty to false on that node, Kanzi removes the overlay focus scope from the focus scope stack. When the overlay scope node is made visible again, Kanzi adds the overlay focus scope back to the focus scope stack.
To create a modal overlay node:
To bring an overlay focus scope to front:
To send an overlay focus scope back:
When you detach an overlay focus scope node from the node tree, Kanzi removes that overlay focus scope from the FocusManager. When Kanzi removes an overlay focus scope from the FocusManager, it marks that focus scope as detached. A detached overlay focus scope remembers its last-focused node.
When you attach a detached overlay focus scope node to the node tree, if that overlay scope becomes the foremost overlay scope, Kanzi restores the focus of that overlay scope.
When you move the focus forward or backward in a focus scope, and the focus reaches the last or first focusable node of the focus scope, Kanzi looks for the sibling of the focus scope to continue the focus chain navigation. When Kanzi cannot find a focus candidate in an overlay focus scope in the navigation direction, Kanzi by default keeps the focus on the last focused node. To enable cyclic focus navigation, attach the CyclicFocusNavigationProperty to the focus scope node, and set the property value to true.
In cyclic focus navigation:
You can enable cyclic focus navigation for any focus scope node. When you enable cyclic focus navigation, the focus chain navigation never leaves the boundaries of the focus scope.
Kanzi uses focus change notification messages to inform UI nodes about changes in the application focus and focus scope type of nodes. The set of messages that Kanzi dispatches depends on which focus action caused the change.
Kanzi dispatches these messages to notify nodes about focus changes:
Each message contains an argument that specifies the reason of the focus change.
Kanzi dispatches different sets of messages depending on the type of change:
These examples show how to handle the messages that Kanzi dispatches before the focus moves.
The pre-focus message handlers are:
To move focus:
When focus is set to a node and the application has no focus:
When focus is removed from the application:
When focus moves to a node in the same focus scope:
When focus moves to a node in a different focus scope because of trySetFocus() or tryMoveFocus() call:
When focus moves from a node in an overlay to a node in another overlay because of trySetFocus() call or because the overlay is detached:
Kanzi dispatches the OverlayGainedFocusMessage, FocusEnteredFocusScopeMessage, FocusLeftFocusScopeMessage, and OverlayLostFocusMessage only if the focused overlay or the focus scope that contains the key focus changes because of a focus change.
When there is a change in the overlay scope stack because a node was detached or attached, or its visibility changed:
When an overlay focus scope node is attached to be the foremost overlay but there is no application focus, and the attached overlay node has no focusable nodes, Kanzi dispatches only the OverlayBroughtToFrontMessage and OverlaySentToBackMessage.
When an overlay focus scope node is attached to be the foremost overlay and there is an existing application focus, Kanzi dispatches all focus change notifications:
When the overlay focus scope node of the foremost overlay, which holds the application focus, is detached from the node tree, Kanzi dispatches all focus change notifications:
When the Focus Scope Type of a node changes, Kanzi:
The focus scope type change concerns also the case where a new focus scope type is assigned to a node. The focus scope type of a node is expected to change only while using the Kanzi Studio Preview. There should be no need to change the focus scope type of a node dynamically at runtime.
The focus scope type change determines which messages Kanzi dispatches and their order:
When there is no application focus and a node, which is eligible to gain focus, is set to be an overlay focus scope:
When the application has focus and a node which is set to be an overlay focus scope becomes the foremost overlay:
When the focus scope type of the focus scope that contains the focus changes from group to fence:
When the application focus is in an overlay whose focus scope type changes to an other overlay type:
Specifies the reason the node is focused.
Specifies the direction of the focus move.
Specifies the type of the focus scope.
using kanzi::FocusManager::ScopeBroughtToFrontMessageArguments = OverlayBroughtToFrontMessageArguments |
|
explicit |
Creates a FocusManager instance.
void kanzi::FocusManager::attach | ( | Screen & | screen | ) |
void kanzi::FocusManager::detach | ( | Screen & | screen | ) |
|
static |
Gets the value of FocusOnPressProperty.
node | A node that has the FocusOnPressProperty attached. |
|
static |
Set the value of the FocusOnPressProperty.
node | A node that has the FocusOnPressProperty attached. |
focusOnPress | The value that you want to set on the FocusOnPressProperty. |
|
static |
Returns the value of the FocusOrderProperty.
node | A node that has the FocusOrderProperty attached. |
|
static |
Sets the value of the FocusOrderProperty.
node | A node that has the FocusOrderProperty attached, and for which you want to set the value. |
index | The value of the FocusOrderProperty that you want to set. To remove the local value of the FocusOrderProperty from the node, use numeric_limits<size_t>::max(). |
|
static |
Clears the local value of the FocusOrderProperty.
node | A node that has the FocusOrderProperty attached, and for which you want to clear the local value. |
|
static |
Returns the value of the CyclicFocusNavigationProperty.
node | A node that has the CyclicFocusNavigationProperty attached. |
|
static |
Sets the value of the CyclicFocusNavigationProperty.
node | A node that has the CyclicFocusNavigationProperty attached, and for which you want to set the value. |
cyclic | The value of the CyclicFocusNavigationProperty that you want to set. |
|
static |
Clears the local value of the CyclicFocusNavigationProperty.
node | A node that has the CyclicFocusNavigationProperty attached, and for which you want to clear the local value. |
|
static |
Returns the value of the FocusScopeTypeProperty.
node | A node that has the FocusScopeTypeProperty attached. |
|
static |
Sets the value of the FocusScopeTypeProperty.
node | A node that has the FocusScopeTypeProperty attached and for which you want to set the value. |
type | The value of the FocusScopeTypeProperty that you want to set. To remove the local value of the FocusScopeTypeProperty from the node, use FocusScopeType::NoScope. |
|
static |
If a node has the FocusScopeTypeProperty attached, returns whether that node is a focus scope.
node | A node that has the FocusScopeTypeProperty property attached. |
|
static |
Sets the value of the FocusScopeTypeProperty property for a node to set that node to either become or not become a focus scope.
node | A node to which you want to attach the FocusScopeTypeProperty. |
isScope | To set the node to become a focus scope, set to true (FocusScopeType::Group), otherwise set to false (FocusScopeType::NoScope). |
|
static |
If a node has the FocusScopeTypeProperty attached, returns whether that node is a focus fence.
node | A node for which you want to check whether it is a focus fence. |
|
static |
Sets the value of the FocusScopeTypeProperty property for a node to set that node to either become or not become a focus fence.
node | A node to which you want to attach the FocusScopeTypeProperty. |
isFence | To set the node to become a focus fence, set to true (FocusScopeType::Fence), otherwise set to false (FocusScopeType::NoScope). |
|
static |
Creates the property editor info for the FocusManager.
KZ_DEPRECATED NodeSharedPtr kanzi::FocusManager::trySetActiveFocus | ( | ModalScope & | popupScope, |
NodeSharedPtr | newFocusNode, | ||
kanzi::FocusReason | reason | ||
) |
Tries to set the focus on an overlay focus scope.
NodeSharedPtr kanzi::FocusManager::trySetFocus | ( | NodeSharedPtr | newFocusNode | ) |
Tries to set the focus to the newFocusNode.
newFocusNode | The node to which you want to move the focus. |
NodeSharedPtr kanzi::FocusManager::trySetFocus | ( | NodeSharedPtr | newFocusNode, |
FocusFallback | fallbackOption | ||
) |
Tries to set the focus to the newFocusNode using trySetFocus() but with a fallback behavior in case the node does not gain focus.
newFocusNode | The node to which you want to move the focus. |
fallbackOption | The fallback behavior:
|
KZ_DEPRECATED NodeSharedPtr kanzi::FocusManager::trySetActiveFocus | ( | NodeSharedPtr | newFocusNode, |
kanzi::FocusReason | reason | ||
) |
Tries to set the focus node of the foremost overlay focus scope to the newFocusNode and specifies the reason for moving the focus.
KZ_DEPRECATED NodeSharedPtr kanzi::FocusManager::trySetActiveFocus | ( | NodeSharedPtr | newFocusNode | ) |
An overload of trySetActiveFocus() using FocusReason::Force to move the focus.
NodeSharedPtr kanzi::FocusManager::tryMoveFocus | ( | OverlayScope & | overlayScope, |
kanzi::FocusChainDirection | direction | ||
) |
Tries to set the focus to a node relative to the current key focus node of the overlay focus scope passed as an argument using the focus chain navigation.
The method takes the next focus candidate from the focus chain of the overlay focus scope and its nested focus group or fence focus scopes in the given direction.
If the focus scope has no key focus node set, the method sets the focus to:
The method fails if the overlay focus scope has no focusable descendant node.
overlayScope | The overlay focus scope where you want to set the key focus node. |
direction | The direction in which to query for the next focusable node. |
NodeSharedPtr kanzi::FocusManager::tryMoveFocusInScope | ( | FocusScope & | scope, |
kanzi::FocusChainDirection | direction | ||
) |
Tries to set the focus to a node relative to the current key focus node of the focus scope using the focus navigation.
The method takes from the focus chain of the focus scope the next focus candidate in the given direction. The method does not move the focus to nodes in nested focus scopes.
If the focus scope has no key focus node set, the method sets the focus to:
The method fails if:
scope | The focus scope in which to move the focus. |
direction | The direction in which to query for the next focusable node. |
KZ_DEPRECATED NodeSharedPtr kanzi::FocusManager::tryMoveActiveFocus | ( | ModalScope & | popupScope, |
kanzi::FocusChainDirection | direction | ||
) |
Tries to set the focus to a node relative to the current key focus node of the overlay focus scope passed as an argument using the focus chain navigation.
The method takes the next focus candidate from the focus chain in the given direction.
NodeSharedPtr kanzi::FocusManager::tryMoveFocus | ( | kanzi::FocusChainDirection | direction | ) |
Tries to set the focus to a node relative to the current key focus node of the application using the focus chain navigation.
The method takes the next focus candidate from the focus chain in the given direction.
The action fails if there is no focusable node in the focus chain of the application or if there is no existing application focus.
direction | The direction in which to query for the next focusable node. |
KZ_DEPRECATED NodeSharedPtr kanzi::FocusManager::tryMoveActiveFocus | ( | kanzi::FocusChainDirection | direction | ) |
NodeSharedPtr kanzi::FocusManager::tryMoveFocusForward | ( | ) |
The method is a specialization of the tryMoveFocus(FocusChainDirection) method and moves the focus from the current key focus node in the forward direction.
NodeSharedPtr kanzi::FocusManager::tryMoveFocusBackward | ( | ) |
The method is a specialization of the tryMoveFocus(FocusChainDirection) moving and moves the focus from the current key focus node in the backward direction.
NodeSharedPtr kanzi::FocusManager::getFocus | ( | ) | const |
Returns the key focus node of the application.
void kanzi::FocusManager::removeFocus | ( | ) |
Removes key focus from the application by removing the focused status from the focused node.
This method does not clear the last-focused nodes of focus scopes. Focus navigation works only when the application has focus.
After you call removeFocus(), all nodes in the application have Node::FocusedProperty set to false.
If there is no application focus, the method does not do anything.
To set the application focus again, call trySetFocus().
KZ_DEPRECATED FocusScopePtr kanzi::FocusManager::createFocusScopeInfo | ( | Node & | rootNode | ) |
Creates a focus scope info with the rootNode as the focus scope node.
rootNode | The root node of the focus scope. |
OverlayScope* kanzi::FocusManager::getForemostOverlay | ( | ) | const |
Returns the foremost overlay focus scope.
OverlayScope* kanzi::FocusManager::getFocusedOverlay | ( | ) | const |
Returns the focused overlay focus scope.
NodeSharedPtr kanzi::FocusManager::getForemostOverlayNode | ( | ) | const |
Returns the root node of the foremost overlay focus scope.
OverlayScope* kanzi::FocusManager::getOverlayBelow | ( | const OverlayScope & | scope | ) | const |
Returns the overlay focus scope that precedes in the overlay scope stack the overlay focus scope that you pass as an argument.
scope | The overlay focus scope for which you want to request the preceding overlay focus scope. |
|
friend |
|
friend |
|
static |
Sets where to set the focus when the user presses a node that has this property.
|
static |
Sets the focus chain order of the node to which the property is attached.
|
static |
Sets whether the focus chain navigation is cyclic in a focus scope.
|
static |
Sets the focus scope type of the node to which this property is attached.
|
static |
The message dispatched to the key focus node and its ascendants before losing focus.
This is the first message that Kanzi dispatches when you move the focus from the key focus node to the next focusable node during the trySetFocus() call.
|
static |
The message dispatched to the next focusable node.
|
static |
Informs the old key focus node about losing the focus.
The message handlers can use this message to perform the required tasks after a node loses the focus.
|
static |
Informs the new key focus node about getting the focus.
The message handlers can use this message to perform the required tasks after a node gets the focus.
|
static |
Kanzi dispatches this message when an overlay scope becomes the foremost overlay scope.
The message arguments contain the reason the overlay became the foremost overlay scope.
|
static |
Kanzi dispatches this message when an overlay scope becomes the foremost overlay scope.
The message arguments contain the reason the overlay became the foremost overlay scope.
|
static |
Kanzi dispatches this message when an overlay scope is no longer the foremost overlay scope.
The message arguments contain the reason the overlay is no longer the foremost overlay scope.
|
static |
Kanzi dispatches this message when an overlay scope is no longer the foremost overlay scope.
The message arguments contain the reason the overlay is no longer the foremost overlay scope.
|
static |
When focus enters a focus scope, Kanzi sends this message to the focus scope node that contains the node which gains focus.
|
static |
When focus leaves a focus scope, Kanzi sends this message to the focus scope node that contains the node which loses focus.
|
static |
When an overlay scope gains focus, Kanzi sends this message to the overlay scope node that contains the node which gains focus.
|
static |
When an overlay scope loses focus, Kanzi sends this message to the overlay scope node that contains the node which loses focus.
|
static |
A focus scope node handles this message to move the focus to the next focusable node of the focus scope in forward direction.
|
static |
A focus scope node handles this message to move the focus to the next focusable node of the focus scope in backward direction.
|
static |
Kanzi dispatches this message when an input event occurs outside of an overlay scope node area.
When an auto-closing overlay Activity in a Parallel Activity Host sends this message, the Parallel Activity host handles the message automatically by deactivating the Activity. For an overlay focus scope node that is not an Activity you can handle this message manually.