// Generated API outline. Implementation bodies omitted.
#nullable enable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Threading;
using System;
using nfloat = System.Runtime.InteropServices.NFloat;
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.ToolKit.UI.Layer;
///
/// A button that consumes design system tokens for colors, shape, and typography.
/// Supports (Filled, Outline, Text) and hover/pressed states.
///
public partial class Button
{
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
/// Override to animate this view and its children.
protected override void AnimateCore(TimeSpan previous, TimeSpan current);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
using Xui.ToolKit.UI.Layer;
///
/// A button that consumes design system tokens for colors, shape, and typography.
/// Supports (Filled, Outline, Text) and hover/pressed states.
///
public partial class Button : View, IDesignSystemChangeNotifications
{
/// Creates a new button with content-sized alignment.
public Button();
/// The button label text.
public string Text { get; set; }
/// Optional label size override; otherwise uses the design system.
public nfloat? FontSize { get; set; }
/// Optional shape override; otherwise uses the design system.
public CornerRadius? CornerRadius { get; set; }
/// Which color group to use. Default is Primary.
public ColorRole Role { get; set; }
/// Visual weight of the button. Default is Filled.
public ButtonVariant Variant { get; set; }
/// Horizontal alignment of the button label. Default is centered.
public TextAlign LabelTextAlign { get; set; }
/// Invoked when the button is clicked.
public Action? Clicked { get; set; }
/// Raised once when press recognition allows the highlight to appear. The gesture may still cancel.
public event Action? ClickMaybe;
/// Raised on a valid release, before Click. Start nonblocking preparation here.
public event Action? ClickFarFetch;
/// Raised when the committed click executes, before the compatibility Clicked callback.
public event Action? Click;
/// Waits for a highlighted render and the following animation tick before executing a quick click.
public bool WaitForPressFeedback { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
/// The area available to the label, before applying the design system's padding.
protected virtual Rect LabelBounds { get; }
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A horizontal group of buttons that share a continuous border.
/// Supports (Filled, Outline, Text) and single selection.
///
public class ButtonGroup : ViewCollection, IDesignSystemChangeNotifications
{
/// Gets or sets the selected button index (0-based).
public int SelectedIndex { get; set; }
/// Invoked when the selection changes.
public Action? SelectionChanged { get; set; }
/// Which color group to use. Default is Primary.
public ColorRole Role { get; set; }
/// Visual style. Default is Outline.
public ButtonVariant Variant { get; set; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
///
/// A single item inside a . Renders only text — the group draws backgrounds.
///
public class ButtonGroupItem : View, IDesignSystemChangeNotifications
{
/// The item label.
public string Text { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
///
/// A card-like container with a clickable title that expands/collapses its content
/// with an animated transition. Consumes motion tokens from the design system.
///
public class Expander : View, IDesignSystemChangeNotifications
{
/// The title text shown in the header.
public string Title { get; set; }
/// Gets or sets whether the expander is expanded.
public bool IsExpanded { get; set; }
/// The content view shown when expanded.
public View? Content { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to animate this view and its children.
protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime);
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
///
/// Controls the visual weight of a button.
///
public enum ButtonVariant
{
/// Filled background — highest visual weight. Default for primary actions.
Filled,
/// Outline border only — medium visual weight. For secondary/grouped actions.
Outline,
/// Text only — lowest visual weight. Background appears on hover/press only.
Text,
}
///
/// Selects which color group from the design system a widget should use.
///
public enum ColorRole
{
/// Brand / primary action colors.
Primary,
/// Supporting / secondary action colors.
Secondary,
/// Tertiary highlight / accent colors.
Tertiary,
/// Warning / caution state colors.
Warning,
/// Error / destructive state colors.
Error,
/// Low-contrast neutral colors for quiet buttons, toolbars, etc.
Neutral,
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas.Composition.Graphics;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
using Xui.ToolKit.UI.Drawing;
///
/// A card container that uses design system tokens for background, outline, shape, and padding.
/// By default uses Surface colors. Set to use a specific color group.
///
public class Card : View, IDesignSystemChangeNotifications
{
/// Content inset. Null uses the design system spacing; zero allows content to reach the card edges.
public nfloat? Padding { get; set; }
/// Clips content to the rounded card outline, useful for content that reaches the edges.
public bool ClipContent { get; set; }
/// Use a keyed native surface for this card's outline, shadow, and content.
public bool UseCompositionGroup { get; set; }
/// Outer shadow fade distance. Zero disables the shadow; layout size is unchanged.
public nfloat ShadowExtent { get; set; }
/// Color and opacity at the shadow's inner edge.
public Color ShadowColor { get; set; }
///
/// Gets this view's conservative bounds in its parent coordinate space for render culling.
///
///
/// A container may override this when its rendered geometry differs from its layout frame.
/// Computing the union of descendant culling frames is deliberately deferred: it can be
/// more expensive than rendering for small subtrees.
///
public override Rect CullingFrame { get; }
/// The content view inside the card.
public View? Content { get; set; }
///
/// When null, the card uses Surface colors. When set, uses the specified color group's
/// Container/OnContainer as background/foreground.
///
public ColorRole? Role { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using System.Runtime.InteropServices;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A checkbox with a checkmark drawn via path commands.
/// Consumes design system tokens for colors, shape, and sizing.
///
public class Checkbox : View, IDesignSystemChangeNotifications
{
/// Gets or sets whether the checkbox is checked.
public bool IsChecked { get; set; }
/// Invoked when the checked state changes.
public Action? Changed { get; set; }
/// Creates a checkbox with content-sized alignment.
public Checkbox();
/// Gets the number of child views, which is always zero.
public override int Count { get; }
/// Gets a child view by index.
/// Always thrown because a checkbox has no child views.
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Measures the checkbox using its design-system-defined square size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Renders the checkbox box, border, and optional checkmark.
protected override void RenderCore(IContext context);
/// Updates pointer feedback and toggles the checked state on a completed tap.
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
///
/// A radio button (circle with filled dot when selected).
/// Consumes design system tokens for colors and sizing.
///
public class RadioButton : View, IDesignSystemChangeNotifications
{
/// Gets or sets whether the radio button is selected.
public bool IsSelected { get; set; }
/// Invoked when the selection state changes.
public Action? Changed { get; set; }
/// Creates a radio button with content-sized alignment.
public RadioButton();
/// Gets the number of child views, which is always zero.
public override int Count { get; }
/// Gets a child view by index.
/// Always thrown because a radio button has no child views.
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Measures the radio button using its design-system-defined diameter.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Renders the selected or unselected radio-button indicator.
protected override void RenderCore(IContext context);
/// Updates pointer feedback and selects the button on a completed tap.
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
///
/// A toggle switch that slides a thumb circle between on/off positions.
/// Consumes design system tokens for colors, shape, and sizing.
///
public class Toggle : View, IDesignSystemChangeNotifications
{
/// Gets or sets whether the toggle is on.
public bool IsOn { get; set; }
/// Invoked when the toggle value changes.
public Action? Changed { get; set; }
/// Creates a toggle with content-sized alignment.
public Toggle();
/// Gets the number of child views, which is always zero.
public override int Count { get; }
/// Gets a child view by index.
/// Always thrown because a toggle has no child views.
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Measures the toggle using its design-system-defined track dimensions.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Renders the toggle track and thumb for its current state.
protected override void RenderCore(IContext context);
/// Updates pointer feedback and changes the toggle value on a completed tap.
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.DI;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A vertical list with selectable items, internally scrollable.
/// Each supports hover and selection states
/// using design system tokens.
///
public class ListView : View, IDesignSystemChangeNotifications
{
/// Gets or sets the selected item index (-1 for no selection).
public int SelectedIndex { get; set; }
/// Invoked when the selection changes.
public Action? SelectionChanged { get; set; }
/// Which color group to use for selection. Default is Primary.
public ColorRole Role { get; set; }
/// Initializes a list view with an internal scrollable content container.
public ListView();
///
/// The items to display. Set via collection initializer.
///
public ReadOnlySpan Content { init; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
///
/// A single selectable item inside a .
/// Renders hover/selection backgrounds and hosts a content view.
///
public class ListViewItem : View, IDesignSystemChangeNotifications
{
/// The content view displayed inside this item.
public View? ItemContent { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI.Layer;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A design-system-aware text input. Uses the same
/// + layer stack as , but fills all visual
/// properties from tokens instead of exposing them individually.
///
public class TextInput : LayerView>, IDesignSystemChangeNotifications, ITextEditingClient
{
/// Creates a text input with shared native editing state.
public TextInput();
///
/// Gets whether this view can receive keyboard focus via Tab navigation.
///
public override bool Focusable { get; }
/// Keyboard hints, applied when this field receives focus.
public TextInputOptions InputOptions { get; set; }
/// Whether a keyboard action is currently available.
public bool CanPerformInputAction(TextInputAction action);
/// Handles a keyboard action, including focus navigation or finishing editing.
public void PerformInputAction(TextInputAction action);
/// The document and selection shared with the native input system.
public Xui.Core.UI.Input.TextEditingState Editor { get; }
/// Whether a native interaction owns caret, selection handles, and touch selection.
public bool NativeSelection { get; set; }
/// The input's hit-test bounds, in logical window coordinates.
public Rect InputBounds { get; }
/// Returns the caret rectangle for a UTF-16 offset, in logical window coordinates.
public Rect GetCaretRect(int offset, ITextMeasureContext measure);
/// Hit-tests a logical window point, returning a UTF-16 grapheme boundary.
public int GetTextPosition(Point point, ITextMeasureContext measure);
/// Whether the input contains any text.
public bool HasText { get; }
/// Gets or sets the text content.
public string Text { get; set; }
/// Gets or sets whether input is masked as a password.
public bool IsPassword { get; set; }
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size availableSize, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
}
}