Button class Core
A push button over the shared ButtonWidget painter. The behaviours every hand-rolled copy had to reimplement are inherent here, once: the press ARMS (pressed look), the release over the same button FIRES (slide off = cancel), Space/Enter call the SAME endpoint, hover comes from the router, and the focus ring is drawn over whatever the painter produced.
Styling. The look comes from the style sheets (Select.Type<Button>()): background, border colour and width, corner radius, text colour, font size, weight and family, padding, shadow, opacity, the focus ring and - for the hover fade - the transition, each in the states hover, pressed, focus and disabled. The theme draws a quiet button; the classes primary and neutral give the other two. The text colour follows the state the button rests in, not the hover.
public sealed class Button : Control
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Control
Constructors
Button
public Button();
Properties
Click
public required Action Click { get; init; }The one endpoint — mouse release, Space and Enter all call it.
Cursor
public override GridCursor Cursor { get; }
DrawsOwnFocus
public override bool DrawsOwnFocus { get; }The control shows its focus itself (accent border, hover row, ring parameter). False = the host draws the shared default ring around Control.Bounds.
Focusable
public override bool Focusable { get; }Can this KIND of control hold the keyboard focus? Combined with the live probes in Control.CanTakeFocus.
Role
public override ControlRole Role { get; }What KIND of part this is for assistive technology — the automation peers translate it into their host's control type.
Spoken
public Func<string>? Spoken { get; init; }Spoken name when the LABEL is a glyph (↑ ↓ ✕). Default: the label.
Text
public required Func<string> Text { get; init; }The caption, asked each time it is drawn.
Visual
public ButtonVisual? Visual { get; init; }A look fixed in code. A preset (ButtonVisual.Primary) stands for its class (primary) and takes its colours from the theme's rules for it, so it follows every theme switch; what a visual sets beyond its preset (a with expression) weighs like a presentational hint - over the theme's rules, under every rule of the application's sheets. Null (the default) leaves the look to the sheets: the theme's quiet button, or a class in Control.Classes.
Methods
Invoke
public override bool Invoke();Act like a click on the part (a button fires, a checkbox flips, a menu row runs, a dropdown opens). False when the part has no action or is disabled.
Measure
public override LogSize Measure(LogSize available);The caption's width plus the padding, measured with the host's measure when the tree has one, estimated otherwise.
OnKey
public override bool OnKey(ArionKey key, ArionModifiers mods);Keys while focused. Return false to let the pane's fallback see the key.
OnPointerReleased
public override void OnPointerReleased(LogPoint p);
Render
public override void Render(IRenderSurface s, ControlFrame frame);
SpokenLabel
public override string? SpokenLabel();What a screen reader speaks when this control receives the focus. A control that cannot take the focus but answers here is READ: it becomes a text part.
