CustomValueItem class
#include <Jazz2/UI/Menu/MenuWidgets.h>
Setting row with a custom-drawn value.
Like ChoiceItem but draws its value through a caller-provided callback instead of plain text, for rows such as colour swatch pickers or a formatted identifier. Optionally cycles via OnChange (showing arrows) or activates via OnActivate (e.g., copying to the clipboard).
Base classes
- class Widget
- Base class of a menu widget.
Constructors, destructors, conversion operators
- CustomValueItem(StringView label, float height = 52.0f)
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.
- auto OnNavigate(const WidgetInput& input, IMenuContainer* root) -> bool override
- Handles navigation input; returns
trueif it was consumed. -
auto OnTouchEvent(const nCine::
TouchEvent& event, Vector2i viewSize, IMenuContainer* root) -> bool override - Handles a touch event; returns
trueif it was consumed. - void OnSelected() override
- Called when the widget becomes selected.
Public variables
- String Label
- Setting label.
- bool ReadOnly
- Whether the row is read-only (greyed, non-interactive).
- float ArrowSpacing
- Extra horizontal spacing of the
<>arrows. -
Function<void(IMenuContainer* root, float centerX, float y, std::
int32_t& charOffset, bool selected, bool readOnly)> DrawValue - Draws the value area (already offset below the label).
-
Function<void(std::
int32_t)> OnChange - If set, Left/Right/Fire cycle the value (direction -1/+1) and arrows are shown.
- Function<void()> OnActivate
- If set (and no OnChange), Fire activates the row.
- AnimatedValue Animation
- Selection animation progress.
- float Height
- Height of the item row.