From 33e870d4c9994d88e726902d0d45e47e4f8324ed Mon Sep 17 00:00:00 2001 From: Tig Date: Mon, 6 May 2024 08:25:52 -0600 Subject: [PATCH] Code Cleanup --- Terminal.Gui/View/Layout/PosDim.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Terminal.Gui/View/Layout/PosDim.cs b/Terminal.Gui/View/Layout/PosDim.cs index cb1b01a02..2bd0cb0ad 100644 --- a/Terminal.Gui/View/Layout/PosDim.cs +++ b/Terminal.Gui/View/Layout/PosDim.cs @@ -917,15 +917,31 @@ public class Dim } } + /// + /// A object that automatically sizes the view to fit all the view's SubViews and/or Text. + /// + /// + /// + /// See . + /// + /// + /// + /// Specifies how will compute the dimension. The default is . + /// + /// Specifies the minimum dimension that view will be automatically sized to. + /// Specifies the maximum dimension that view will be automatically sized to. NOT CURRENTLY SUPPORTED. public class DimAuto (DimAutoStyle style, Dim min, Dim max) : Dim { internal readonly Dim _max = max; internal readonly Dim _min = min; internal readonly DimAutoStyle _style = style; - internal int Size; + internal int _size; + /// public override bool Equals (object other) { return other is DimAuto auto && auto._min == _min && auto._max == _max && auto._style == _style; } + /// public override int GetHashCode () { return HashCode.Combine (base.GetHashCode (), _min, _max, _style); } + /// public override string ToString () { return $"Auto({_style},{_min},{_max})"; } internal override int Calculate (int location, int superviewContentSize, View us, Dimension dimension) @@ -956,7 +972,7 @@ public class Dim { if (us._contentSize is { }) { - subviewsSize = dimension == Dimension.Width ? us.ContentSize.Value.Width : us.ContentSize.Value.Height; + subviewsSize = dimension == Dimension.Width ? us.ContentSize!.Value.Width : us.ContentSize!.Value.Height; } else { @@ -968,7 +984,7 @@ public class Dim for (int i = 0; i < us.Subviews.Count; i++) { var v = us.Subviews [i]; - bool isNotPosAnchorEnd = dimension == Dim.Dimension.Width ? !(v.X is Pos.PosAnchorEnd) : !(v.Y is Pos.PosAnchorEnd); + bool isNotPosAnchorEnd = dimension == Dim.Dimension.Width ? v.X is not Pos.PosAnchorEnd : v.Y is not Pos.PosAnchorEnd; //if (!isNotPosAnchorEnd) //{