ILayoutProvider
Namespace: Hex1b.Nodes
Assembly: Hex1b.dll
Interface for nodes that provide layout/clipping services to descendants. Child nodes can query their ancestor layout node to determine rendering behavior. Layout providers can be nested, with each consulting its parent for proper clipping.
public interface ILayoutProviderProperties
ClipMode
The clip mode for this layout region.
Returns: ClipMode
ClipMode ClipMode { get; }ClipRect
The effective clipping rectangle for this layout region.
Returns: Rect
Rect ClipRect { get; }ParentLayoutProvider
The parent layout provider, if any. Set when this provider becomes the current layout provider and there was already one active. Used to ensure nested clipping works correctly.
Returns: ILayoutProvider
ILayoutProvider? ParentLayoutProvider { get; set; }Methods
ClipString(int, int, string)
Clips a string that starts at the given position, returning only the visible portion. Implementations should also consult the ParentLayoutProvider if present.
Parameters:
x(Int32): Starting absolute X position.y(Int32): Absolute Y position.text(String): The text to potentially clip.
Returns: ValueTuple<Int32, String>
A tuple containing:
- adjustedX: The X position to start rendering (may be > x if left-clipped)
- clippedText: The portion of text that should be rendered (may be empty)
(int adjustedX, string clippedText) ClipString(int x, int y, string text)ShouldRenderAt(int, int)
Determines if a character at the given absolute position should be rendered. Implementations should also check the ParentLayoutProvider if present.
Parameters:
x(Int32): Absolute X position in terminal coordinates.y(Int32): Absolute Y position in terminal coordinates.
Returns: Boolean
True if the character should be rendered, false if it should be clipped.
bool ShouldRenderAt(int x, int y)