The "solid while moving, blinking while still" state machine.
More...
#include <caret.hpp>
|
| | CaretBlink () noexcept |
| | Adopts default_caret_blink() as it stands at construction, so an app that sets a process-wide default before building its view tree gets it.
|
| void | set_config (const CaretBlinkConfig &config) noexcept |
| const CaretBlinkConfig & | config () const noexcept |
| void | keep_solid () noexcept |
| | The caret moved or the text changed: show it, and restart the hold.
|
| void | reset () noexcept |
| | Focus gained: solid, with the blink phase rewound.
|
| void | advance (float dt) noexcept |
| | Advance real time by dt seconds.
|
| bool | visible () const noexcept |
| | True when the caret should be painted this frame.
|
| bool | holding_solid () const noexcept |
| | True while the post-movement solid hold is still running.
|
The "solid while moving, blinking while still" state machine.
Owns no clock. The widget advances it from a FrameClock subscription held while focused, and calls keep_solid() from every movement and edit path. visible() answers only the blink question — the caller is still responsible for not painting a caret on an unfocused widget.
◆ CaretBlink()
| pulp::view::CaretBlink::CaretBlink |
( |
| ) |
|
|
noexcept |
Adopts default_caret_blink() as it stands at construction, so an app that sets a process-wide default before building its view tree gets it.
◆ advance()
| void pulp::view::CaretBlink::advance |
( |
float | dt | ) |
|
|
noexcept |
Advance real time by dt seconds.
Consumes the solid hold first, so a single large dt cannot skip over it.
◆ config()
◆ holding_solid()
| bool pulp::view::CaretBlink::holding_solid |
( |
| ) |
const |
|
inlinenoexcept |
True while the post-movement solid hold is still running.
Exposed for tests and for widgets that suppress an unrelated animation while the user is actively navigating.
◆ keep_solid()
| void pulp::view::CaretBlink::keep_solid |
( |
| ) |
|
|
noexcept |
The caret moved or the text changed: show it, and restart the hold.
◆ reset()
| void pulp::view::CaretBlink::reset |
( |
| ) |
|
|
noexcept |
Focus gained: solid, with the blink phase rewound.
◆ set_config()
◆ visible()
| bool pulp::view::CaretBlink::visible |
( |
| ) |
const |
|
noexcept |
True when the caret should be painted this frame.
Always true while the solid hold is running, while config().enabled is false, and under MotionPolicy::Off.
The documentation for this class was generated from the following file:
- /home/runner/work/pulp/pulp/core/view/include/pulp/view/caret.hpp