namespace Terminal.Gui.Views;
///
/// A . Supports a simple API for adding s
/// across the bottom. By default, the is centered and used the
/// scheme.
///
///
/// To run the modally, create the , and pass it to
/// . This will execute the dialog until
/// it terminates via the (`Esc` by default),
/// or when one of the views or buttons added to the dialog calls
/// .
///
public class Dialog : Window
{
private static LineStyle _defaultBorderStyle = LineStyle.Heavy; // Resources/config.json overrides
private static Alignment _defaultButtonAlignment = Alignment.End; // Resources/config.json overrides
private static AlignmentModes _defaultButtonAlignmentModes = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems; // Resources/config.json overrides
private static int _defaultMinimumHeight = 80; // Resources/config.json overrides
private static int _defaultMinimumWidth = 80; // Resources/config.json overrides
private static ShadowStyle _defaultShadow = ShadowStyle.Transparent; // Resources/config.json overrides
///
/// Initializes a new instance of the class with no s.
///
///
/// By default, , , , and are
/// set
/// such that the will be centered in, and no larger than 90% of , if
/// there is one. Otherwise,
/// it will be bound by the screen dimensions.
///
public Dialog ()
{
Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped;
base.ShadowStyle = DefaultShadow;
BorderStyle = DefaultBorderStyle;
X = Pos.Center ();
Y = Pos.Center ();
Width = Dim.Auto (DimAutoStyle.Auto, Dim.Percent (DefaultMinimumWidth), Dim.Percent (90));
Height = Dim.Auto (DimAutoStyle.Auto, Dim.Percent (DefaultMinimumHeight), Dim.Percent (90));
SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Dialog);
Modal = true;
ButtonAlignment = DefaultButtonAlignment;
ButtonAlignmentModes = DefaultButtonAlignmentModes;
}
private readonly List