using System.Text.Json.Serialization;
namespace Terminal.Gui;
///
/// The FrameView is a container frame that draws a frame around the contents. It is similar to a GroupBox in
/// Windows.
///
public class FrameView : View
{
///
/// Initializes a new instance of the class using
/// layout.
///
public FrameView ()
{
Border.Thickness = new Thickness (1);
Border.LineStyle = DefaultBorderStyle;
//Border.ColorScheme = ColorScheme;
Border.Data = "Border";
MouseClick += FrameView_MouseClick;
}
private void FrameView_MouseClick (object sender, MouseEventEventArgs e)
{
e.Handled = InvokeCommand (Command.HotKey) == true;
}
///
/// The default for 's border. The default is
/// .
///
///
/// This property can be set in a Theme to change the default for all
/// s.
///
[SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
[JsonConverter (typeof (JsonStringEnumConverter))]
public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
///
public override bool OnEnter (View view)
{
if (Subviews.Count == 0 || !Subviews.Any (subview => subview.CanFocus))
{
Application.Driver?.SetCursorVisibility (CursorVisibility.Invisible);
}
return base.OnEnter (view);
}
}