mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 09:47:58 +01:00
Updated api docs
This commit is contained in:
@@ -110,6 +110,13 @@ public class Thickness : IEquatable<Thickness>
|
||||
return new Thickness (Left + other.Left, Top + other.Top, Right + other.Right, Bottom + other.Bottom);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the thickness widths of another <see cref="Thickness"/> to another <see cref="Thickness"/>.
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static Thickness operator + (Thickness a, Thickness b) { return a.Add (b); }
|
||||
|
||||
/// <summary>Draws the <see cref="Thickness"/> rectangle with an optional diagnostics label.</summary>
|
||||
/// <remarks>
|
||||
|
||||
@@ -30,15 +30,6 @@ public class Adornment : View
|
||||
/// <param name="parent"></param>
|
||||
public Adornment (View parent) { Parent = parent; }
|
||||
|
||||
///// <summary>
|
||||
///// Helper to get the X and Y offset of the Bounds from the Adornment Frame. This is the Left and Top properties
|
||||
///// of <see cref="Thickness"/>.
|
||||
///// </summary>
|
||||
//public override Point GetBoundsOffset ()
|
||||
//{
|
||||
// return new (Thickness.Left, Thickness.Top);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rectangle that describes the area of the Adornment. The Location is always (0,0).
|
||||
/// The size is the size of the Frame
|
||||
@@ -47,6 +38,7 @@ public class Adornment : View
|
||||
{
|
||||
get => new (Point.Empty, Frame.Size);
|
||||
// QUESTION: So why even have a setter then?
|
||||
// ANSWER: Because this is an override of a base class property, and the base class has a setter.
|
||||
set => throw new InvalidOperationException ("It makes no sense to set Bounds of a Thickness.");
|
||||
}
|
||||
|
||||
@@ -103,7 +95,7 @@ public class Adornment : View
|
||||
}
|
||||
|
||||
// Adornments are *Children* of a View, not SubViews. Thus View.FrameToScreen will not work.
|
||||
// To get the screen-relative coordinates of a Adornment, we need get the parent's Frame
|
||||
// To get the screen-relative coordinates of an Adornment, we need get the parent's Frame
|
||||
// in screen coords, and add our Frame location to it.
|
||||
Rectangle parent = Parent.FrameToScreen ();
|
||||
return new (new (parent.X + Frame.X, parent.Y + Frame.Y), Frame.Size);
|
||||
|
||||
@@ -86,8 +86,8 @@ public partial class View
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The adornment (specified as a <see cref="Thickness"/>) inside of the view that offsets the
|
||||
/// <see cref="Bounds"/> from the <see cref="Margin"/>. The Border provides the space for a visual border (drawn using
|
||||
/// The <see cref="Adornment"/> that offsets the <see cref="Bounds"/> from the <see cref="Margin"/>.
|
||||
/// The Border provides the space for a visual border (drawn using
|
||||
/// line-drawing glyphs) and the Title. The Border expands inward; in other words if `Border.Thickness.Top == 2` the
|
||||
/// border and title will take up the first row and the second row will be filled with spaces.
|
||||
/// </summary>
|
||||
@@ -181,7 +181,7 @@ public partial class View
|
||||
return Rectangle.Empty with { Size = Frame.Size };
|
||||
}
|
||||
|
||||
Thickness totalThickness = Margin.Thickness.Add (Border.Thickness.Add (Padding.Thickness));
|
||||
Thickness totalThickness = GetAdornmentsThickness ();
|
||||
int width = Math.Max (0, Frame.Size.Width - totalThickness.Horizontal);
|
||||
int height = Math.Max (0, Frame.Size.Height - totalThickness.Vertical);
|
||||
|
||||
@@ -199,20 +199,10 @@ public partial class View
|
||||
);
|
||||
}
|
||||
#endif // DEBUG
|
||||
Thickness totalThickness = Margin.Thickness.Add (Border.Thickness.Add (Padding.Thickness));
|
||||
Thickness totalThickness = GetAdornmentsThickness ();
|
||||
Frame = Frame with
|
||||
{
|
||||
Size =
|
||||
new (
|
||||
value.Size.Width + totalThickness.Horizontal,
|
||||
//+ Margin.Thickness.Horizontal
|
||||
//+ Border.Thickness.Horizontal
|
||||
//+ Padding.Thickness.Horizontal,
|
||||
value.Size.Height + totalThickness.Vertical
|
||||
//+ Margin.Thickness.Vertical
|
||||
//+ Border.Thickness.Vertical
|
||||
//+ Padding.Thickness.Vertical
|
||||
)
|
||||
Size = new (value.Size.Width + totalThickness.Horizontal, value.Size.Height + totalThickness.Vertical)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -343,7 +333,7 @@ public partial class View
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The frame (specified as a <see cref="Thickness"/>) that separates a View from other SubViews of the same
|
||||
/// The <see cref="Adornment"/> that that separates a View from other SubViews of the same
|
||||
/// SuperView. The margin offsets the <see cref="Bounds"/> from the <see cref="Frame"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -360,7 +350,7 @@ public partial class View
|
||||
public Margin Margin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The frame (specified as a <see cref="Thickness"/>) inside of the view that offsets the <see cref="Bounds"/>
|
||||
/// The <see cref="Adornment"/> inside of the view that offsets the <see cref="Bounds"/>
|
||||
/// from the <see cref="Border"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -589,12 +579,7 @@ public partial class View
|
||||
/// <returns>A thickness that describes the sum of the Adornments' thicknesses.</returns>
|
||||
public Thickness GetAdornmentsThickness ()
|
||||
{
|
||||
int left = Margin.Thickness.Left + Border.Thickness.Left + Padding.Thickness.Left;
|
||||
int top = Margin.Thickness.Top + Border.Thickness.Top + Padding.Thickness.Top;
|
||||
int right = Margin.Thickness.Right + Border.Thickness.Right + Padding.Thickness.Right;
|
||||
int bottom = Margin.Thickness.Bottom + Border.Thickness.Bottom + Padding.Thickness.Bottom;
|
||||
|
||||
return new (left, top, right, bottom);
|
||||
return Margin.Thickness + Border.Thickness + Padding.Thickness;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user