From 5b29ea012e8fc8c734e105fb67f5595130bf23c9 Mon Sep 17 00:00:00 2001 From: dnesov Date: Fri, 20 Jun 2025 20:16:36 +0200 Subject: [PATCH] Add documentation to containers. --- Voile/Source/UI/Containers/FlexContainer.cs | 42 +++++++++++++++++++ Voile/Source/UI/Containers/GridContainer.cs | 12 ++++++ .../UI/Containers/HorizontalContainer.cs | 6 +++ .../Source/UI/Containers/VerticalContainer.cs | 6 +++ 4 files changed, 66 insertions(+) diff --git a/Voile/Source/UI/Containers/FlexContainer.cs b/Voile/Source/UI/Containers/FlexContainer.cs index f706a52..d252865 100644 --- a/Voile/Source/UI/Containers/FlexContainer.cs +++ b/Voile/Source/UI/Containers/FlexContainer.cs @@ -11,27 +11,69 @@ public enum FlexDirection public enum JustifyContent { + /// + /// Align children to the start of the line. + /// Start, + /// + /// Align children to the center of the line. + /// Center, + /// + /// Align children to the end of the line. + /// End, + /// + /// Equal space between items (no space at edges if multiple). + /// SpaceBetween } public enum AlignItems { + /// + /// Align to the top or left (cross-axis) + /// Start, + /// + /// Center along the cross-axis. + /// Center, + /// + /// Align to the bottom or right. + /// End } +/// +/// A flexible layout container that arranges its child elements in rows or columns, similar to CSS flexbox. Supports wrapping, alignment, spacing, and space distribution. +/// public class FlexContainer : Container { + /// + /// Layout direction to use with this . + /// public FlexDirection Direction { get; set; } = FlexDirection.Row; + /// + /// Controls main-axis alignment of child elements. By default, children will be positioned at the start of a line. + /// public JustifyContent Justify { get; set; } = JustifyContent.Start; + /// + /// Controls cross-axis alignment (start, center, end). + /// public AlignItems Align { get; set; } = AlignItems.Start; + /// + /// If true, children wrap onto multiple lines (rows or columns). + /// public bool Wrap { get; set; } = false; + /// + /// Space between child elements. + /// public float Gap { get; set; } = 16f; + /// + /// (Reserved) If true, distributes extra space among children (not implemented) + /// public bool DistributeRemainingSpace { get; set; } = false; public FlexContainer() : base() { } diff --git a/Voile/Source/UI/Containers/GridContainer.cs b/Voile/Source/UI/Containers/GridContainer.cs index 7c3c627..c463a9c 100644 --- a/Voile/Source/UI/Containers/GridContainer.cs +++ b/Voile/Source/UI/Containers/GridContainer.cs @@ -3,10 +3,22 @@ using Voile.Rendering; namespace Voile.UI.Containers; +/// +/// A grid container arranges its children in a grid layout with a given column count, and column and row spacing between child elements. +/// public class GridContainer : Container { + /// + /// Amount of columns this grid has. + /// public int Columns { get; set; } = 2; + /// + /// Spacing between each grid column. + /// public float ColumnSpacing { get; set; } = 16.0f; + /// + /// Spacing between each grid row. + /// public float RowSpacing { get; set; } = 16.0f; public GridContainer(Rect minimumSize, List children, int columns = 2, float colSpacing = 16.0f, float rowSpacing = 16.0f) diff --git a/Voile/Source/UI/Containers/HorizontalContainer.cs b/Voile/Source/UI/Containers/HorizontalContainer.cs index 3e8969b..e1934c3 100644 --- a/Voile/Source/UI/Containers/HorizontalContainer.cs +++ b/Voile/Source/UI/Containers/HorizontalContainer.cs @@ -3,8 +3,14 @@ using Voile.Rendering; namespace Voile.UI.Containers; +/// +/// A horizontal container arranges its children horizontally, with a given horizontal spacing between child elements. +/// public class HorizontalContainer : Container { + /// + /// Horizontal spacing between child elements. + /// public float Spacing { get; set; } = 16.0f; public HorizontalContainer(Rect minimumSize, List children, float spacing = 16.0f) : base(minimumSize, children) diff --git a/Voile/Source/UI/Containers/VerticalContainer.cs b/Voile/Source/UI/Containers/VerticalContainer.cs index ebf6f3a..9adbcc7 100644 --- a/Voile/Source/UI/Containers/VerticalContainer.cs +++ b/Voile/Source/UI/Containers/VerticalContainer.cs @@ -3,8 +3,14 @@ using Voile.Rendering; namespace Voile.UI.Containers; +/// +/// A vertical container arranges its children vertically, with a given vertical spacing between child elements. +/// public class VerticalContainer : Container { + /// + /// Vertical spacing between child elements. + /// public float Spacing { get; set; } = 16.0f; public VerticalContainer(Rect minimumSize, List children, float spacing = 16.0f) : base(minimumSize, children)