Add documentation to containers.
This commit is contained in:
@@ -11,27 +11,69 @@ public enum FlexDirection
|
|||||||
|
|
||||||
public enum JustifyContent
|
public enum JustifyContent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Align children to the start of the line.
|
||||||
|
/// </summary>
|
||||||
Start,
|
Start,
|
||||||
|
/// <summary>
|
||||||
|
/// Align children to the center of the line.
|
||||||
|
/// </summary>
|
||||||
Center,
|
Center,
|
||||||
|
/// <summary>
|
||||||
|
/// Align children to the end of the line.
|
||||||
|
/// </summary>
|
||||||
End,
|
End,
|
||||||
|
/// <summary>
|
||||||
|
/// Equal space between items (no space at edges if multiple).
|
||||||
|
/// </summary>
|
||||||
SpaceBetween
|
SpaceBetween
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AlignItems
|
public enum AlignItems
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Align to the top or left (cross-axis)
|
||||||
|
/// </summary>
|
||||||
Start,
|
Start,
|
||||||
|
/// <summary>
|
||||||
|
/// Center along the cross-axis.
|
||||||
|
/// </summary>
|
||||||
Center,
|
Center,
|
||||||
|
/// <summary>
|
||||||
|
/// Align to the bottom or right.
|
||||||
|
/// </summary>
|
||||||
End
|
End
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A flexible layout container that arranges its child elements in rows or columns, similar to CSS flexbox. Supports wrapping, alignment, spacing, and space distribution.
|
||||||
|
/// </summary>
|
||||||
public class FlexContainer : Container
|
public class FlexContainer : Container
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Layout direction to use with this <see cref="FlexContainer"/>.
|
||||||
|
/// </summary>
|
||||||
public FlexDirection Direction { get; set; } = FlexDirection.Row;
|
public FlexDirection Direction { get; set; } = FlexDirection.Row;
|
||||||
|
/// <summary>
|
||||||
|
/// Controls main-axis alignment of child elements. By default, children will be positioned at the start of a line.
|
||||||
|
/// </summary>
|
||||||
public JustifyContent Justify { get; set; } = JustifyContent.Start;
|
public JustifyContent Justify { get; set; } = JustifyContent.Start;
|
||||||
|
/// <summary>
|
||||||
|
/// Controls cross-axis alignment (start, center, end).
|
||||||
|
/// </summary>
|
||||||
public AlignItems Align { get; set; } = AlignItems.Start;
|
public AlignItems Align { get; set; } = AlignItems.Start;
|
||||||
|
/// <summary>
|
||||||
|
/// If true, children wrap onto multiple lines (rows or columns).
|
||||||
|
/// </summary>
|
||||||
public bool Wrap { get; set; } = false;
|
public bool Wrap { get; set; } = false;
|
||||||
|
/// <summary>
|
||||||
|
/// Space between child elements.
|
||||||
|
/// </summary>
|
||||||
public float Gap { get; set; } = 16f;
|
public float Gap { get; set; } = 16f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (Reserved) If true, distributes extra space among children (not implemented)
|
||||||
|
/// </summary>
|
||||||
public bool DistributeRemainingSpace { get; set; } = false;
|
public bool DistributeRemainingSpace { get; set; } = false;
|
||||||
|
|
||||||
public FlexContainer() : base() { }
|
public FlexContainer() : base() { }
|
||||||
|
|||||||
@@ -3,10 +3,22 @@ using Voile.Rendering;
|
|||||||
|
|
||||||
namespace Voile.UI.Containers;
|
namespace Voile.UI.Containers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A grid container arranges its children in a grid layout with a given column count, and column and row spacing between child elements.
|
||||||
|
/// </summary>
|
||||||
public class GridContainer : Container
|
public class GridContainer : Container
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Amount of columns this grid has.
|
||||||
|
/// </summary>
|
||||||
public int Columns { get; set; } = 2;
|
public int Columns { get; set; } = 2;
|
||||||
|
/// <summary>
|
||||||
|
/// Spacing between each grid column.
|
||||||
|
/// </summary>
|
||||||
public float ColumnSpacing { get; set; } = 16.0f;
|
public float ColumnSpacing { get; set; } = 16.0f;
|
||||||
|
/// <summary>
|
||||||
|
/// Spacing between each grid row.
|
||||||
|
/// </summary>
|
||||||
public float RowSpacing { get; set; } = 16.0f;
|
public float RowSpacing { get; set; } = 16.0f;
|
||||||
|
|
||||||
public GridContainer(Rect minimumSize, List<IElement> children, int columns = 2, float colSpacing = 16.0f, float rowSpacing = 16.0f)
|
public GridContainer(Rect minimumSize, List<IElement> children, int columns = 2, float colSpacing = 16.0f, float rowSpacing = 16.0f)
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ using Voile.Rendering;
|
|||||||
|
|
||||||
namespace Voile.UI.Containers;
|
namespace Voile.UI.Containers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A horizontal container arranges its children horizontally, with a given horizontal spacing between child elements.
|
||||||
|
/// </summary>
|
||||||
public class HorizontalContainer : Container
|
public class HorizontalContainer : Container
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Horizontal spacing between child elements.
|
||||||
|
/// </summary>
|
||||||
public float Spacing { get; set; } = 16.0f;
|
public float Spacing { get; set; } = 16.0f;
|
||||||
|
|
||||||
public HorizontalContainer(Rect minimumSize, List<IElement> children, float spacing = 16.0f) : base(minimumSize, children)
|
public HorizontalContainer(Rect minimumSize, List<IElement> children, float spacing = 16.0f) : base(minimumSize, children)
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ using Voile.Rendering;
|
|||||||
|
|
||||||
namespace Voile.UI.Containers;
|
namespace Voile.UI.Containers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A vertical container arranges its children vertically, with a given vertical spacing between child elements.
|
||||||
|
/// </summary>
|
||||||
public class VerticalContainer : Container
|
public class VerticalContainer : Container
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Vertical spacing between child elements.
|
||||||
|
/// </summary>
|
||||||
public float Spacing { get; set; } = 16.0f;
|
public float Spacing { get; set; } = 16.0f;
|
||||||
|
|
||||||
public VerticalContainer(Rect minimumSize, List<IElement> children, float spacing = 16.0f) : base(minimumSize, children)
|
public VerticalContainer(Rect minimumSize, List<IElement> children, float spacing = 16.0f) : base(minimumSize, children)
|
||||||
|
|||||||
Reference in New Issue
Block a user