Class RockerSwitch
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
Momentary rocker (−1 / 0 / +1): pressing one half raises Stepped and springs back on release. Bound to a parameter, each step moves it by one discrete step (or ContinuousStep). Typical uses: preset increment/decrement, octave shift, fine tuning.
public class RockerSwitch : Control
- Inheritance
-
RockerSwitch
- Inherited Members
Constructors
RockerSwitch()
Creates a rocker switch.
public RockerSwitch()
Properties
ContinuousStep
Normalized increment for continuous parameters.
public double ContinuousStep { get; set; }
Property Value
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
Orientation
Rocker direction: vertical (up = +1) or horizontal (right = +1).
public Orientation Orientation { get; set; }
Property Value
Parameter
Optional parameter incremented / decremented by the rocker.
public IParameter? Parameter { get; set; }
Property Value
RepeatWhileHeld
Repeats the step while held.
public bool RepeatWhileHeld { get; set; }
Property Value
State
Current position: −1, 0 or +1.
public int State { get; }
Property Value
ValueText
Text drawn in the value area (null = no value area).
public override string? ValueText { get; }
Property Value
Wrap
Wraps around at the ends (discrete parameters).
public bool Wrap { get; set; }
Property Value
Methods
GetSkinState(Rect)
State passed to skins.
protected override SkinState GetSkinState(Rect widgetBounds)
Parameters
widgetBoundsRect
Returns
OnAttached()
Called when the element joins a host (subscribe to external events here).
protected override void OnAttached()
OnCaptureLost()
The mouse capture was lost without a button release.
protected override void OnCaptureLost()
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
OnMouseUp(MouseEventArgs)
Mouse button released.
protected override void OnMouseUp(MouseEventArgs e)
Parameters
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle
Step(int)
Performs one step in a direction (+1 / −1), as if the user pressed the rocker.
public void Step(int direction)
Parameters
directionint
Events
Stepped
Raised with +1 or −1 on every step (including auto-repeat).
public event Action<RockerSwitch, int>? Stepped