public sealed class RadioToggle : BarItem
A checkbox or radio toggle on a tool bar. Other toggles which share the same Nomen.Section will automatically untoggle when a toggle is pressed.

Constructors

RadioToggle

#
public RadioToggle(IIcon icon, Nomen nomen, bool state, Action<bool> callback = null)
Create a new tool bar option button.
icon (IIcon)Icon for button.
nomen (Nomen)Nomen. Any other radio button on the same tool bar with the same nomen section name will automatically go OFF when this toggle comes ON.
state (bool)Initial state.
callback (Action<bool> = null)Callback method for state changes.

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

OffText

#
public string OffText { get; set; }
Gets or sets the text to display in the OFF state, assuming no icon is present. By default, the Nomen.Name of the Nomen is copied into this field.

OnColour

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

OnText

#
public string OnText { get; set; }
Gets or sets the text to display in the ON state, assuming no icon is present. By default, the Nomen.Name of the Nomen is copied into this field.

Optional

#
public bool Optional { get; set; }
An optional option can be toggled off when it's toggled on, leaving all options in the same group unchecked.

RadioGroup

#
public RadioToggle[] RadioGroup { get; }
Gets the complete group of radio buttons this option belongs to. An option is part of a radio group if any other Options on any toolbar in the same Bar.Bundle share the same Nomen.Section string.

State

#
public bool State { get; }
Gets the state of this option.

Style

#
public IconTextStyle Style { get; set; }
Gets or sets the icon+text drawing style.

Methods

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)

SetState

#
public void SetState(bool state)
Method for setting the state of this option externally. If this option acts as a radio-button then it cannot be unset.
state (bool)

ShowTooltipAt

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

TextInput

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

Toggle

#
public void Toggle()
Toggle this state and cause associated options to toggle off appropriately.

Events

StateChanged

#
public event EventHandler<bool> StateChanged
Event handler for state changes.