Jazz2::UI::Menu::CanvasWidget class

Row drawn entirely by a caller-provided callback.

Escape hatch for bespoke screens: the row's drawing and activation are delegated to callbacks, so a section can render arbitrary content (icons, multi-column rows, custom glows) while still living in the widget tree and getting selection, navigation, scrolling and transitions for free.

Base classes

class Widget
Base class of a menu widget.

Constructors, destructors, conversion operators

CanvasWidget(float height, bool focusable = true)

Public functions

auto GetHeight() const -> float override
Returns the height the widget occupies in a vertical layout.
void OnUpdate(float timeMult) override
Advances the widget's animations.
void Draw(IMenuContainer* root, Canvas* canvas, const Rectf& bounds, std::int32_t& charOffset) override
Draws the widget within the given bounds.
void Activate(IMenuContainer* root) override
Called when the widget is activated (e.g., by Fire or a tap).
auto OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize, IMenuContainer* root) -> bool override
Handles a touch event; returns true if it was consumed.
void OnSelected() override
Called when the widget becomes selected.

Public variables

Function<void(IMenuContainer* root, Canvas* canvas, const Rectf& bounds, std::int32_t& charOffset, bool selected, float animation)> OnDrawContent
Draws the row content within the given bounds.
Function<void()> OnActivate
Invoked when the row is activated (Fire or tap).
Function<void()> OnSelectedChanged
Invoked when the row becomes selected (e.g., for a live preview).
Function<void(Vector2i touchPos)> OnTouch
Invoked when the row is tapped, with the touch position in pixels (for bespoke hit-testing such as columns).
AnimatedValue Animation
Selection animation progress.
float Height
Height of the row.