class

MToggleSwitch

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

Public functions

ReturnsNameDescription
MIRI_WIDGET_ARGS
voidSetIsChecked
boolIsChecked
voidToggle
MiriVec2ComputeDesiredSize
int32_tOnPaint
CReplyOnMouseButtonDown
CReplyOnMouseButtonUp
CReplyOnMouseMove
voidOnMouseEnter
voidOnMouseLeave
boolCanCacheDesiredSizeThe track dimensions are the desired size; the knob animates inside it without touching layout.
boolCanRetainPaintRefused while the knob slides — that is a clock, and every frame of it is a different picture with nothing to invalidate on.
const char*GetTypeName
EAccessibleRoleGetAccessibleRole
std::stringGetAccessibleValue
boolIsFocusable
floatGetFocusRadius
floatGetTrackWidthtoggle.json's track and knob unless the host passed its own.
floatGetTrackHeight
floatGetKnobSize
floatGetKnobInset
boolOnActivate

Function details

MIRI_WIDGET_ARGS

C++
MIRI_WIDGET_ARGS(MToggleSwitch) MIRI_ATTR(bool, IsChecked) MIRI_ATTR(MiriColor, OnColor) MIRI_ATTR(MiriColor, OffColor) MIRI_ATTR(MiriColor, OnKnobColor) MIRI_ATTR(MiriColor, OffKnobColor) MIRI_ARG(float, TrackWidth) MIRI_ARG(float, TrackHeight) MIRI_ARG(float, KnobSize) MIRI_ARG(float, KnobInset) MIRI_EVENT(COnBoolChanged, OnCheckStateChanged) MIRI_WIDGET_ARGS_END() void Construct(const CArguments& args)

SetIsChecked

C++
void SetIsChecked(bool checked)

IsChecked

C++
bool IsChecked() const

Toggle

C++
void Toggle()

ComputeDesiredSize

C++
MiriVec2 ComputeDesiredSize(float scale) const 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

OnMouseMove

C++
CReply OnMouseMove(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

CanCacheDesiredSize

C++
bool CanCacheDesiredSize() const override

The track dimensions are the desired size; the knob animates inside it without touching layout.

CanRetainPaint

C++
bool CanRetainPaint() const override

Refused while the knob slides — that is a clock, and every frame of it is a different picture with nothing to invalidate on. SetChecked and the hover handlers already invalidate, so the settled frame after the slide cannot replay the knob from before it.

GetTypeName

C++
const char* GetTypeName() const override

GetAccessibleRole

C++
EAccessibleRole GetAccessibleRole() const override

GetAccessibleValue

C++
std::string GetAccessibleValue() const override

IsFocusable

C++
bool IsFocusable() const override

GetFocusRadius

C++
float GetFocusRadius() const override

GetTrackWidth

C++
float GetTrackWidth() const

toggle.json's track and knob unless the host passed its own.

GetTrackHeight

C++
float GetTrackHeight() const

GetKnobSize

C++
float GetKnobSize() const

GetKnobInset

C++
float GetKnobInset() const

OnActivate

C++
bool OnActivate() override
Generated from Miri/Widgets/MToggleSwitch.h via miri.json · Dec 5, 2026Version 1.1.0