Kanzi  3.9.7
Kanzi Engine API
kanzi::InputManager Class Reference

Input Manager converts the events from the given event queue into input specific messages. More...

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

Public Member Functions

void attach (Screen &screen)
 Attaches a screen node to an Input Manager. More...
 
void detach (Screen &screen)
 Detaches the screen node from an Input Manager. More...
 
ScreengetScreen () const
 Gets the Screen node currently associated with the Input Manager. More...
 
 InputManager (Domain *domain)
 Create an Input Manager. More...
 
void notifyNodeDetached (Node &node)
 Node notifies the Input Manager that Kanzi is detaching it from the node tree. More...
 
void processEvent (InputEvent &inputEvent, Node2D &screen)
 Processes a single input event. More...
 
void processEvents (EventQueue &queue, Node2D &screen)
 Processes a queue of input events. More...
 
void resetInput ()
 Cancels and resets all the ongoing gesture recognitions in the Input Manager, and cleans up the input manipulators from the manipulator collection. More...
 
void resetOverlayScopeInput (const OverlayScope &overlay)
 Cancels and resets ongoing touch and key gesture recognition of a given overlay focus scope, and cleans up the input manipulators from the manipulator collection. More...
 
void resetOverlayScopeKeyInput (const OverlayScope &overlay)
 Cancels and resets all key input manipulators of a given overlay focus scope, and cleans up the cancelled input manipulators from the manipulator collection. More...
 
bool setInputManipulatorState (InputManipulator &inputManipulator, InputManipulator::State state)
 Sets the state of an inputManipulator and, based on that state, synchronizes the input manipulators registered to the Input Manager. More...
 
void updateEffectivelyEnabledState (Node &root)
 Node tells the Input Manager to update the Node::EffectivelyEnabledProperty for a root node and its descendant nodes in the same overlay scope. More...
 
void updateHoverStates (const PointerEvent &pointerEvent, Node2D *node)
 Processes pointer events to update hover states of the nodes in a subtree of the passed node. More...
 
 ~InputManager ()
 Destructor. More...
 
Gesture processing input manipulator collection methods
void attachInputManipulator (InputManipulator *manipulator)
 Adds an input manipulator to the collection of gesture processing input manipulators. More...
 
void detachInputManipulator (InputManipulator &manipulator)
 Removes an input manipulator from the collection of gesture processing input manipulators. More...
 

Detailed Description

Input Manager converts the events from the given event queue into input specific messages.

The events supported are key, touch, and mouse pointer events. The key events are forwarded to key manipulators, and the touch and pointer events are unified into press, change and release messages, and forwarded to InputManipulators, which in turn handles the input and dispatch those through proprietary messages. The input manipulators are gathered automatically from the node or its children passed as argument to the processEvents() method.

See also
KeyManipulator, InputManipulator

Constructor & Destructor Documentation

kanzi::InputManager::InputManager ( Domain domain)
explicit

Create an Input Manager.

Parameters
domainThe domain that owns the Input Manager.
kanzi::InputManager::~InputManager ( )

Destructor.

Member Function Documentation

void kanzi::InputManager::attach ( Screen screen)

Attaches a screen node to an Input Manager.

Kanzi calls this method when you associate an Input Manager with a Screen node. Do not call this method directly.

Parameters
screenThe Screen node to which to associate with the Input Manager.
Since
Kanzi 3.9.6
void kanzi::InputManager::detach ( Screen screen)

Detaches the screen node from an Input Manager.

Kanzi calls this method when you disassociate an Input Manager from a Screen node. Do not call this method directly.

Parameters
screenThe Screen node that was associated with the Input Manager.
Since
Kanzi 3.9.6
void kanzi::InputManager::processEvents ( EventQueue queue,
Node2D screen 
)

Processes a queue of input events.

Parameters
queueEvent queue that holds events that are processed.
screenThe screen that receives the events that are processed.
Since
Kanzi 3.9.2 node argument reintroduced.
void kanzi::InputManager::processEvent ( InputEvent inputEvent,
Node2D screen 
)

Processes a single input event.

Use this method instead of processEvents() if your target platform requires immediate processing of individual events and does not support queuing a batch of multiple events into an EventQueue.

Parameters
inputEventThe event to process.
screenThe screen that receives the events that are processed.
Since
Kanzi 3.9.6
bool kanzi::InputManager::setInputManipulatorState ( InputManipulator inputManipulator,
InputManipulator::State  state 
)

Sets the state of an inputManipulator and, based on that state, synchronizes the input manipulators registered to the Input Manager.

Do not call this method from the InputManipulator::notifyTouchInside(), InputManipulator::notifyTouchOutside() or InputManipulator::notifyKeyInput() method.

Parameters
inputManipulatorThe input manipulator whose state to set.
stateThe state to which to set the input manipulator.
Returns
If setting the state succeeds, returns true, otherwise false.
Since
Kanzi 3.9.0
void kanzi::InputManager::resetInput ( )

Cancels and resets all the ongoing gesture recognitions in the Input Manager, and cleans up the input manipulators from the manipulator collection.

void kanzi::InputManager::resetOverlayScopeInput ( const OverlayScope overlay)

Cancels and resets ongoing touch and key gesture recognition of a given overlay focus scope, and cleans up the input manipulators from the manipulator collection.

Parameters
overlayThe overlay focus scope for which to cancel input and clean up input manipulators.
Since
Kanzi 3.9.2
void kanzi::InputManager::resetOverlayScopeKeyInput ( const OverlayScope overlay)

Cancels and resets all key input manipulators of a given overlay focus scope, and cleans up the cancelled input manipulators from the manipulator collection.

Parameters
overlayThe overlay focus scope for which to cancel input and clean up key input manipulators.
Since
Kanzi 3.9.6
void kanzi::InputManager::notifyNodeDetached ( Node node)

Node notifies the Input Manager that Kanzi is detaching it from the node tree.

Parameters
nodeThe node which is detached.
void kanzi::InputManager::updateEffectivelyEnabledState ( Node root)

Node tells the Input Manager to update the Node::EffectivelyEnabledProperty for a root node and its descendant nodes in the same overlay scope.

When a node gets effectively disabled, Input Manager resets all input manipulators for that node.

Parameters
rootThe root node of the subtree in which the Kanzi updates the values of the Node::EffectivelyEnabledProperty.
Since
Kanzi 3.9.0
void kanzi::InputManager::attachInputManipulator ( InputManipulator manipulator)

Adds an input manipulator to the collection of gesture processing input manipulators.

Parameters
manipulatorThe input manipulator to add to the gesture processing collection.
Since
Kanzi 3.9.0
void kanzi::InputManager::detachInputManipulator ( InputManipulator manipulator)

Removes an input manipulator from the collection of gesture processing input manipulators.

Parameters
manipulatorThe input manipulator to remove from the gesture processing collection.
Since
Kanzi 3.9.0
void kanzi::InputManager::updateHoverStates ( const PointerEvent pointerEvent,
Node2D node 
)

Processes pointer events to update hover states of the nodes in a subtree of the passed node.

Parameters
pointerEventPointer event to process.
nodeThe node where the hit testing starts.
Screen* kanzi::InputManager::getScreen ( ) const

Gets the Screen node currently associated with the Input Manager.

Returns
Pointer to the Screen that is associated with the Input Manager. If the input manager is not attached with a Screen, returns nullptr.
Since
Kanzi 3.9.6

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