#nullable enable
namespace Terminal.Gui.ViewBase;
/// The Padding for a . Accessed via
///
/// 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 */
}
/// 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 override bool OnMouseEvent (MouseEventArgs mouseEvent)
{
if (Parent is null)
{
return false;
}
if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked))
{
if (Parent.CanFocus && !Parent.HasFocus)
{
Parent.SetFocus ();
Parent.SetNeedsDraw ();
return mouseEvent.Handled = true;
}
}
return false;
}
}