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
controlIWindowControlThe 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
builderButtonBuilderThe button builder
Returns
- ToolbarBuilder
The builder for chaining
AddButton(ButtonControl)
Adds an existing button control to the toolbar
public ToolbarBuilder AddButton(ButtonControl button)
Parameters
buttonButtonControlThe 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
textstringThe button text
onClickWindowEventHandler<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
textstringThe button text
onClickEventHandler<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
horizontalMarginintThe 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
handlerWindowEventHandler<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
handlerEventHandlerThe 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
handlerWindowEventHandler<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
handlerEventHandlerThe 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
visibleboolWhether the toolbar is visible
Returns
- ToolbarBuilder
The builder for chaining
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment
public ToolbarBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignmentThe alignment
Returns
- ToolbarBuilder
The builder for chaining
WithBackgroundColor(Color?)
Sets the background color (null for transparent/inherit)
public ToolbarBuilder WithBackgroundColor(Color? color)
Parameters
colorColor?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
colorColor?The foreground color
Returns
- ToolbarBuilder
The builder for chaining
WithHeight(int)
Sets the toolbar height
public ToolbarBuilder WithHeight(int height)
Parameters
heightintThe height in rows
Returns
- ToolbarBuilder
The builder for chaining
WithMargin(Margin)
Sets the toolbar margin
public ToolbarBuilder WithMargin(Margin margin)
Parameters
marginMarginThe margin
Returns
- ToolbarBuilder
The builder for chaining
WithMargin(int)
Sets uniform margin
public ToolbarBuilder WithMargin(int margin)
Parameters
marginintThe 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
Returns
- ToolbarBuilder
The builder for chaining
WithName(string)
Sets the control name for lookup
public ToolbarBuilder WithName(string name)
Parameters
namestringThe control name
Returns
- ToolbarBuilder
The builder for chaining
WithSpacing(int)
Sets the spacing between toolbar items
public ToolbarBuilder WithSpacing(int spacing)
Parameters
spacingintThe spacing in characters
Returns
- ToolbarBuilder
The builder for chaining
WithStickyPosition(StickyPosition)
Sets the sticky position
public ToolbarBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position
Returns
- ToolbarBuilder
The builder for chaining
WithTag(object)
Sets a tag object
public ToolbarBuilder WithTag(object tag)
Parameters
tagobjectThe tag object
Returns
- ToolbarBuilder
The builder for chaining
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public ToolbarBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe alignment
Returns
- ToolbarBuilder
The builder for chaining
WithWidth(int)
Sets the toolbar width
public ToolbarBuilder WithWidth(int width)
Parameters
widthintThe 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
builderToolbarBuilderThe builder
Returns
- ToolbarControl
The built toolbar control