mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 01:38:01 +01:00
Inlined code
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Terminal.Gui;
|
||||
/// Represents a dimension that is a combination of two other dimensions.
|
||||
/// </summary>
|
||||
/// <param name="add">
|
||||
/// Indicates whether the two dimensions are added or subtracted.
|
||||
/// Indicates whether the two dimensions are added or subtracted.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// This is a low-level API that is typically used internally by the layout system. Use the various static
|
||||
@@ -35,31 +35,28 @@ public class DimCombine (AddOrSubtract add, Dim? left, Dim? right) : Dim
|
||||
|
||||
internal override int GetAnchor (int size)
|
||||
{
|
||||
int la = Left!.GetAnchor (size);
|
||||
int ra = Right!.GetAnchor (size);
|
||||
|
||||
if (Add == AddOrSubtract.Add)
|
||||
{
|
||||
return la + ra;
|
||||
return Left!.GetAnchor (size) + Right!.GetAnchor (size);
|
||||
}
|
||||
|
||||
return la - ra;
|
||||
return Left!.GetAnchor (size) - Right!.GetAnchor (size);
|
||||
}
|
||||
|
||||
internal override int Calculate (int location, int superviewContentSize, View us, Dimension dimension)
|
||||
{
|
||||
int leftNewDim = Left!.Calculate (location, superviewContentSize, us, dimension);
|
||||
int rightNewDim = Right!.Calculate (location, superviewContentSize, us, dimension);
|
||||
|
||||
int newDimension;
|
||||
|
||||
if (Add == AddOrSubtract.Add)
|
||||
{
|
||||
newDimension = leftNewDim + rightNewDim;
|
||||
newDimension = Left!.Calculate (location, superviewContentSize, us, dimension) + Right!.Calculate (location, superviewContentSize, us, dimension);
|
||||
}
|
||||
else
|
||||
{
|
||||
newDimension = Math.Max (0, leftNewDim - rightNewDim);
|
||||
newDimension = Math.Max (
|
||||
0,
|
||||
Left!.Calculate (location, superviewContentSize, us, dimension)
|
||||
- Right!.Calculate (location, superviewContentSize, us, dimension));
|
||||
}
|
||||
|
||||
return newDimension;
|
||||
@@ -83,4 +80,4 @@ public class DimCombine (AddOrSubtract add, Dim? left, Dim? right) : Dim
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,28 +37,22 @@ public class PosCombine (AddOrSubtract add, Pos left, Pos right) : Pos
|
||||
|
||||
internal override int GetAnchor (int size)
|
||||
{
|
||||
int la = Left.GetAnchor (size);
|
||||
int ra = Right.GetAnchor (size);
|
||||
|
||||
if (Add == AddOrSubtract.Add)
|
||||
{
|
||||
return la + ra;
|
||||
return Left.GetAnchor (size) + Right.GetAnchor (size);
|
||||
}
|
||||
|
||||
return la - ra;
|
||||
return Left.GetAnchor (size) - Right.GetAnchor (size);
|
||||
}
|
||||
|
||||
internal override int Calculate (int superviewDimension, Dim dim, View us, Dimension dimension)
|
||||
{
|
||||
int left = Left.Calculate (superviewDimension, dim, us, dimension);
|
||||
int right = Right.Calculate (superviewDimension, dim, us, dimension);
|
||||
|
||||
if (Add == AddOrSubtract.Add)
|
||||
{
|
||||
return left + right;
|
||||
return Left.Calculate (superviewDimension, dim, us, dimension) + Right.Calculate (superviewDimension, dim, us, dimension);
|
||||
}
|
||||
|
||||
return left - right;
|
||||
return Left.Calculate (superviewDimension, dim, us, dimension) - Right.Calculate (superviewDimension, dim, us, dimension);
|
||||
}
|
||||
|
||||
internal override bool ReferencesOtherViews ()
|
||||
|
||||
Reference in New Issue
Block a user