From e0c07c1d9a29734490e2fd62958a6d732691480e Mon Sep 17 00:00:00 2001 From: Tig Date: Fri, 17 May 2024 16:24:00 -0700 Subject: [PATCH] Aligner - one type per file --- Terminal.Gui/Drawing/Aligner.cs | 192 ------------------------------ Terminal.Gui/Drawing/Alignment.cs | 191 +++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+), 192 deletions(-) create mode 100644 Terminal.Gui/Drawing/Alignment.cs diff --git a/Terminal.Gui/Drawing/Aligner.cs b/Terminal.Gui/Drawing/Aligner.cs index 29bb80b9c..158a0dc49 100644 --- a/Terminal.Gui/Drawing/Aligner.cs +++ b/Terminal.Gui/Drawing/Aligner.cs @@ -1,199 +1,7 @@ using System.ComponentModel; -using Microsoft.CodeAnalysis; -using static Terminal.Gui.Pos; namespace Terminal.Gui; -/// -/// Controls how the aligns items within a container. -/// -public enum Alignment -{ - /// - /// The items will be aligned to the left. - /// Set to to ensure at least one space between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the right items will be clipped (their locations - /// will be greater than the container size). - /// - /// - /// and have equivalent behavior. - /// - /// - /// - /// - /// 111 2222 33333 - /// - /// - Left = 0, - - /// - /// The items will be aligned to the top. - /// Set to to ensure at least one line between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the bottom items will be clipped (their locations - /// will be greater than the container size). - /// - /// - /// and have equivalent behavior. - /// - /// - Top, - - /// - /// The items will be aligned to the right. - /// Set to to ensure at least one space between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the left items will be clipped (their locations - /// will be negative). - /// - /// - /// and have equivalent behavior. - /// - /// - /// - /// - /// 111 2222 33333 - /// - /// - Right, - - /// - /// The items will be aligned to the bottom. - /// Set to to ensure at least one line between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the top items will be clipped (their locations - /// will be negative). - /// - /// - /// and have equivalent behavior. - /// - /// - Bottom, - - /// - /// The group will be centered in the container. - /// If centering is not possible, the group will be left-aligned. - /// Set to to ensure at least one space between - /// each item. - /// - /// - /// - /// Extra space will be distributed between the items, biased towards the left. - /// - /// - /// - /// - /// 111 2222 33333 - /// - /// - Centered, - - /// - /// The items will be justified. Space will be added between the items such that the first item - /// is at the start and the right side of the last item against the end. - /// Set to to ensure at least one space between - /// each item. - /// - /// - /// - /// Extra space will be distributed between the items, biased towards the left. - /// - /// - /// - /// - /// 111 2222 33333 - /// - /// - Justified, - - /// - /// The first item will be aligned to the left and the remaining will aligned to the right. - /// Set to to ensure at least one space between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the right items will be clipped (their locations - /// will be greater than the container size). - /// - /// - /// and have equivalent behavior. - /// - /// - /// - /// - /// 111 2222 33333 - /// - /// - FirstLeftRestRight, - - /// - /// The first item will be aligned to the top and the remaining will aligned to the bottom. - /// Set to to ensure at least one line between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the bottom items will be clipped (their locations - /// will be greater than the container size). - /// - /// - /// and have equivalent behavior. - /// - /// - FirstTopRestBottom, - - /// - /// The last item will be aligned to the right and the remaining will aligned to the left. - /// Set to to ensure at least one space between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the left items will be clipped (their locations - /// will be negative). - /// - /// - /// and have equivalent behavior. - /// - /// - /// - /// - /// 111 2222 33333 - /// - /// - LastRightRestLeft, - - /// - /// The last item will be aligned to the bottom and the remaining will aligned to the left. - /// Set to to ensure at least one line between - /// each item. - /// - /// - /// - /// If the container is smaller than the total size of the items, the top items will be clipped (their locations - /// will be negative). - /// - /// - /// and have equivalent behavior. - /// - /// - LastBottomRestTop -} - /// /// Aligns items within a container based on the specified . Both horizontal and vertical alignments are supported. /// diff --git a/Terminal.Gui/Drawing/Alignment.cs b/Terminal.Gui/Drawing/Alignment.cs new file mode 100644 index 000000000..917d32394 --- /dev/null +++ b/Terminal.Gui/Drawing/Alignment.cs @@ -0,0 +1,191 @@ +namespace Terminal.Gui; + +/// +/// Controls how the aligns items within a container. +/// +public enum Alignment +{ + /// + /// The items will be aligned to the left. + /// Set to to ensure at least one space between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the right items will be clipped (their locations + /// will be greater than the container size). + /// + /// + /// and have equivalent behavior. + /// + /// + /// + /// + /// 111 2222 33333 + /// + /// + Left = 0, + + /// + /// The items will be aligned to the top. + /// Set to to ensure at least one line between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the bottom items will be clipped (their locations + /// will be greater than the container size). + /// + /// + /// and have equivalent behavior. + /// + /// + Top, + + /// + /// The items will be aligned to the right. + /// Set to to ensure at least one space between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the left items will be clipped (their locations + /// will be negative). + /// + /// + /// and have equivalent behavior. + /// + /// + /// + /// + /// 111 2222 33333 + /// + /// + Right, + + /// + /// The items will be aligned to the bottom. + /// Set to to ensure at least one line between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the top items will be clipped (their locations + /// will be negative). + /// + /// + /// and have equivalent behavior. + /// + /// + Bottom, + + /// + /// The group will be centered in the container. + /// If centering is not possible, the group will be left-aligned. + /// Set to to ensure at least one space between + /// each item. + /// + /// + /// + /// Extra space will be distributed between the items, biased towards the left. + /// + /// + /// + /// + /// 111 2222 33333 + /// + /// + Centered, + + /// + /// The items will be justified. Space will be added between the items such that the first item + /// is at the start and the right side of the last item against the end. + /// Set to to ensure at least one space between + /// each item. + /// + /// + /// + /// Extra space will be distributed between the items, biased towards the left. + /// + /// + /// + /// + /// 111 2222 33333 + /// + /// + Justified, + + /// + /// The first item will be aligned to the left and the remaining will aligned to the right. + /// Set to to ensure at least one space between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the right items will be clipped (their locations + /// will be greater than the container size). + /// + /// + /// and have equivalent behavior. + /// + /// + /// + /// + /// 111 2222 33333 + /// + /// + FirstLeftRestRight, + + /// + /// The first item will be aligned to the top and the remaining will aligned to the bottom. + /// Set to to ensure at least one line between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the bottom items will be clipped (their locations + /// will be greater than the container size). + /// + /// + /// and have equivalent behavior. + /// + /// + FirstTopRestBottom, + + /// + /// The last item will be aligned to the right and the remaining will aligned to the left. + /// Set to to ensure at least one space between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the left items will be clipped (their locations + /// will be negative). + /// + /// + /// and have equivalent behavior. + /// + /// + /// + /// + /// 111 2222 33333 + /// + /// + LastRightRestLeft, + + /// + /// The last item will be aligned to the bottom and the remaining will aligned to the left. + /// Set to to ensure at least one line between + /// each item. + /// + /// + /// + /// If the container is smaller than the total size of the items, the top items will be clipped (their locations + /// will be negative). + /// + /// + /// and have equivalent behavior. + /// + /// + LastBottomRestTop +} \ No newline at end of file