Table of Contents

Class StatusBarControl

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

A single-row status bar with left/center/right alignment zones, clickable items, and optional shortcut key hints. Does not receive keyboard focus — display and click only.

public class StatusBarControl : BaseControl, IDOMPaintable, INotifyPropertyChanged, IMouseAwareControl, IWindowControl, IDisposable
Inheritance
StatusBarControl
Implements
Inherited Members
Extension Methods

Constructors

StatusBarControl(bool)

Initializes a new instance of the StatusBarControl class.

public StatusBarControl(bool stickyBottom = true)

Parameters

stickyBottom bool

When true (default), the control sticks to the bottom of the window. Set to false to place the status bar anywhere in the DOM layout.

Properties

AboveLineColor

Color of the above line. Null uses the foreground color.

public Color? AboveLineColor { get; set; }

Property Value

Color?

BackgroundColor

Gets or sets the status bar background color. Null inherits from theme/container.

public Color? BackgroundColor { get; set; }

Property Value

Color?

CanFocusWithMouse

Whether this control can receive focus via mouse clicks

public bool CanFocusWithMouse { get; }

Property Value

bool

CenterItems

Gets the items in the center alignment zone.

public IReadOnlyList<StatusBarItem> CenterItems { get; }

Property Value

IReadOnlyList<StatusBarItem>

ContentWidth

Gets the minimum width needed to display the control's content, including margins. Returns null if width cannot be determined. This is calculated based on content (text length, child controls, etc.) and represents the natural/intrinsic size.

public override int? ContentWidth { get; }

Property Value

int?

ForegroundColor

Gets or sets the status bar foreground (label) color. Null inherits from theme/container.

public Color ForegroundColor { get; set; }

Property Value

Color

ItemSpacing

Gets or sets spacing in characters between adjacent items. Default 2.

public int ItemSpacing { get; set; }

Property Value

int

LeftItems

Gets the items in the left alignment zone.

public IReadOnlyList<StatusBarItem> LeftItems { get; }

Property Value

IReadOnlyList<StatusBarItem>

RightItems

Gets the items in the right alignment zone.

public IReadOnlyList<StatusBarItem> RightItems { get; }

Property Value

IReadOnlyList<StatusBarItem>

SeparatorChar

Gets or sets the separator character rendered between sections. Default "|".

public string SeparatorChar { get; set; }

Property Value

string

ShortcutForegroundColor

Accent color for shortcut key hints. Falls back to theme, then Cyan1.

public Color ShortcutForegroundColor { get; set; }

Property Value

Color

ShortcutLabelSeparator

Gets or sets the separator between shortcut and label text within an item. Default ":".

public string ShortcutLabelSeparator { get; set; }

Property Value

string

ShowAboveLine

When true, renders a horizontal line above the status bar content. Default false.

public bool ShowAboveLine { get; set; }

Property Value

bool

WantsMouseEvents

Whether this control wants to receive mouse events

public bool WantsMouseEvents { get; }

Property Value

bool

Methods

AddCenter(StatusBarItem)

Adds a pre-configured item to the center zone.

public void AddCenter(StatusBarItem item)

Parameters

item StatusBarItem

AddCenter(string, string, Action?)

Adds an item with shortcut and label to the center zone.

public StatusBarItem AddCenter(string shortcut, string label, Action? onClick = null)

Parameters

shortcut string
label string
onClick Action

Returns

StatusBarItem

AddCenterSeparator()

Adds a separator item to the center zone.

public void AddCenterSeparator()

AddCenterText(string, Action?)

Adds a label-only item (no shortcut) to the center zone.

public StatusBarItem AddCenterText(string text, Action? onClick = null)

Parameters

text string
onClick Action

Returns

StatusBarItem

AddLeft(StatusBarItem)

Adds a pre-configured item to the left zone.

public void AddLeft(StatusBarItem item)

Parameters

item StatusBarItem

AddLeft(string, string, Action?)

Adds an item with shortcut and label to the left zone.

public StatusBarItem AddLeft(string shortcut, string label, Action? onClick = null)

Parameters

shortcut string
label string
onClick Action

Returns

StatusBarItem

AddLeftSeparator()

Adds a separator item to the left zone.

public void AddLeftSeparator()

AddLeftText(string, Action?)

Adds a label-only item (no shortcut) to the left zone.

public StatusBarItem AddLeftText(string text, Action? onClick = null)

Parameters

text string
onClick Action

Returns

StatusBarItem

AddRight(StatusBarItem)

Adds a pre-configured item to the right zone.

public void AddRight(StatusBarItem item)

Parameters

item StatusBarItem

AddRight(string, string, Action?)

Adds an item with shortcut and label to the right zone.

public StatusBarItem AddRight(string shortcut, string label, Action? onClick = null)

Parameters

shortcut string
label string
onClick Action

Returns

StatusBarItem

AddRightSeparator()

Adds a separator item to the right zone.

public void AddRightSeparator()

AddRightText(string, Action?)

Adds a label-only item (no shortcut) to the right zone.

public StatusBarItem AddRightText(string text, Action? onClick = null)

Parameters

text string
onClick Action

Returns

StatusBarItem

BatchUpdate(Action)

Executes multiple item changes with a single invalidation at the end.

public void BatchUpdate(Action updateAction)

Parameters

updateAction Action

ClearAll()

Removes all items from all zones.

public void ClearAll()

ClearCenter()

Removes all items from the center zone.

public void ClearCenter()

ClearLeft()

Removes all items from the left zone.

public void ClearLeft()

ClearRight()

Removes all items from the right zone.

public void ClearRight()

GetLogicalContentSize()

Gets the logical size of the control's content without rendering.

public override Size GetLogicalContentSize()

Returns

Size

The size representing the content's natural dimensions.

MeasureDOM(LayoutConstraints)

Measures the control's desired size given the available constraints.

public override LayoutSize MeasureDOM(LayoutConstraints constraints)

Parameters

constraints LayoutConstraints

The layout constraints (min/max width/height).

Returns

LayoutSize

The desired size of the control.

OnDisposing()

Called during Dispose() before Container is set to null. Override to perform control-specific cleanup (null events, close portals, clear data, etc.).

protected override void OnDisposing()

PaintDOM(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)

Paints the control's content directly to a CharacterBuffer.

public override void PaintDOM(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, Color defaultFg, Color defaultBg)

Parameters

buffer CharacterBuffer

The buffer to paint to.

bounds LayoutRect

The absolute bounds where the control should paint.

clipRect LayoutRect

The clipping rectangle (visible area).

defaultFg Color
defaultBg Color

ProcessMouseEvent(MouseEventArgs)

Processes a mouse event for this control

public bool ProcessMouseEvent(MouseEventArgs args)

Parameters

args MouseEventArgs

Mouse event arguments with control-relative coordinates

Returns

bool

True if the event was handled and should not propagate further

RemoveCenter(StatusBarItem)

Removes an item from the center zone. Returns true if found.

public bool RemoveCenter(StatusBarItem item)

Parameters

item StatusBarItem

Returns

bool

RemoveLeft(StatusBarItem)

Removes an item from the left zone. Returns true if found.

public bool RemoveLeft(StatusBarItem item)

Parameters

item StatusBarItem

Returns

bool

RemoveRight(StatusBarItem)

Removes an item from the right zone. Returns true if found.

public bool RemoveRight(StatusBarItem item)

Parameters

item StatusBarItem

Returns

bool

Events

ItemClicked

Fired when any item in the status bar is clicked.

public event EventHandler<StatusBarItemClickedEventArgs>? ItemClicked

Event Type

EventHandler<StatusBarItemClickedEventArgs>

MouseClick

Event fired when the control is clicked

public event EventHandler<MouseEventArgs>? MouseClick

Event Type

EventHandler<MouseEventArgs>

MouseDoubleClick

Event fired when the control is double-clicked

public event EventHandler<MouseEventArgs>? MouseDoubleClick

Event Type

EventHandler<MouseEventArgs>

MouseEnter

Event fired when the mouse enters the control area

public event EventHandler<MouseEventArgs>? MouseEnter

Event Type

EventHandler<MouseEventArgs>

MouseLeave

Event fired when the mouse leaves the control area

public event EventHandler<MouseEventArgs>? MouseLeave

Event Type

EventHandler<MouseEventArgs>

MouseMove

Event fired when the mouse moves over the control

public event EventHandler<MouseEventArgs>? MouseMove

Event Type

EventHandler<MouseEventArgs>

MouseRightClick

Event fired when the control is right-clicked (Button3)

public event EventHandler<MouseEventArgs>? MouseRightClick

Event Type

EventHandler<MouseEventArgs>