Table of Contents

Class ABCompareBar

Namespace
PluginUI
Assembly
PluginUI.dll

A/B comparison bar: two slots holding complete settings, switched with one click, plus a "copy to the other slot" button. Works on a list of parameters (Parameters) or on any custom state (CaptureState / RestoreState).

public class ABCompareBar : Control
Inheritance
ABCompareBar
Inherited Members

Examples

var ab = new ABCompareBar { Parameters = Parameters.All };   // PluginEditorView: every bound parameter

Remarks

The selected slot is always the live state of the plugin. Switching stores it and restores the other slot (the first switch to B starts from a copy of A). Restoring goes through normal edit gestures, so the host records it.

Constructors

ABCompareBar()

Creates an A/B bar.

public ABCompareBar()

Properties

CaptureState

Custom state capture (e.g. the whole plugin state as bytes); overrides Parameters.

[Browsable(false)]
public Func<object?>? CaptureState { get; set; }

Property Value

Func<object>

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

IsB

true when slot B is the live one.

[Browsable(false)]
public bool IsB { get; }

Property Value

bool

Parameters

Parameters compared (used when CaptureState is null).

[Browsable(false)]
public IReadOnlyList<IParameter>? Parameters { get; set; }

Property Value

IReadOnlyList<IParameter>

RestoreState

Custom state restore, paired with CaptureState.

[Browsable(false)]
public Action<object?>? RestoreState { get; set; }

Property Value

Action<object>

Methods

CopyToOther()

Copies the live slot into the other one.

public void CopyToOther()

GetToolTipText()

Tooltip actually shown: ToolTip by default. Override to supply a computed or localized text (for example from Strings) when ToolTip is not set.

protected override string? GetToolTipText()

Returns

string

The text to show, or null / empty for no tooltip.

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseLeave()

The mouse left the element.

protected override void OnMouseLeave()

OnMouseMove(MouseEventArgs)

Mouse moved over the element (or captured).

protected override void OnMouseMove(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

Select(bool)

Makes slot A (false) or B (true) live.

public void Select(bool b)

Parameters

b bool

true for B.

Events

SlotChanged

Raised after the live slot changed.

public event Action<ABCompareBar>? SlotChanged

Event Type

Action<ABCompareBar>