ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::InputController Struct Reference

Stateless per-node input dispatcher. More...

#include <InputController.hpp>

Public Member Functions

void updateFlags (Layout &node, bool selfBlocked, bool scrolling)
 Recompute the node's hovered / pressed / focused flags.
UIState computeNextState (const Layout &node) const
 Derive the UIState enum from the node's current state flags.
void fireCallbacks (Layout &node, UIState prev, UIState next, bool changed)
 Fire callbacks for state transitions and pointer events.
void handleKeyInput (Layout &node)
 Fire onClick on Enter or Space for the focused, keyboard- activatable node.

Detailed Description

Stateless per-node input dispatcher.

Member Function Documentation

◆ computeNextState()

UIState ZenitUI::InputController::computeNextState ( const Layout & node) const

Derive the UIState enum from the node's current state flags.

Order of precedence: Disabled > Pressed > Hover > Idle.

◆ updateFlags()

void ZenitUI::InputController::updateFlags ( Layout & node,
bool selfBlocked,
bool scrolling )

Recompute the node's hovered / pressed / focused flags.

Parameters
nodeNode whose flags are updated.
selfBlockedtrue when input to this node should be suppressed.
scrollingtrue while any ancestor is scrolling or the node itself is scrolling. In this mode, only focus is updated: hover / press are frozen so that a drag does not flicker buttons under the pointer.

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