Interface IWindowControl
- Namespace
- SharpConsoleUI.Controls
- Assembly
- SharpConsoleUI.dll
Represents a UI control that can be displayed within a window or container.
public interface IWindowControl : IDisposable
- Inherited Members
- Extension Methods
Properties
ActualHeight
Gets the actual height at which the control was last rendered. Returns 0 if the control has not been rendered yet.
int ActualHeight { get; }
Property Value
ActualWidth
Gets the actual width at which the control was last rendered. Returns 0 if the control has not been rendered yet.
int ActualWidth { get; }
Property Value
ActualX
Gets the actual X coordinate where the control was last rendered. Returns 0 if the control has not been rendered yet.
int ActualX { get; }
Property Value
ActualY
Gets the actual Y coordinate where the control was last rendered. Returns 0 if the control has not been rendered yet.
int ActualY { get; }
Property Value
Container
Gets or sets the parent container that hosts this control.
IContainer? Container { get; set; }
Property Value
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.
int? ContentWidth { get; }
Property Value
- int?
Dock
Gets or sets the edge this control claims from its container, or None to share the remaining space.
Dock Dock { get; set; }
Property Value
Remarks
StickyPosition is sugar over this: setting it to
Top or Bottom sets
Dock to the matching edge, and reading it reports Top or
Bottom when that is where the control is docked. They are one value, so the two
cannot disagree. Left and Right have
no sticky equivalent and read back as None.
Defaulted so that adding it does not break an existing implementer of this interface. The default projects onto StickyPosition, which every implementer already has, so a control written before docking existed keeps working and still honours sticky; it simply cannot claim the horizontal edges until it overrides this.
Height
Gets or sets the explicit height of the control, or null for automatic sizing.
int? Height { get; set; }
Property Value
- int?
HorizontalAlignment
Gets or sets the horizontal alignment of the control within its container.
HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Margin
Gets or sets the margin (spacing) around the control.
Margin Margin { get; set; }
Property Value
Name
Gets or sets the unique name identifier for this control, used for lookup.
string? Name { get; set; }
Property Value
StickyPosition
Gets or sets whether this control should stick to the top or bottom during scrolling.
StickyPosition StickyPosition { get; set; }
Property Value
Tag
Gets or sets an arbitrary object value that can be used to store custom data.
object? Tag { get; set; }
Property Value
VerticalAlignment
Gets or sets the vertical alignment of the control within its container.
VerticalAlignment VerticalAlignment { get; set; }
Property Value
Visible
Gets or sets whether this control is visible.
bool Visible { get; set; }
Property Value
Width
Gets or sets the explicit width of the control, or null for automatic sizing.
int? Width { get; set; }
Property Value
- int?
Methods
GetLogicalContentSize()
Gets the logical size of the control's content without rendering.
Size GetLogicalContentSize()
Returns
- Size
The size representing the content's natural dimensions.
Invalidate()
Marks this control as needing a full re-layout on the next frame. Compatibility overload
preserving the previous parameterless signature; equivalent to
Invalidate(Invalidation.Relayout).
void Invalidate()
Invalidate(Invalidation)
Marks this control as needing the specified work on the next frame.
void Invalidate(Invalidation work)
Parameters
workInvalidationRepaint (appearance-only) or Relayout (size/position-affecting).
Invalidate(bool)
Marks this control as needing work on the next frame. Compatibility overload preserving the
previous boolean signature: true maps to Relayout,
false to Repaint.
void Invalidate(bool redrawAll)
Parameters
redrawAllbooltruefor a full re-layout,falsefor an appearance-only repaint.