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

#
public DropDown(Nomen nomen, Action<T> callback = null)
Create a new drop down item.
nomen (Nomen)Name and description of the item as a whole.
callback (Action<T> = 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

public Bar Bar { get; }
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.
inherited fromBarItem

Bounds

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

Enabled

public bool Enabled { get; set; }
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.
inherited fromBarItem

Icon

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

KeyCode

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

MaximumWidth

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

MinimumWidth

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

Nomen

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

OffColour

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

OnColour

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

Value

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

Methods

AddOption

#
public void AddOption(T value, Nomen nomen)
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.
value (T)Value of the option.
nomen (Nomen)Name and description of the option.

CreateOutline

protected GraphicsPath CreateOutline()
inherited fromBarItem

CreateOutline

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

Draw

public void Draw(Context context)
inherited fromBarItem
context (Context)

DrawDisabled

#
protected override void DrawDisabled(Context context)
context (Context)

DrawFocus

#
protected override void DrawFocus(Context context)
context (Context)

DrawHover

#
protected override void DrawHover(Context context)
context (Context)

DrawIcon

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

DrawIcon

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

DrawIconAndText

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

DrawNormal

#
protected override void DrawNormal(Context context)
context (Context)

DrawText

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

FindGroupByChapter<T>

protected T[] 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.
inherited fromBarItem

FindGroupBySection<T>

protected T[] 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.
inherited fromBarItem

HasNeighbourToTheLeft

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

HasNeighbourToTheRight

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

IsEnabled

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

KeyDown

public virtual Response KeyDown(KeyEventArgs e)
inherited fromBarItem
e (KeyEventArgs)

KeyUp

public virtual Response KeyUp(KeyEventArgs e)
inherited fromBarItem
e (KeyEventArgs)

Layout

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

MouseDoubleClick

public virtual Response MouseDoubleClick(MouseEventArgs e)
inherited fromBarItem
e (MouseEventArgs)

MouseDown

#
public override Response MouseDown(MouseEventArgs e)
e (MouseEventArgs)

MouseLeave

#
public override Response MouseLeave(MouseEventArgs e)
e (MouseEventArgs)

MouseMove

#
public override Response MouseMove(MouseEventArgs e)
e (MouseEventArgs)

MouseUp

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

NeighbourToTheLeft

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

NeighbourToTheRight

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

OverrideInfo

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

OverrideText

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

SetSizeLimits

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

SetValue

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

ShowMenu

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

ShowTooltipAt

#
public override bool ShowTooltipAt(PointF location)
location (PointF)

TextInput

public virtual Response TextInput(TextInputEventArgs e)
inherited fromBarItem
e (TextInputEventArgs)

Events

ValueChanged

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