WindowPositionSpec
Namespace: Hex1b
Assembly: Hex1b.dll
Specifies window position with optional offset.
public readonly record struct WindowPositionSpec : IEquatable<WindowPositionSpec>Implements
Constructors
WindowPositionSpec(WindowPosition, int, int)
Specifies window position with optional offset.
Parameters:
Position(WindowPosition): The base positioning strategy.OffsetX(Int32): Horizontal offset from the calculated position (positive = right).OffsetY(Int32): Vertical offset from the calculated position (positive = down).
public WindowPositionSpec(WindowPosition Position = WindowPosition.Center, int OffsetX = 0, int OffsetY = 0)Properties
BottomLeft
Creates a bottom-left position.
Returns: WindowPositionSpec
public static WindowPositionSpec BottomLeft { get; }BottomRight
Creates a bottom-right position.
Returns: WindowPositionSpec
public static WindowPositionSpec BottomRight { get; }Center
Creates a centered position.
Returns: WindowPositionSpec
public static WindowPositionSpec Center { get; }CenterBottom
Creates a center-bottom position.
Returns: WindowPositionSpec
public static WindowPositionSpec CenterBottom { get; }CenterTop
Creates a center-top position.
Returns: WindowPositionSpec
public static WindowPositionSpec CenterTop { get; }OffsetX
Horizontal offset from the calculated position (positive = right).
Returns: Int32
public int OffsetX { get; init; }OffsetY
Vertical offset from the calculated position (positive = down).
Returns: Int32
public int OffsetY { get; init; }Position
The base positioning strategy.
Returns: WindowPosition
public WindowPosition Position { get; init; }TopLeft
Creates a top-left position.
Returns: WindowPositionSpec
public static WindowPositionSpec TopLeft { get; }TopRight
Creates a top-right position.
Returns: WindowPositionSpec
public static WindowPositionSpec TopRight { get; }Methods
Calculate(Rect, int, int, int?, int?)
Calculates the actual X, Y position within the given bounds.
Parameters:
panelBounds(Rect): The bounds of the containing panel.windowWidth(Int32): The width of the window.windowHeight(Int32): The height of the window.absoluteX(Nullable<Int32>): Explicit X position when Position is Absolute.absoluteY(Nullable<Int32>): Explicit Y position when Position is Absolute.
Returns: ValueTuple<Int32, Int32>
The calculated (x, y) position, clamped to panel bounds.
public (int x, int y) Calculate(Rect panelBounds, int windowWidth, int windowHeight, int? absoluteX = null, int? absoluteY = null)CenterWithOffset(int, int)
Creates a position with an offset from center.
Parameters:
Returns: WindowPositionSpec
public static WindowPositionSpec CenterWithOffset(int offsetX, int offsetY)