DropDown<T>

BarItem
public sealed class DropDown<T> : BarItem
A tool bar item which shows the currently selected value of a fixed set of options, and opens a menu with all the options when clicked. It takes up a single slot where a row of mutually exclusive toggles would take one slot per option.
TType of option values, typically an enum.

Constructors

DropDown

#
Create a new drop down item.
public DropDown(
nomen,
Name and description of the item as a whole.
Action<T>
callback = null
Optional callback for when the user picks a different option.
)

Properties

AdjacentOnLeftSide

#
public override bool AdjacentOnLeftSide { get; }

AdjacentOnRightSide

#
public override bool AdjacentOnRightSide { get; }

Bar

Gets the toolbar this element is hosted on. This field may be null, but will be assigned by the Bar itself once this element is added to it.
public Bar Bar { get; }
inherited fromBarItem

Bounds

Gets the visible bounds for this element. These bounds are set by the BarItem.Bar during layout.
public Rectangle Bounds { get; }
inherited fromBarItem

Enabled

Gets or sets whether this element is enabled. Note that if the parent toolbar is disabled, this element is disabled by implication. Thus, use the BarItem.IsEnabled() function to determine the real state.
public bool Enabled { get; set; }
inherited fromBarItem

Icon

Gets the icon, if any, associated with this element.
public IIcon Icon { get; }
inherited fromBarItem

KeyCode

Gets or sets the shortcut key for this element. Whether or not this is actually used depends on the form hosting this toolbar.
public BarShortcut KeyCode { get; set; }
inherited fromBarItem

MaximumWidth

Gets the maximum width (in logical pixels) for this element.
public int MaximumWidth { get; }
inherited fromBarItem

MinimumWidth

Gets the minimum width (in logical pixels) for this element.
public int MinimumWidth { get; }
inherited fromBarItem

Nomen

Gets the nomen describing this element.
public Nomen Nomen { get; }
inherited fromBarItem

OffColour

Gets or sets the colour associated with the Off state, whenever meaningful.
public Color? OffColour { get; set; }
inherited fromBarItem

OnColour

Gets or sets the colour associated with the On state, whenever meaningful.
public Color? OnColour { get; set; }
inherited fromBarItem

Value

#
Gets the value of the selected option, or the default value if there are no options.
public T Value { get; }

Methods

AddOption

#
Add an option. Options appear in the menu in the order they are added. Consecutive options with a different chapter or section are separated by a line.
public void AddOption(
T
value,
Value of the option.
nomen
Name and description of the option.
)

CreateOutline

protected GraphicsPath CreateOutline()
inherited fromBarItem

CreateOutline

Create a new graphics path representing the outline of this item.
protected GraphicsPath CreateOutline(
roundedOnLeft,
True if path ought to have rounded corners on the left.
roundedOnRight
True if the path ought to have rounded corners on the right.
)
inherited fromBarItem

Draw

public void Draw(
context
)
inherited fromBarItem

DrawDisabled

#
protected override void DrawDisabled(
context
)

DrawFocus

#
protected override void DrawFocus(
context
)

DrawHover

#
protected override void DrawHover(
context
)

DrawIcon

Draw the icon (if any) into the given frame. An automatical 2-pixel paddding is created inside the frame.
protected bool DrawIcon(
context,
icon,
Rectangle
frame,
Color
background
)
inherited fromBarItem
True if an icon was drawn.

DrawIcon

Draw the icon (if any) into the given frame. An automatical 2-pixel paddding is created inside the frame.
protected bool DrawIcon(
context,
Rectangle
frame,
Color
background
)
inherited fromBarItem
True if an icon was drawn.

DrawIconAndText

protected bool DrawIconAndText(
context,
style,
text,
Color
background
)
inherited fromBarItem

DrawNormal

#
protected override void DrawNormal(
context
)

DrawText

Draw a string into the frame.
protected bool DrawText(
context,
Rectangle
frame,
text,
Color
background
)
inherited fromBarItem

FindGroupByChapter<T>

Collect all toolbar elements which share the same nomen chapter as this element. If there is only a single element (i.e. this one) then an empty array is returned.
protected T[] FindGroupByChapter<T>()
inherited fromBarItem

FindGroupBySection<T>

Collect all toolbar elements which share the same nomen section as this element, across every bar in the same Bar.Bundle. If there is only a single element (i.e. this one) then an empty array is returned.
protected T[] FindGroupBySection<T>()
inherited fromBarItem

HasNeighbourToTheLeft

Gets whether the item directly to the left of this item has an outline shape adjacent to this item.
protected bool HasNeighbourToTheLeft()
inherited fromBarItem

HasNeighbourToTheRight

Gets whether the item directly to the right of this item has an outline shape adjacent to this item.
protected bool HasNeighbourToTheRight()
inherited fromBarItem

IsEnabled

Gets whether both this element and the bar it belongs to are enabled.
public bool IsEnabled()
inherited fromBarItem

KeyDown

public virtual Response KeyDown(
KeyEventArgs
e
)
inherited fromBarItem

KeyUp

public virtual Response KeyUp(
KeyEventArgs
e
)
inherited fromBarItem

Layout

Layout the element. This method is called automatically whenever the BarItem.Bounds changes.
protected virtual void Layout()
inherited fromBarItem

MouseDoubleClick

public virtual Response MouseDoubleClick(
MouseEventArgs
e
)
inherited fromBarItem

MouseDown

#
public override Response MouseDown(
MouseEventArgs
e
)

MouseLeave

#
public override Response MouseLeave(
MouseEventArgs
e
)

MouseMove

#
public override Response MouseMove(
MouseEventArgs
e
)

MouseUp

#
public override Response MouseUp(
MouseEventArgs
e
)
BarItem.MouseUp

NeighbourToTheLeft

Gets whether this toolbar element has a neighbour directly to its left.
protected BarItem NeighbourToTheLeft(
skipSpacers = false
)
inherited fromBarItem

NeighbourToTheRight

Gets whether this toolbar element has a neighbour directly to its right.
protected BarItem NeighbourToTheRight(
skipSpacers = false
)
inherited fromBarItem

OverrideInfo

Override the info of the BarItem.Nomen field.
public void OverrideInfo(
newInfo
New info to assign.
)
inherited fromBarItem

OverrideText

Override the name of the BarItem.Nomen field.
public void OverrideText(
newName
New name to assign.
)
inherited fromBarItem

SetSizeLimits

Set the minimum and maximum width limits.
public void SetSizeLimits(
minimum,
maximum
)
inherited fromBarItem

SetValue

#
Select the option with the given value, without raising ValueChanged.
public bool SetValue(
T
value
)
True if an option with this value exists.

ShowMenu

#
Show the menu with all options underneath this item.
public void ShowMenu()

ShowTooltipAt

#
public override bool ShowTooltipAt(
PointF
location
)

TextInput

public virtual Response TextInput(
TextInputEventArgs
e
)
inherited fromBarItem

Events

ValueChanged

#
Raised when the user picks a different option. Not raised by SetValue(T).
public event EventHandler<T> ValueChanged