Fixed FastFlags thing

This commit is contained in:
Tig
2024-05-23 07:35:58 -06:00
parent 6df35c0631
commit f08f9c9567
8 changed files with 13 additions and 19 deletions

View File

@@ -242,7 +242,7 @@ public class Adornment : View
return base.OnMouseEnter (mouseEvent);
}
/// <inheritdoc/>
/// <inheritdoc/>
protected internal override bool OnMouseLeave (MouseEvent mouseEvent)
{
// Invert Normal

View File

@@ -150,11 +150,7 @@ public abstract class Dim
/// <summary>Creates a percentage <see cref="Dim"/> object that is a percentage of the width or height of the SuperView.</summary>
/// <returns>The percent <see cref="Dim"/> object.</returns>
/// <param name="percent">A value between 0 and 100 representing the percentage.</param>
/// <param name="usePosition">
/// If <see langword="true"/> the dimension is computed using the View's position (<see cref="View.X"/> or
/// <see cref="View.Y"/>).
/// If <see langword="false"/> the dimension is computed using the View's <see cref="View.ContentSize"/>.
/// </param>
/// <param name="mode"></param>
/// <example>
/// This initializes a <see cref="TextField"/> that will be centered horizontally, is 50% of the way down, is 30% the
/// height,

View File

@@ -60,13 +60,13 @@ public class DimAuto () : Dim
var subviewsSize = 0;
int autoMin = MinimumContentDim?.GetAnchor (superviewContentSize) ?? 0;
if (Style.HasFlag (DimAutoStyle.Text))
if (Style.FastHasFlags (DimAutoStyle.Text))
{
textSize = int.Max (autoMin, dimension == Dimension.Width ? us.TextFormatter.Size.Width : us.TextFormatter.Size.Height);
}
if (Style.HasFlag (DimAutoStyle.Content))
if (Style.FastHasFlags (DimAutoStyle.Content))
{
if (us._contentSize is { })
{

View File

@@ -5,8 +5,8 @@ namespace Terminal.Gui;
/// <summary>
/// Specifies how <see cref="Dim.Auto"/> will compute the dimension.
/// </summary>
[GenerateEnumExtensionMethods]
[Flags]
[GenerateEnumExtensionMethods (FastHasFlags = true)]
public enum DimAutoStyle
{
/// <summary>

View File

@@ -1049,13 +1049,13 @@ public partial class View
// Verify none of the subviews are using Dim objects that depend on the SuperView's dimensions.
foreach (View view in Subviews)
{
if (widthAuto is { } && widthAuto.Style.HasFlag (DimAutoStyle.Content) && _contentSize is null)
if (widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Content) && _contentSize is null)
{
ThrowInvalid (view, view.Width, nameof (view.Width));
ThrowInvalid (view, view.X, nameof (view.X));
}
if (heightAuto is { } && heightAuto.Style.HasFlag (DimAutoStyle.Content) && _contentSize is null)
if (heightAuto is { } && heightAuto.Style.FastHasFlags (DimAutoStyle.Content) && _contentSize is null)
{
ThrowInvalid (view, view.Height, nameof (view.Height));
ThrowInvalid (view, view.Y, nameof (view.Y));

View File

@@ -186,17 +186,17 @@ public partial class View
// Use _width & _height instead of Width & Height to avoid debug spew
DimAuto widthAuto = _width as DimAuto;
DimAuto heightAuto = _height as DimAuto;
if ((widthAuto is { } && widthAuto.Style.HasFlag (DimAutoStyle.Text))
|| (heightAuto is { } && heightAuto.Style.HasFlag (DimAutoStyle.Text)))
if ((widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Text))
|| (heightAuto is { } && heightAuto.Style.FastHasFlags (DimAutoStyle.Text)))
{
size = TextFormatter.GetAutoSize ();
if (widthAuto is null || !widthAuto.Style.HasFlag (DimAutoStyle.Text))
if (widthAuto is null || !widthAuto.Style.FastHasFlags (DimAutoStyle.Text))
{
size.Width = ContentSize.Width;
}
if (heightAuto is null || !heightAuto.Style.HasFlag (DimAutoStyle.Text))
if (heightAuto is null || !heightAuto.Style.FastHasFlags (DimAutoStyle.Text))
{
size.Height = ContentSize.Height;
}

View File

@@ -43,8 +43,6 @@ public class Dialog : Window
//};
private readonly List<Button> _buttons = new ();
private bool _inLayout;
/// <summary>
/// Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/>
/// positioning with no <see cref="Button"/>s.

View File

@@ -411,7 +411,7 @@ public class TileView : View
/// <see cref="Tile.MinSize"/>, location of other splitters etc.
/// </para>
/// <para>
/// Only absolute values (e.g. 10) and percent values (i.e. <see cref="Pos.Percent(float)"/>) are supported for
/// Only absolute values (e.g. 10) and percent values (i.e. <see cref="Pos.Percent(int)"/>) are supported for
/// this property.
/// </para>
/// </summary>