Table of Contents

Class ToolbarBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for toolbar controls

public sealed class ToolbarBuilder
Inheritance
ToolbarBuilder
Inherited Members

Methods

Add(IWindowControl)

Adds any control to the toolbar

public ToolbarBuilder Add(IWindowControl control)

Parameters

control IWindowControl

The control to add

Returns

ToolbarBuilder

The builder for chaining

AddButton(ButtonBuilder)

Adds a button to the toolbar using a button builder

public ToolbarBuilder AddButton(ButtonBuilder builder)

Parameters

builder ButtonBuilder

The button builder

Returns

ToolbarBuilder

The builder for chaining

AddButton(ButtonControl)

Adds an existing button control to the toolbar

public ToolbarBuilder AddButton(ButtonControl button)

Parameters

button ButtonControl

The button control

Returns

ToolbarBuilder

The builder for chaining

AddButton(string, WindowEventHandler<ButtonControl>)

Adds a button to the toolbar with window-aware click handler

public ToolbarBuilder AddButton(string text, WindowEventHandler<ButtonControl> onClick)

Parameters

text string

The button text

onClick WindowEventHandler<ButtonControl>

The click handler with window access

Returns

ToolbarBuilder

The builder for chaining

AddButton(string, EventHandler<ButtonControl>)

Adds a button to the toolbar with the specified text and click handler

public ToolbarBuilder AddButton(string text, EventHandler<ButtonControl> onClick)

Parameters

text string

The button text

onClick EventHandler<ButtonControl>

The click handler with button reference

Returns

ToolbarBuilder

The builder for chaining

AddSeparator()

Adds a separator to the toolbar

public ToolbarBuilder AddSeparator()

Returns

ToolbarBuilder

The builder for chaining

AddSeparator(int)

Adds a separator with custom margin to the toolbar

public ToolbarBuilder AddSeparator(int horizontalMargin)

Parameters

horizontalMargin int

The horizontal margin on each side

Returns

ToolbarBuilder

The builder for chaining

Build()

Builds the toolbar control

public ToolbarControl Build()

Returns

ToolbarControl

The configured toolbar control

OnGotFocus(WindowEventHandler<EventArgs>)

Sets the GotFocus event handler with window access

public ToolbarBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<EventArgs>

Handler that receives sender, event data, and window

Returns

ToolbarBuilder

The builder for chaining

OnGotFocus(EventHandler)

Sets the GotFocus event handler

public ToolbarBuilder OnGotFocus(EventHandler handler)

Parameters

handler EventHandler

The event handler to invoke when the toolbar receives focus

Returns

ToolbarBuilder

The builder for chaining

OnLostFocus(WindowEventHandler<EventArgs>)

Sets the LostFocus event handler with window access

public ToolbarBuilder OnLostFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<EventArgs>

Handler that receives sender, event data, and window

Returns

ToolbarBuilder

The builder for chaining

OnLostFocus(EventHandler)

Sets the LostFocus event handler

public ToolbarBuilder OnLostFocus(EventHandler handler)

Parameters

handler EventHandler

The event handler to invoke when the toolbar loses focus

Returns

ToolbarBuilder

The builder for chaining

StickyBottom()

Makes the control stick to the bottom of the window

public ToolbarBuilder StickyBottom()

Returns

ToolbarBuilder

The builder for chaining

StickyTop()

Makes the control stick to the top of the window

public ToolbarBuilder StickyTop()

Returns

ToolbarBuilder

The builder for chaining

Visible(bool)

Sets the visibility

public ToolbarBuilder Visible(bool visible = true)

Parameters

visible bool

Whether the toolbar is visible

Returns

ToolbarBuilder

The builder for chaining

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment

public ToolbarBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The alignment

Returns

ToolbarBuilder

The builder for chaining

WithBackgroundColor(Color?)

Sets the background color (null for transparent/inherit)

public ToolbarBuilder WithBackgroundColor(Color? color)

Parameters

color Color?

The background color

Returns

ToolbarBuilder

The builder for chaining

WithForegroundColor(Color?)

Sets the foreground color (null for transparent/inherit)

public ToolbarBuilder WithForegroundColor(Color? color)

Parameters

color Color?

The foreground color

Returns

ToolbarBuilder

The builder for chaining

WithHeight(int)

Sets the toolbar height

public ToolbarBuilder WithHeight(int height)

Parameters

height int

The height in rows

Returns

ToolbarBuilder

The builder for chaining

WithMargin(Margin)

Sets the toolbar margin

public ToolbarBuilder WithMargin(Margin margin)

Parameters

margin Margin

The margin

Returns

ToolbarBuilder

The builder for chaining

WithMargin(int)

Sets uniform margin

public ToolbarBuilder WithMargin(int margin)

Parameters

margin int

The margin value for all sides

Returns

ToolbarBuilder

The builder for chaining

WithMargin(int, int, int, int)

Sets the toolbar margin

public ToolbarBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int

Left margin

top int

Top margin

right int

Right margin

bottom int

Bottom margin

Returns

ToolbarBuilder

The builder for chaining

WithName(string)

Sets the control name for lookup

public ToolbarBuilder WithName(string name)

Parameters

name string

The control name

Returns

ToolbarBuilder

The builder for chaining

WithSpacing(int)

Sets the spacing between toolbar items

public ToolbarBuilder WithSpacing(int spacing)

Parameters

spacing int

The spacing in characters

Returns

ToolbarBuilder

The builder for chaining

WithStickyPosition(StickyPosition)

Sets the sticky position

public ToolbarBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

The sticky position

Returns

ToolbarBuilder

The builder for chaining

WithTag(object)

Sets a tag object

public ToolbarBuilder WithTag(object tag)

Parameters

tag object

The tag object

Returns

ToolbarBuilder

The builder for chaining

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment

public ToolbarBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The alignment

Returns

ToolbarBuilder

The builder for chaining

WithWidth(int)

Sets the toolbar width

public ToolbarBuilder WithWidth(int width)

Parameters

width int

The width in characters

Returns

ToolbarBuilder

The builder for chaining

Operators

implicit operator ToolbarControl(ToolbarBuilder)

Implicit conversion to ToolbarControl

public static implicit operator ToolbarControl(ToolbarBuilder builder)

Parameters

builder ToolbarBuilder

The builder

Returns

ToolbarControl

The built toolbar control