class

MButton

Module
Miri
Header
#include "Miri/Widgets/MButton.h"
Namespace
Miri

Public functions

ReturnsNameDescription
MIRI_WIDGET_ARGS
WidgetArgsType&AnimateHover
MIRI_ATTRicon, 8 px sides and a 4 px gap.
boolCanCacheDesiredSize
boolCanSkipArrange
boolCanRetainPaintThe hover fade is a clock: while it runs, every frame's background is a different colour with nothing to invalidate on.
MiriVec2ComputeDesiredSize
voidArrangeChildren
int32_tOnPaint
CReplyOnMouseButtonDown
CReplyOnMouseButtonUp
voidOnMouseEnter
voidOnMouseLeave
const char*GetTypeName
EAccessibleRoleGetAccessibleRole
boolIsFocusable
floatGetFocusRadius
boolOnActivate
voidSetStateBrushesCustom-variant buttons paint these instead of the style's brushes.
EMiriBrushStateGetBrushStateThe state the button is in for painting and for sounds: Disabled, then Pressed, Hovered, Focused, Selected, else Normal.
voidSetOnStateChangedFires when a pointer, press, focus, selection or enabled change moves the button to another state.
voidOnFocusReceived
voidOnEnabledChanged
voidOnFocusLost
voidSetOnClicked
voidSetOnPressedChanged
voidSetAnimateHover
EMiriButtonVariantGetVariant
voidSetLabel
const std::string&GetLabel
voidSetIconA Lucide glyph (MIRI_ICON_* or CMiriLucideIcons::Find).
voidSetSelectedThe latched state of an icon button (a snap toggle that is on).
boolIsSelected
floatGetHoverAmount0..1 progress of the hover and press transitions, timed by the MowoMotion Hover and Press tokens.
floatGetPressAmount
FVariantMetricsGetVariantMetrics

Function details

MIRI_WIDGET_ARGS

C++
MIRI_WIDGET_ARGS(MButton) MIRI_EVENT(COnClicked, OnClicked) MIRI_EVENT(COnBoolChanged, OnPressedChanged) bool _AnimateHover = true

AnimateHover

C++
WidgetArgsType& AnimateHover(bool value)

MIRI_ATTR

C++
MIRI_ATTR(MiriColor, ButtonColor) MIRI_ATTR(MiriColor, HoverColor) MIRI_ATTR(MiriColor, PressColor) MIRI_ATTR(float, CornerRadius) MIRI_ATTR(MiriMargin, ContentPadding) MIRI_ARG(EMiriButtonVariant, Variant) MIRI_ARG(std::string, Label) MIRI_ARG(std::string, Icon) MIRI_ARG(bool, IsSelected) MIRI_ARG(float, Height) MIRI_ARG(bool, Dense) MIRI_CONTENT(MButton, Content) MIRI_WIDGET_ARGS_END() void Construct(const CArguments& args)

icon, 8 px sides and a 4 px gap.

CanCacheDesiredSize

C++
bool CanCacheDesiredSize() const override

CanSkipArrange

C++
bool CanSkipArrange() const override

CanRetainPaint

C++
bool CanRetainPaint() const override

The hover fade is a clock: while it runs, every frame's background is a different colour with nothing to invalidate on. Settled, the tint is a pure function of the press flag and the style set, both of which announce themselves. The enter/leave handlers drop the slice so the pre-hover picture cannot come back once the fade lands.

ComputeDesiredSize

C++
MiriVec2 ComputeDesiredSize(float scale) const override

ArrangeChildren

C++
void ArrangeChildren(const CGeometry& geo) override

OnPaint

C++
int32_t OnPaint(const CMiriPaintArgs& args, const CGeometry& geo, CMiriRenderer& renderer, int32_t layerId) const override

OnMouseButtonDown

C++
CReply OnMouseButtonDown(const CGeometry& geo, const CPointerEvent& event) override

OnMouseButtonUp

C++
CReply OnMouseButtonUp(const CGeometry& geo, const CPointerEvent& event) override

OnMouseEnter

C++
void OnMouseEnter(const CGeometry& geo, const CPointerEvent& event) override

OnMouseLeave

C++
void OnMouseLeave(const CPointerEvent& event) override

GetTypeName

C++
const char* GetTypeName() const override

GetAccessibleRole

C++
EAccessibleRole GetAccessibleRole() const override

IsFocusable

C++
bool IsFocusable() const override

GetFocusRadius

C++
float GetFocusRadius() const override

OnActivate

C++
bool OnActivate() override

SetStateBrushes

C++
void SetStateBrushes(const FMiriStateBrushes& brushes)

Custom-variant buttons paint these instead of the style's brushes. A state with none falls back to Normal; an empty set restores the style.

GetBrushState

C++
EMiriBrushState GetBrushState() const

The state the button is in for painting and for sounds: Disabled, then Pressed, Hovered, Focused, Selected, else Normal.

SetOnStateChanged

C++
void SetOnStateChanged(std::function<void(EMiriBrushState)> callback)

Fires when a pointer, press, focus, selection or enabled change moves the button to another state. Releasing a press back to Hovered is silent.

OnFocusReceived

C++
void OnFocusReceived(const CFocusEvent& event) override

OnEnabledChanged

C++
void OnEnabledChanged() override

OnFocusLost

C++
void OnFocusLost(const CFocusEvent& event) override

SetOnClicked

C++
void SetOnClicked(std::function<void()> func)

SetOnPressedChanged

C++
void SetOnPressedChanged(std::function<void(bool)> func)

SetAnimateHover

C++
void SetAnimateHover(bool animate)

GetVariant

C++
EMiriButtonVariant GetVariant() const

SetLabel

C++
void SetLabel(const std::string& label)

GetLabel

C++
const std::string& GetLabel() const

SetIcon

C++
void SetIcon(const std::string& glyph)

A Lucide glyph (MIRI_ICON_* or CMiriLucideIcons::Find).

SetSelected

C++
void SetSelected(bool selected)

The latched state of an icon button (a snap toggle that is on).

IsSelected

C++
bool IsSelected() const

GetHoverAmount

C++
float GetHoverAmount() const

0..1 progress of the hover and press transitions, timed by the MowoMotion Hover and Press tokens.

GetPressAmount

C++
float GetPressAmount() const

GetVariantMetrics

C++
static FVariantMetrics GetVariantMetrics(EMiriButtonVariant variant)
Generated from Miri/Widgets/MButton.h via miri.json · Dec 5, 2026Version 1.1.0