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
itemsstring[]
Properties
Count
Number of items.
public int Count { get; }
Property Value
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
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
IsMenuOpen
true while the menu is open.
public bool IsMenuOpen { get; }
Property Value
Items
Item texts (null = parameter state labels).
public IReadOnlyList<string>? Items { get; set; }
Property Value
Labels
Item labels in effect.
public IReadOnlyList<string> Labels { get; }
Property Value
Placeholder
Text shown when there are no items.
public string? Placeholder { get; set; }
Property Value
SelectedIndex
Selected item index.
public int SelectedIndex { get; set; }
Property Value
SelectedText
Selected item text (null when empty).
public string? SelectedText { get; }
Property Value
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
Methods
BuildMenu()
Builds the menu entries (override to add custom entries).
protected virtual IList<MenuItem> BuildMenu()
Returns
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
OnMouseWheel(MouseEventArgs)
Mouse wheel over the element.
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
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
dcDrawingContextwidgetRectstyleVectorStyle