public sealed class Bar : IResponsive, IBundleAware
A collection of option and toggle buttons.

Constructors

Bar

#
public Bar()
Create an empty tool bar.

Bar

#
public Bar(params BarItem[] elements)
Create a populated tool bar.
elements (params BarItem[])

Fields

CategoryHeight

#
public const int CategoryHeight = 12
Gets the height of the category label area underneath the bar.

DefaultElementHeight

#
public const int DefaultElementHeight = 20
Default height of the element portion of the bar.

Properties

ActiveElements

#
public IEnumerable<BarItem> ActiveElements { get; }
Enumerate over all elements in this bar that are not spacers.

Bounds

#
public Rectangle Bounds { get; set; }
Gets or sets the bounds for this bar.

Bundle

#
public Bundle<Bar> Bundle { get; set; }
Gets the bundle which contains this toolbar.

Count

#
public int Count { get; }
Gets the number of elements on this bar.

ElementHeight

#
public int ElementHeight { get; set; }
Gets or sets the height of the element portion of the bar. Default value is designed to give a 16x16 icon when subtracting two pixels from the edges.

Elements

#
public IEnumerable<BarItem> Elements { get; }
Enumerate over all elements in this bar.

Enabled

#
public bool Enabled { get; set; }
Gets or sets the enabled state of this bar.

Height

#
public int Height { get; }
Gets the height of this toolbar.

MaximumWidth

#
public int MaximumWidth { get; }
Gets the maximum width of this toolbar.

MinimumWidth

#
public int MinimumWidth { get; }
Gets the minimum width of this toolbar.

Responder

#
public Responses Responder { get; }
Responder

Style

#
public BarStyle Style { get; set; }
Gets or sets the style of this toolbar.

Indexers

this[]

#
public BarItem this[int index] { get; }
Gets the element at the given index.
index (int)

this[]

#
public BarItem this[string name] { get; }
Gets the element with the given name, not including spacers.
name (string)Nomen.Name of element to find.

Methods

Add

#
public void Add(BarItem element)
Add an element to this toolbar.
element (BarItem)

AddColours

#
public void AddColours(Nomen nomen, Family[] spectrum, Family initial, Action<Family> assignment)
Add a series of RadioToggle options to this bar. This also sets the style to not display categories and the element height to 16.
nomen (Nomen)Nomen with '{family}' placeholders for colour family name.
spectrum (OpenColor.Family[])Spectrum of all colours to apply.
initial (OpenColor.Family)Family to select.
assignment (Action<OpenColor.Family>)Assignment action.

AddCoolColours

#
public void AddCoolColours(Nomen nomen, Family initial, Action<Family> assignment)
Add a series of RadioToggle options to this bar representing the standard cool (blue/purple) colours. This also sets the style to not display categories and the element height to 16.
nomen (Nomen)Nomen with '{family}' placeholders for colour family name.
initial (OpenColor.Family)Family to select.
assignment (Action<OpenColor.Family>)Assignment action.

AddLifeColours

#
public void AddLifeColours(Nomen nomen, Family initial, Action<Family> assignment)
Add a series of RadioToggle options to this bar representing the standard neutral (green) colours. This also sets the style to not display categories and the element height to 16.
nomen (Nomen)Nomen with '{family}' placeholders for colour family name.
initial (OpenColor.Family)Family to select.
assignment (Action<OpenColor.Family>)Assignment action.

AddPushButton

#
public PushButton AddPushButton(IIcon icon, Nomen nomen, Action callback = null, BarShortcut keys = null)
Add a button to this bar.
icon (IIcon)
nomen (Nomen)
callback (Action = null)
keys (BarShortcut = null)
Button which was added.

AddRadioToggle

#
public RadioToggle AddRadioToggle(IIcon icon, Nomen nomen, bool initial, Action<bool> callback = null, BarShortcut keys = null)
Add a push option to this bar.
icon (IIcon)
nomen (Nomen)
initial (bool)
callback (Action<bool> = null)
keys (BarShortcut = null)

AddSpacer

#
public Spacer AddSpacer(Nomen nomen, int minimumWidth = 5, int maximumWidth = 5)
Add a spacer to this bar.
nomen (Nomen)Optional nomen.
minimumWidth (int = 5)Minimum width.
maximumWidth (int = 5)Maximum width.
Spaces which was added.

AddSpacer

#
public Spacer AddSpacer(string chapterName = null, string sectionName = null)
Add a default sized spacer with optional section name.
chapterName (string = null)
sectionName (string = null)

AddTextField

#
public TextField AddTextField(IIcon icon, Nomen nomen, string initial, string placeholder)
Add a text field to this bar.
icon (IIcon)
nomen (Nomen)
initial (string)
placeholder (string)
Field which was added.

AddToggle

#
public RadioToggle AddToggle(Nomen nomen, bool initialState, params string[] additionalAffectedSections)
Add a narrow toggle option which enables/disables all elements that follow it with the given section names.
nomen (Nomen)Nomen of toggle.
initialState (bool)Initial up/down state.
additionalAffectedSections (params string[])All affected section names. If null, the toggle nomen section is used.

AddWarmColours

#
public void AddWarmColours(Nomen nomen, Family initial, Action<Family> assignment)
Add a series of RadioToggle options to this bar representing the standard warm (red/yellow) colours. This also sets the style to not display categories and the element height to 16.
nomen (Nomen)Nomen with '{family}' placeholders for colour family name.
initial (OpenColor.Family)Family to select.
assignment (Action<OpenColor.Family>)Assignment action.

CreateStandardColourBars

#
public static void CreateStandardColourBars(Nomen nomen, Family initial, Action<Family> assignment, out Bar life, out Bar cool, out Bar warm)
Create the three standard colour picker bars.
nomen (Nomen)Nomen with '{family}' as a placeholder for the name.
initial (OpenColor.Family)Initial checked colour toggle.
assignment (Action<OpenColor.Family>)Assingment callback.
life (out Bar)Green colours.
cool (out Bar)Blue colours.
warm (out Bar)red colours.

Find<T>

#
public T Find<T>(string name)
Find the first element of the specified type with the specified name.
name (string)

IndexOf

#
public int IndexOf(BarItem element)
Find the index of the given element.
element (BarItem)

Invalidate

#
public void Invalidate()
Raise the Invalidated event.

ItemAt

#
public BarItem ItemAt(PointF point)
Find the element at the given point.
point (PointF)

Layout

#
public void Layout()
Perform layout to the current bounds.

OnTooltipDetails

#
public ToolbarTooltipEventArgs OnTooltipDetails(BarItem item)
item (BarItem)

Render

#
public void Render(Context context)
Draw this toggle bar to a graphics context.
context (Context)

ShowTooltipAt

#
public bool ShowTooltipAt(PointF location)
Show a tooltip at the given location.
location (PointF)Location.
True if tooltip was shown, or would have been shows at the location.

Events

CloseRequested

#
public event EventHandler CloseRequested
Request the closing of any form containing this bar.

Invalidated

#
public event EventHandler Invalidated
Raised when the display of this toolbar changes and a redraw is required.

TooltipDetails

#
public event EventHandler<ToolbarTooltipEventArgs> TooltipDetails