Class Button
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
Momentary push button with text and/or icon (bitmap, SVG or vector callback). Raises Click on release over the button (or repeatedly while held when RepeatWhileHeld), and can drive a parameter as a momentary switch (1 while pressed, 0 when released).
public class Button : Control
- Inheritance
-
Button
- Inherited Members
Constructors
Button()
Creates a button.
public Button()
Button(string, Action?)
Creates a button with a caption and an optional click action.
public Button(string text, Action? clicked = null)
Parameters
Properties
Appearance
Visual variant.
public ButtonAppearance Appearance { get; set; }
Property Value
Clicked
Action invoked on click (command style).
[Browsable(false)]
public Action? Clicked { get; set; }
Property Value
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
IconRenderer
Vector icon callback: draws into the icon rectangle with the given foreground color.
[Browsable(false)]
public Action<DrawingContext, Rect, Color>? IconRenderer { get; set; }
Property Value
IconSize
Icon size in DIPs.
public float IconSize { get; set; }
Property Value
Image
Bitmap icon (drawn left of the text, or centered without text).
public ImageSource? Image { get; set; }
Property Value
Parameter
Optional parameter driven as a momentary switch (1 while pressed).
public IParameter? Parameter { get; set; }
Property Value
RepeatDelay
Delay before auto-repeat starts (seconds).
public double RepeatDelay { get; set; }
Property Value
RepeatInterval
Auto-repeat interval (seconds).
public double RepeatInterval { get; set; }
Property Value
RepeatWhileHeld
Fires Click on press, then repeatedly while held.
public bool RepeatWhileHeld { get; set; }
Property Value
ShowContentOverSkin
Draws the text and icon over a Skin (bitmap frames without baked-in text).
public bool ShowContentOverSkin { get; set; }
Property Value
Svg
SVG icon.
public SvgImage? Svg { get; set; }
Property Value
Text
Caption drawn inside the button.
public string? Text { get; set; }
Property Value
TextStyle
Text style (null = theme normal text, centered, medium weight).
public TextStyle? TextStyle { get; set; }
Property Value
Methods
ForegroundColor(VectorStyle)
Foreground color for the current state.
protected Color ForegroundColor(VectorStyle style)
Parameters
styleVectorStyle
Returns
OnCaptureLost()
The mouse capture was lost without a button release.
protected override void OnCaptureLost()
OnClick()
Called on every click (after the events).
protected virtual void OnClick()
OnDetached()
Called when the element leaves its host (unsubscribe here).
protected override void OnDetached()
OnKeyDown(KeyEventArgs)
Key pressed while focused (bubbles to parents).
protected override void OnKeyDown(KeyEventArgs e)
Parameters
OnMouseDown(MouseEventArgs)
Mouse button pressed over the element (or captured).
protected override void OnMouseDown(MouseEventArgs e)
Parameters
OnMouseMove(MouseEventArgs)
Mouse moved over the element (or captured).
protected override void OnMouseMove(MouseEventArgs e)
Parameters
OnMouseUp(MouseEventArgs)
Mouse button released.
protected override void OnMouseUp(MouseEventArgs e)
Parameters
OnRender(DrawingContext)
Draws the element (below its children).
protected override void OnRender(DrawingContext dc)
Parameters
PerformClick()
Raises the click (also callable from code).
public void PerformClick()
RenderContent(DrawingContext, Rect, Color)
Draws icon and text centered in r.
protected virtual void RenderContent(DrawingContext dc, Rect r, Color foreground)
Parameters
dcDrawingContextrRectforegroundColor
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle
Events
Click
Raised when the button is clicked.
public event Action<Button>? Click