Jazz2::UI::Menu::Widget class

Base class of a menu widget.

Building block of the declarative menu layout. A widget draws itself within a given rectangle, advances its animations, and optionally reacts to navigation or touch. Containers such as StackLayout and ScrollView arrange and drive their children, while leaves such as ListItem render content through the shared menu painters.

Derived classes

class CanvasWidget
Row drawn entirely by a caller-provided callback.
class ChoiceItem
Setting row that cycles through values.
class CustomValueItem
Setting row with a custom-drawn value.
class ListContainer
Base of vertical lists of selectable children.
class ListItem
Selectable text item.
class Slider
Setting row with a value bar adjusted left/right.
class TextInput
Editable text row.

Constructors, destructors, conversion operators

Widget()
~Widget() virtual

Public functions

auto GetHeight() const -> float virtual
Returns the height the widget occupies in a vertical layout.
void OnUpdate(float timeMult) virtual
Advances the widget's animations.
void Draw(IMenuContainer* root, Canvas* canvas, const Rectf& bounds, std::int32_t& charOffset) virtual
Draws the widget within the given bounds.
auto OnNavigate(const WidgetInput& input, IMenuContainer* root) -> bool virtual
Handles navigation input; returns true if it was consumed.
auto OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize, IMenuContainer* root) -> bool virtual
Handles a touch event; returns true if it was consumed.
void Activate(IMenuContainer* root) virtual
Called when the widget is activated (e.g., by Fire or a tap).
void OnSelected() virtual
Called when the widget becomes selected.
auto OnKeyPressed(const nCine::KeyboardEvent& event, IMenuContainer* root) -> bool virtual
Handles a key press while capturing text input; returns true if consumed.
void OnTextInput(const nCine::TextInputEvent& event) virtual
Handles a text input event while capturing text input.
auto IsCapturingInput() const -> bool virtual
Returns true while the widget (or a descendant) is capturing raw text input, which restricts navigation.

Public variables

Rectf Bounds
Rectangle the widget was last drawn in (used for touch hit-testing).
bool Focusable
Whether the widget can receive selection.
bool Selected
Whether the widget is currently selected (set by the parent before drawing).
bool Visible
Whether the widget is laid out and drawn.