diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs
index 0048f3909..17f318063 100644
--- a/Terminal.Gui/View/Adornment/Adornment.cs
+++ b/Terminal.Gui/View/Adornment/Adornment.cs
@@ -18,7 +18,6 @@
///
public class Adornment : View
{
- // BUGBUG: This should not be static! It should be a property of the Application class.
private Point? _dragPosition;
private Point _startGrabPoint;
@@ -206,7 +205,7 @@ public class Adornment : View
}
// TODO: Checking for Toplevel is a hack until #2537 is fixed
- if (!Parent.CanFocus || Parent is not Toplevel)
+ if (!Parent.CanFocus || !Parent.Arrangement.HasFlag(ViewArrangement.Movable))
{
return true;
}
diff --git a/Terminal.Gui/View/View.cs b/Terminal.Gui/View/View.cs
index 32d9e584c..53831cbde 100644
--- a/Terminal.Gui/View/View.cs
+++ b/Terminal.Gui/View/View.cs
@@ -73,7 +73,8 @@ namespace Terminal.Gui;
/// a View can be accessed with the property.
///
///
-/// To flag a region of the View's to be redrawn call .
+/// To flag a region of the View's to be redrawn call
+/// .
/// To flag the entire view for redraw call .
///
///
@@ -211,6 +212,13 @@ public partial class View : Responder, ISupportInitializeNotification
}
}
+ ///
+ /// Cancelable event fired when the command is invoked. Set
+ ///
+ /// to cancel the event.
+ ///
+ public event EventHandler Accept;
+
/// Event fired when the value is being changed.
public event EventHandler EnabledChanged;
@@ -227,24 +235,6 @@ public partial class View : Responder, ISupportInitializeNotification
/// Event fired when the value is being changed.
public event EventHandler VisibleChanged;
- ///
- /// Cancelable event fired when the command is invoked. Set
- /// to cancel the event.
- ///
- public event EventHandler Accept;
-
- ///
- /// Called when the command is invoked. Fires the
- /// event.
- ///
- /// If the event was canceled.
- protected bool? OnAccept ()
- {
- var args = new CancelEventArgs ();
- Accept?.Invoke (this, args);
- return args.Cancel;
- }
-
///
protected override void Dispose (bool disposing)
{
@@ -268,6 +258,19 @@ public partial class View : Responder, ISupportInitializeNotification
Debug.Assert (InternalSubviews.Count == 0);
}
+ ///
+ /// Called when the command is invoked. Fires the
+ /// event.
+ ///
+ /// If the event was canceled.
+ protected bool? OnAccept ()
+ {
+ var args = new CancelEventArgs ();
+ Accept?.Invoke (this, args);
+
+ return args.Cancel;
+ }
+
private bool CanBeVisible (View view)
{
if (!view.Visible)
@@ -508,3 +511,4 @@ public partial class View : Responder, ISupportInitializeNotification
#endregion Constructors and Initialization
}
+
diff --git a/Terminal.Gui/View/ViewArrangement.cs b/Terminal.Gui/View/ViewArrangement.cs
new file mode 100644
index 000000000..e6d0371b1
--- /dev/null
+++ b/Terminal.Gui/View/ViewArrangement.cs
@@ -0,0 +1,63 @@
+namespace Terminal.Gui;
+
+///
+/// Describes what user actions are enabled for arranging a within it's .
+///
+[Flags]
+public enum ViewArrangement
+{
+ ///
+ /// The view can neither be moved nor resized.
+ ///
+ Fixed = 0,
+
+ ///
+ /// The view can be moved within it's .
+ ///
+ Movable = 1,
+
+ ///
+ /// The left edge of the view can be resized.
+ ///
+ LeftResizable = 2,
+
+ ///
+ /// The right edge of the view can be resized.
+ ///
+ RightResizable = 4,
+
+ ///
+ /// The top edge of the view can be resized.
+ ///
+ ///
+ /// This flag is mutually exclusive with . If both are set, takes
+ /// precedence.
+ ///
+ TopResizable = 8,
+
+ ///
+ /// The bottom edge of the view can be resized.
+ ///
+ BottomResizable = 16,
+
+ ///
+ /// The view can be resized in any direction.
+ ///
+ ///
+ /// If is also set, the top will not be resizable.
+ ///
+ Resizable = LeftResizable | RightResizable | TopResizable | BottomResizable
+}
+public partial class View
+{
+ ///
+ /// Gets or sets the user actions that are enabled for the view within it's .
+ ///
+ ///
+ ///
+ /// Sizing or moving a view is only possible if the is part of a and
+ /// the relevant position and dimensions of the are independent of other SubViews
+ ///
+ ///
+ public ViewArrangement Arrangement { get; set; }
+}
diff --git a/Terminal.Gui/Views/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs
index 2ec254da8..17ecb1b66 100644
--- a/Terminal.Gui/Views/Toplevel.cs
+++ b/Terminal.Gui/Views/Toplevel.cs
@@ -27,6 +27,7 @@ public partial class Toplevel : View
///
public Toplevel ()
{
+ Arrangement = ViewArrangement.Movable;
Width = Dim.Fill ();
Height = Dim.Fill ();