Skip to content

Commit 5f64f4f

Browse files
committed
Window -> not sizeable/movable by default.
Window: Code cleanup. Frameview: Code cleanup.
1 parent 9c3be44 commit 5f64f4f

File tree

6 files changed

+121
-105
lines changed

6 files changed

+121
-105
lines changed

Terminal.Gui/Views/FrameView.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
namespace Terminal.Gui;
1+
#nullable enable
2+
namespace Terminal.Gui;
23

34
// TODO: FrameView is mis-named, really. It's far more about it being a TabGroup than a frame.
5+
46
/// <summary>
5-
/// The FrameView is a container View with a border around it.
7+
/// A non-overlapped container for other views with a border and optional title.
68
/// </summary>
9+
/// <remarks>
10+
/// <para>
11+
/// FrameView has <see cref="View.BorderStyle"/> set to <see cref="LineStyle.Single"/> and
12+
/// inherits it's color scheme from the <see cref="SuperView"/>.
13+
/// </para>
14+
/// <para>
15+
///
16+
/// </para>
17+
/// </remarks>
18+
/// <seealso cref="Window"/>
719
public class FrameView : View
820
{
921
/// <summary>
@@ -14,21 +26,9 @@ public FrameView ()
1426
{
1527
CanFocus = true;
1628
TabStop = TabBehavior.TabGroup;
17-
Border.Thickness = new Thickness (1);
18-
Border.LineStyle = DefaultBorderStyle;
19-
20-
//Border.ColorScheme = ColorScheme;
21-
Border.Data = "Border";
22-
MouseClick += FrameView_MouseClick;
23-
}
24-
25-
private void FrameView_MouseClick (object sender, MouseEventArgs e)
26-
{
27-
// base sets focus on HotKey
28-
e.Handled = InvokeCommand<KeyBinding> (Command.HotKey, new ([Command.HotKey], this, this)) == true;
29+
BorderStyle = DefaultBorderStyle;
2930
}
3031

31-
3232
/// <summary>
3333
/// The default <see cref="LineStyle"/> for <see cref="FrameView"/>'s border. The default is
3434
/// <see cref="LineStyle.Single"/>.

Terminal.Gui/Views/Window.cs

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
1-
namespace Terminal.Gui;
1+
#nullable enable
2+
namespace Terminal.Gui;
23

34
/// <summary>
4-
/// A <see cref="Toplevel"/> <see cref="View"/> with <see cref="View.BorderStyle"/> set to
5-
/// <see cref="LineStyle.Single"/>. Provides a container for other views.
5+
/// An overlapped container for other views with a border and optional title.
66
/// </summary>
77
/// <remarks>
88
/// <para>
9-
/// If any subview is a button and the <see cref="Button.IsDefault"/> property is set to true, the Enter key will
10-
/// invoke the <see cref="Command.Accept"/> command on that subview.
9+
/// Window has <see cref="View.BorderStyle"/> set to <see cref="LineStyle.Single"/>, <see cref="View.Arrangement"/>
10+
/// set to <see cref="ViewArrangement.Overlapped"/>, and
11+
/// uses the Base <see cref="Colors.ColorSchemes"/> color scheme by default.
12+
/// </para>
13+
/// <para>
14+
/// To enable Window to be sized and moved by the user, adjust <see cref="View.Arrangement"/>.
1115
/// </para>
1216
/// </remarks>
17+
/// <seealso cref="FrameView"/>
1318
public class Window : Toplevel
1419
{
15-
16-
/// <summary>
17-
/// Gets or sets whether all <see cref="Window"/>s are shown with a shadow effect by default.
18-
/// </summary>
19-
[SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
20-
public static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None;
21-
22-
2320
/// <summary>
2421
/// Initializes a new instance of the <see cref="Window"/> class.
2522
/// </summary>
2623
public Window ()
2724
{
2825
CanFocus = true;
2926
TabStop = TabBehavior.TabGroup;
30-
Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped | ViewArrangement.Resizable;
31-
ColorScheme = Colors.ColorSchemes ["Base"]; // TODO: make this a theme property
27+
Arrangement = ViewArrangement.Overlapped;
28+
base.ColorScheme = Colors.ColorSchemes ["Base"]; // TODO: make this a theme property
3229
BorderStyle = DefaultBorderStyle;
33-
ShadowStyle = DefaultShadow;
30+
base.ShadowStyle = DefaultShadow;
3431
}
3532

33+
/// <summary>
34+
/// Gets or sets whether all <see cref="Window"/>s are shown with a shadow effect by default.
35+
/// </summary>
36+
[SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
37+
public static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None;
38+
3639
// TODO: enable this
3740
///// <summary>
3841
///// The default <see cref="LineStyle"/> for <see cref="Window"/>'s border. The default is <see cref="LineStyle.Single"/>.

UICatalog/Scenarios/Adornments.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override void Main ()
3434
var window = new Window
3535
{
3636
Title = "The _Window",
37-
Arrangement = ViewArrangement.Movable,
37+
Arrangement = ViewArrangement.Overlapped | ViewArrangement.Movable,
3838

3939
Width = Dim.Fill (Dim.Func (() => editor.Frame.Width )),
4040
Height = Dim.Fill ()

0 commit comments

Comments
 (0)