MKeyCaptureField
- Module
- Miri
- Header
#include "Miri/Widgets/MKeyCaptureField.h"- Namespace
Miri
Properties
| Type | Name | Description |
|---|---|---|
MiriDelegate<void(const CInputChord&)> | OnChordCaptured | A captured keyboard chord; an empty chord means Backspace cleared it. |
MiriDelegate<void(const std::string&)> | OnExternalCaptured | A captured mouse button, wheel notch or gamepad button, by its cap label. |
MiriDelegate<void(const CKeyCaptureResult&)> | OnCaptured | Every finished capture, typed. Hosts that store mouse bindings read this; OnChordCaptured and OnExternalCaptured still fire as before. |
MiriDelegate<void()> | OnCaptureCancelled |
Public functions
| Returns | Name | Description |
|---|---|---|
MIRI_WIDGET_ARGS | ||
void | SetChord | |
const CInputChord& | GetChord | |
void | SetExternalLabel | A binding that is not a keyboard chord (a mouse or gamepad button), shown as one cap with this label. |
const std::string& | GetExternalLabel | |
void | SetConflict | Names the binding this one collides with; empty clears the conflict. |
void | SetLeadingIcon | A Lucide glyph drawn before the caps — the device the binding reads (keyboard, gamepad, mouse). |
bool | HasConflict | |
void | SetSelected | |
void | BeginCapture | Starts listening and takes keyboard focus, so the next key reaches this field and not the editor's shortcuts, however the capture was started (a click, Enter, or a host's "+" that just rebuilt the row). |
void | CancelCapture | |
void | SetEscapeKeys | Keys that cancel instead of binding (UE's EscapeKeys). |
void | SetClearKeys | Keys that clear the binding instead of binding. |
void | SetAllowModifierKeys | A lone Shift, Ctrl, Alt or Command released with nothing pressed in between becomes the binding (UE's bAllowModifierKeysAsSelectedKeys). |
void | SetAllowMouseCapture | The left button and the wheel become bindable while listening. |
bool | IsCapturing | |
void | CaptureExternal | Ends a capture with a non-keyboard binding (a gamepad button). |
std::vector<std::string> | Caps | The caps the field shows for its binding ("Ctrl", "Shift", "K"). |
EKeyCapState | GetState | The binding as the key-cap states name it: capturing, conflict, placeholder (nothing bound) or default. |
bool | IsFocusable | |
bool | ConsumesTab | |
bool | CapturesAllKeys | |
bool | OnActivate | |
float | GetFocusRadius | |
bool | CanRetainPaint | The capture prompt pulses on a clock, which a replay would freeze. |
MiriVec2 | ComputeDesiredSize | |
int32_t | OnPaint | |
CReply | OnMouseButtonDown | |
CReply | OnMouseWheel | |
CReply | OnKeyDown | |
CReply | OnKeyUp | |
void | OnFocusLost | |
const char* | GetTypeName | |
const char* | MouseButtonLabel |
Function details
MIRI_WIDGET_ARGS
MIRI_WIDGET_ARGS(MKeyCaptureField) MIRI_ARG(CInputChord, Chord) MIRI_ARG(std::string, CapturePrompt) MIRI_ARG(std::string, EmptyLabel) MIRI_WIDGET_ARGS_END() void Construct(const CArguments& args)SetChord
void SetChord(const CInputChord& chord)GetChord
const CInputChord& GetChord() constSetExternalLabel
void SetExternalLabel(const std::string& label)A binding that is not a keyboard chord (a mouse or gamepad button), shown as one cap with this label. SetChord clears it.
GetExternalLabel
const std::string& GetExternalLabel() constSetConflict
void SetConflict(const std::string& conflictsWith)Names the binding this one collides with; empty clears the conflict.
SetLeadingIcon
void SetLeadingIcon(const std::string& glyph)A Lucide glyph drawn before the caps — the device the binding reads (keyboard, gamepad, mouse). Empty draws none.
HasConflict
bool HasConflict() constSetSelected
void SetSelected(bool selected)BeginCapture
void BeginCapture()Starts listening and takes keyboard focus, so the next key reaches this field and not the editor's shortcuts, however the capture was started (a click, Enter, or a host's "+" that just rebuilt the row).
CancelCapture
void CancelCapture()SetEscapeKeys
void SetEscapeKeys(std::vector<EKey> keys)Keys that cancel instead of binding (UE's EscapeKeys). Empty lets Escape be bound; cancel is then a click elsewhere. Default: Escape.
SetClearKeys
void SetClearKeys(std::vector<EKey> keys)Keys that clear the binding instead of binding. Default: Backspace.
SetAllowModifierKeys
void SetAllowModifierKeys(bool allow)A lone Shift, Ctrl, Alt or Command released with nothing pressed in between becomes the binding (UE's bAllowModifierKeysAsSelectedKeys).
SetAllowMouseCapture
void SetAllowMouseCapture(bool allow)The left button and the wheel become bindable while listening.
IsCapturing
bool IsCapturing() constCaptureExternal
void CaptureExternal(const std::string& label)Ends a capture with a non-keyboard binding (a gamepad button).
Caps
std::vector<std::string> Caps() constThe caps the field shows for its binding ("Ctrl", "Shift", "K").
GetState
EKeyCapState GetState() constThe binding as the key-cap states name it: capturing, conflict, placeholder (nothing bound) or default.
IsFocusable
bool IsFocusable() const overrideConsumesTab
bool ConsumesTab() const overrideCapturesAllKeys
bool CapturesAllKeys() const overrideOnActivate
bool OnActivate() overrideGetFocusRadius
float GetFocusRadius() const overrideCanRetainPaint
bool CanRetainPaint() const overrideThe capture prompt pulses on a clock, which a replay would freeze.
ComputeDesiredSize
MiriVec2 ComputeDesiredSize(float scale) const overrideOnPaint
int32_t OnPaint(const CMiriPaintArgs& args, const CGeometry& geo, CMiriRenderer& renderer, int32_t layerId) const overrideOnMouseButtonDown
CReply OnMouseButtonDown(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseWheel
CReply OnMouseWheel(const CGeometry& geo, const CPointerEvent& event) overrideOnKeyDown
CReply OnKeyDown(const CGeometry& geo, const CKeyEvent& event) overrideOnKeyUp
CReply OnKeyUp(const CGeometry& geo, const CKeyEvent& event) overrideOnFocusLost
void OnFocusLost(const CFocusEvent& event) overrideGetTypeName
const char* GetTypeName() const overrideMouseButtonLabel
static const char* MouseButtonLabel(EMouseButton button)