Table of Contents

Class DropDown

Namespace
PluginUI
Assembly
PluginUI.dll

Drop-down list (combo box) for a discrete value: shows the selected item and a chevron, opens a menu with a check mark on the current item. Items come from Items or the parameter's state labels; names such as "Bass/Sub" are grouped into sub-menus when SubmenuSeparator is set. IsItemAvailable hides the items that do not apply in the current context (the menu omits them and the wheel and arrow keys skip them), without changing the indices of the others.

public class DropDown : ValueControl
Inheritance
DropDown
Inherited Members

Constructors

DropDown()

Creates a drop-down.

public DropDown()

DropDown(params string[])

Creates a drop-down with local items.

public DropDown(params string[] items)

Parameters

items string[]

Properties

Count

Number of items.

public int Count { get; }

Property Value

int

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

IsItemAvailable

Tells whether the item at an index can be chosen (null = all items). Unavailable items are left out of the menu and skipped by the wheel and the arrow keys; the selected item stays displayed even when it is unavailable.

[Browsable(false)]
public Func<int, bool>? IsItemAvailable { get; set; }

Property Value

Func<int, bool>

IsMenuOpen

true while the menu is open.

public bool IsMenuOpen { get; }

Property Value

bool

Items

Item texts (null = parameter state labels).

public IReadOnlyList<string>? Items { get; set; }

Property Value

IReadOnlyList<string>

Labels

Item labels in effect.

public IReadOnlyList<string> Labels { get; }

Property Value

IReadOnlyList<string>

Placeholder

Text shown when there are no items.

public string? Placeholder { get; set; }

Property Value

string

SelectedIndex

Selected item index.

public int SelectedIndex { get; set; }

Property Value

int

SelectedText

Selected item text (null when empty).

public string? SelectedText { get; }

Property Value

string

SubmenuSeparator

Character splitting item names into sub-menu groups (e.g. '/'), or null for a flat menu.

public char? SubmenuSeparator { get; set; }

Property Value

char?

ValueText

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

public override string? ValueText { get; }

Property Value

string

Methods

BuildMenu()

Builds the menu entries (override to add custom entries).

protected virtual IList<MenuItem> BuildMenu()

Returns

IList<MenuItem>

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

OnMouseWheel(MouseEventArgs)

Mouse wheel over the element.

protected override void OnMouseWheel(MouseEventArgs e)

Parameters

e MouseEventArgs

OpenMenu()

Opens the menu.

public void OpenMenu()

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