BarItem

References
public abstract class BarItem
Abstract bar element implementation. Derive from this class rather than implementing IBarElement directly.

Constructors

BarItem

#
protected BarItem(IIcon icon, Nomen nomen)
Base class constructor.
icon (IIcon)
nomen (Nomen)

Fields

StandardMaximum

#
public const int StandardMaximum = 1073741823
Default maximum width of bar elements such as buttons, options and toggles.

StandardMinimum

#
public const int StandardMinimum = 24
Default minimum width of bar elements such as buttons, options and toggles.

Properties

AdjacentOnLeftSide

#
public abstract bool AdjacentOnLeftSide { get; }
Gets whether this element is treated as an adjacent one on the left side. This state is used when the layout code of the neighbouring element needs to decide whether to put small or large radii on its own shapes.

AdjacentOnRightSide

#
public abstract bool AdjacentOnRightSide { get; }
Gets whether this element is treated as an adjacent one on the right side. This state is used when the layout code of the neighbouring element needs to decide whether to put small or large radii on its own shapes.

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.

Bounds

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

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 IsEnabled() function to determine the real state.

Icon

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

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.

MaximumWidth

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

MinimumWidth

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

Nomen

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

OffColour

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

OnColour

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

Methods

CreateOutline

#
protected GraphicsPath CreateOutline()

CreateOutline

#
protected GraphicsPath CreateOutline(bool roundedOnLeft, bool roundedOnRight)
Create a new graphics path representing the outline of this item.
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)
context (Context)

DrawDisabled

#
protected abstract void DrawDisabled(Context context)
Draw this element when disabled.
context (Context)

DrawFocus

#
protected abstract void DrawFocus(Context context)
Draw this element when enabled and focused.
context (Context)

DrawHover

#
protected abstract void DrawHover(Context context)
Draw this element when enabled and hovered but not focused.
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.
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.
context (Context)
frame (Rectangle)
background (Color)
True if an icon was drawn.

DrawIconAndText

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

DrawNormal

#
protected abstract void DrawNormal(Context context)
Draw this element when enabled and not hovered and not focused.
context (Context)

DrawText

#
protected bool DrawText(Context context, Rectangle frame, string text, Color background)
Draw a string into the frame.
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.

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.

HasNeighbourToTheLeft

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

HasNeighbourToTheRight

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

IsEnabled

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

KeyDown

#
public virtual Response KeyDown(KeyEventArgs e)
e (KeyEventArgs)

KeyUp

#
public virtual Response KeyUp(KeyEventArgs e)
e (KeyEventArgs)

Layout

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

MouseDoubleClick

#
public virtual Response MouseDoubleClick(MouseEventArgs e)
e (MouseEventArgs)

MouseDown

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

MouseLeave

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

MouseMove

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

MouseUp

#
public virtual Response MouseUp(MouseEventArgs e)
e (MouseEventArgs)

NeighbourToTheLeft

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

NeighbourToTheRight

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

OverrideInfo

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

OverrideText

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

SetSizeLimits

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

ShowTooltipAt

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

TextInput

#
public virtual Response TextInput(TextInputEventArgs e)
e (TextInputEventArgs)