namespace Terminal.Gui;
/// The Padding for a .
///
/// See the class.
///
public class Padding : Adornment
{
///
public Padding ()
{ /* Do nothing; A parameter-less constructor is required to support all views unit tests. */
}
///
public Padding (View parent) : base (parent)
{
/* Do nothing; View.CreateAdornment requires a constructor that takes a parent */
}
///
/// The color scheme for the Padding. If set to , gets the
/// scheme. color scheme.
///
public override ColorScheme ColorScheme
{
get
{
if (base.ColorScheme is { })
{
return base.ColorScheme;
}
return Parent?.ColorScheme;
}
set
{
base.ColorScheme = value;
Parent?.SetNeedsDisplay ();
}
}
/// Called when a mouse event occurs within the Padding.
///
///
/// The coordinates are relative to .
///
///
/// A mouse click on the Padding will cause the Parent to focus.
///
///
///
/// , if the event was handled, otherwise.
protected internal override bool OnMouseEvent (MouseEvent mouseEvent)
{
if (Parent is null)
{
return false;
}
if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked))
{
if (Parent.CanFocus && !Parent.HasFocus)
{
Parent.SetFocus ();
Parent.SetNeedsDisplay ();
return mouseEvent.Handled = true;
}
}
return false;
}
}