Table of Contents

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

double

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

Orientation

Rocker direction: vertical (up = +1) or horizontal (right = +1).

public Orientation Orientation { get; set; }

Property Value

Orientation

Parameter

Optional parameter incremented / decremented by the rocker.

public IParameter? Parameter { get; set; }

Property Value

IParameter

RepeatWhileHeld

Repeats the step while held.

public bool RepeatWhileHeld { get; set; }

Property Value

bool

State

Current position: −1, 0 or +1.

public int State { get; }

Property Value

int

ValueText

Text drawn in the value area (null = no value area).

public override string? ValueText { get; }

Property Value

string

Wrap

Wraps around at the ends (discrete parameters).

public bool Wrap { get; set; }

Property Value

bool

Methods

GetSkinState(Rect)

State passed to skins.

protected override SkinState GetSkinState(Rect widgetBounds)

Parameters

widgetBounds Rect

Returns

SkinState

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

e KeyEventArgs

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle

Step(int)

Performs one step in a direction (+1 / −1), as if the user pressed the rocker.

public void Step(int direction)

Parameters

direction int

Events

Stepped

Raised with +1 or −1 on every step (including auto-repeat).

public event Action<RockerSwitch, int>? Stepped

Event Type

Action<RockerSwitch, int>