Class CustomElement
- Namespace
- SharpConsoleUI.Panel
- Assembly
- SharpConsoleUI.dll
A panel element with user-provided render and click callbacks.
public class CustomElement : PanelElement, IPanelElement
- Inheritance
-
CustomElement
- Implements
- Inherited Members
- Extension Methods
Constructors
CustomElement(string, int?, int)
Initializes a new CustomElement.
public CustomElement(string name, int? fixedWidth = null, int flexGrow = 0)
Parameters
namestringThe element name.
fixedWidthint?Optional fixed width.
flexGrowintOptional flex grow factor.
Properties
ClickHandler
Gets or sets the click handler.
public Action? ClickHandler { get; set; }
Property Value
FixedWidth
Gets the fixed width of this element, or null if it uses MeasureWidth() or flex sizing.
public override int? FixedWidth { get; }
Property Value
- int?
FlexGrow
Gets the flex grow factor. 0 = fixed sizing, >0 = flex proportional to other flex elements.
public override int FlexGrow { get; }
Property Value
RenderCallback
Gets or sets the render callback.
public Action<CharacterBuffer, int, int, int, Color, Color>? RenderCallback { get; set; }
Property Value
Methods
ProcessMouseEvent(MouseEventArgs, int, int)
Processes a mouse event that occurred within this element's bounds.
public override bool ProcessMouseEvent(MouseEventArgs args, int elementX, int elementWidth)
Parameters
argsMouseEventArgsThe mouse event arguments.
elementXintThe x position of this element on screen.
elementWidthintThe allocated width of this element.
Returns
- bool
True if the event was handled.
Render(CharacterBuffer, int, int, int, Color, Color)
Renders the element into the character buffer at the specified position.
public override void Render(CharacterBuffer buffer, int x, int y, int width, Color fg, Color bg)