|
@@ -899,10 +899,7 @@ namespace Terminal.Gui {
|
|
|
Move (frame.X, frame.Y);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Gets or sets a value indicating whether this <see cref="T:Terminal.Gui.View"/> has focus.
|
|
|
- /// </summary>
|
|
|
- /// <value><c>true</c> if has focus; otherwise, <c>false</c>.</value>
|
|
|
+ /// <inheritdoc cref="HasFocus"/>
|
|
|
public override bool HasFocus {
|
|
|
get {
|
|
|
return base.HasFocus;
|
|
@@ -925,12 +922,14 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc cref="OnEnter"/>
|
|
|
public override bool OnEnter ()
|
|
|
{
|
|
|
Enter?.Invoke (this, new EventArgs ());
|
|
|
return base.OnEnter ();
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc cref="OnLeave"/>
|
|
|
public override bool OnLeave ()
|
|
|
{
|
|
|
Leave?.Invoke (this, new EventArgs ());
|
|
@@ -1067,11 +1066,11 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Invoked when a character key is pressed and occurs after the key down event.
|
|
|
+ /// Invoked when a character key is pressed and occurs after the key up event.
|
|
|
/// </summary>
|
|
|
public Action<KeyEvent> OnKeyPress;
|
|
|
|
|
|
- /// <param name="keyEvent">Contains the details about the key that produced the event.</param>
|
|
|
+ /// <inheritdoc cref="ProcessKey"/>
|
|
|
public override bool ProcessKey (KeyEvent keyEvent)
|
|
|
{
|
|
|
OnKeyPress?.Invoke (keyEvent);
|
|
@@ -1081,10 +1080,9 @@ namespace Terminal.Gui {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- /// <param name="keyEvent">Contains the details about the key that produced the event.</param>
|
|
|
+ /// <inheritdoc cref="ProcessHotKey"/>
|
|
|
public override bool ProcessHotKey (KeyEvent keyEvent)
|
|
|
{
|
|
|
- OnKeyPress?.Invoke (keyEvent);
|
|
|
if (subviews == null || subviews.Count == 0)
|
|
|
return false;
|
|
|
foreach (var view in subviews)
|
|
@@ -1093,10 +1091,9 @@ namespace Terminal.Gui {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- /// <param name="keyEvent">Contains the details about the key that produced the event.</param>
|
|
|
+ /// <inheritdoc cref="ProcessColdKey"/>
|
|
|
public override bool ProcessColdKey (KeyEvent keyEvent)
|
|
|
{
|
|
|
- OnKeyPress?.Invoke (keyEvent);
|
|
|
if (subviews == null || subviews.Count == 0)
|
|
|
return false;
|
|
|
foreach (var view in subviews)
|
|
@@ -1110,7 +1107,7 @@ namespace Terminal.Gui {
|
|
|
/// </summary>
|
|
|
public Action<KeyEvent> OnKeyDown;
|
|
|
|
|
|
- /// <param name="keyEvent">Contains the details about the key that produced the event.</param>
|
|
|
+ /// <inheritdoc cref="KeyDown"/>
|
|
|
public override bool KeyDown (KeyEvent keyEvent)
|
|
|
{
|
|
|
OnKeyDown?.Invoke (keyEvent);
|
|
@@ -1128,7 +1125,7 @@ namespace Terminal.Gui {
|
|
|
/// </summary>
|
|
|
public Action<KeyEvent> OnKeyUp;
|
|
|
|
|
|
- /// <param name="keyEvent">Contains the details about the key that produced the event.</param>
|
|
|
+ /// <inheritdoc cref="KeyUp"/>
|
|
|
public override bool KeyUp (KeyEvent keyEvent)
|
|
|
{
|
|
|
OnKeyUp?.Invoke (keyEvent);
|
|
@@ -1140,6 +1137,7 @@ namespace Terminal.Gui {
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Finds the first view in the hierarchy that wants to get the focus if nothing is currently focused, otherwise, it does nothing.
|
|
|
/// </summary>
|
|
@@ -1410,15 +1408,13 @@ namespace Terminal.Gui {
|
|
|
layoutNeeded = false;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:Terminal.Gui.View"/>.
|
|
|
- /// </summary>
|
|
|
- /// <returns>A <see cref="T:System.String"/> that represents the current <see cref="T:Terminal.Gui.View"/>.</returns>
|
|
|
+ /// <inheritdoc cref="ToString"/>
|
|
|
public override string ToString ()
|
|
|
{
|
|
|
return $"{GetType ().Name}({Id})({Frame})";
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc cref="OnMouseEnter(Gui.MouseEvent)"/>
|
|
|
public override bool OnMouseEnter (MouseEvent mouseEvent)
|
|
|
{
|
|
|
if (!base.OnMouseEnter (mouseEvent)) {
|
|
@@ -1428,6 +1424,7 @@ namespace Terminal.Gui {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc cref="OnMouseLeave(Gui.MouseEvent)"/>
|
|
|
public override bool OnMouseLeave (MouseEvent mouseEvent)
|
|
|
{
|
|
|
if (!base.OnMouseLeave (mouseEvent)) {
|
|
@@ -1470,10 +1467,25 @@ namespace Terminal.Gui {
|
|
|
/// </remarks>
|
|
|
public class Toplevel : View {
|
|
|
/// <summary>
|
|
|
- /// This flag is checked on each iteration of the mainloop and it continues
|
|
|
- /// running until this flag is set to false.
|
|
|
+ /// Gets or sets whether the <see cref="T:Terminal.Gui.MainLoop"/> for this <see cref="T:Terminal.Gui.Toplevel"/> is running or not. Setting
|
|
|
+ /// this property to false will cause the MainLoop to exit.
|
|
|
/// </summary>
|
|
|
- public bool Running;
|
|
|
+ public bool Running { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Fired once the Toplevel's <see cref="T:Terminal.Gui.MainLoop"/> has started it's first iteration.
|
|
|
+ /// Subscribe to this event to perform tasks when the <see cref="T:Terminal.Gui.Toplevel"/> has been laid out and focus has been set.
|
|
|
+ /// changes. A Ready event handler is a good place to finalize initialization after calling `<see cref="T:Terminal.Gui.Application.Run"/>(topLevel)`.
|
|
|
+ /// </summary>
|
|
|
+ public event EventHandler Ready;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Called from Application.RunLoop after the <see cref="T:Terminal.Gui.Toplevel"/> has entered it's first iteration of the loop.
|
|
|
+ /// </summary>
|
|
|
+ internal virtual void OnReady ()
|
|
|
+ {
|
|
|
+ Ready?.Invoke (this, EventArgs.Empty);
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Initializes a new instance of the <see cref="T:Terminal.Gui.Toplevel"/> class with the specified absolute layout.
|
|
@@ -1508,6 +1520,10 @@ namespace Terminal.Gui {
|
|
|
return new Toplevel (new Rect (0, 0, Driver.Cols, Driver.Rows));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether this <see cref="T:Terminal.Gui.Toplevel"/> can focus.
|
|
|
+ /// </summary>
|
|
|
+ /// <value><c>true</c> if can focus; otherwise, <c>false</c>.</value>
|
|
|
public override bool CanFocus {
|
|
|
get => true;
|
|
|
}
|
|
@@ -1529,6 +1545,7 @@ namespace Terminal.Gui {
|
|
|
/// </summary>
|
|
|
public bool HasStatusBar { get; set; }
|
|
|
|
|
|
+ ///<inheritdoc cref="ProcessKey"/>
|
|
|
public override bool ProcessKey (KeyEvent keyEvent)
|
|
|
{
|
|
|
if (base.ProcessKey (keyEvent))
|
|
@@ -1580,6 +1597,7 @@ namespace Terminal.Gui {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ ///<inheritdoc cref="Add"/>
|
|
|
public override void Add (View view)
|
|
|
{
|
|
|
if (this == Application.Top) {
|
|
@@ -1591,6 +1609,7 @@ namespace Terminal.Gui {
|
|
|
base.Add (view);
|
|
|
}
|
|
|
|
|
|
+ ///<inheritdoc cref="Remove"/>
|
|
|
public override void Remove (View view)
|
|
|
{
|
|
|
if (this == Application.Top) {
|
|
@@ -1602,6 +1621,7 @@ namespace Terminal.Gui {
|
|
|
base.Remove (view);
|
|
|
}
|
|
|
|
|
|
+ ///<inheritdoc cref="RemoveAll"/>
|
|
|
public override void RemoveAll ()
|
|
|
{
|
|
|
if (this == Application.Top) {
|
|
@@ -1656,6 +1676,7 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ ///<inheritdoc cref="Redraw"/>
|
|
|
public override void Redraw (Rect region)
|
|
|
{
|
|
|
Application.CurrentView = this;
|
|
@@ -1838,6 +1859,7 @@ namespace Terminal.Gui {
|
|
|
contentView.RemoveAll ();
|
|
|
}
|
|
|
|
|
|
+ ///<inheritdoc cref="Redraw"/>
|
|
|
public override void Redraw (Rect bounds)
|
|
|
{
|
|
|
Application.CurrentView = this;
|
|
@@ -1873,6 +1895,7 @@ namespace Terminal.Gui {
|
|
|
//
|
|
|
internal static Point? dragPosition;
|
|
|
Point start;
|
|
|
+ ///<inheritdoc cref="MouseEvent(Gui.MouseEvent)"/>
|
|
|
public override bool MouseEvent (MouseEvent mouseEvent)
|
|
|
{
|
|
|
// FIXED:The code is currently disabled, because the
|
|
@@ -2409,8 +2432,15 @@ namespace Terminal.Gui {
|
|
|
if (state.Toplevel == null)
|
|
|
throw new ObjectDisposedException ("state");
|
|
|
|
|
|
+ bool firstIteration = true;
|
|
|
for (state.Toplevel.Running = true; state.Toplevel.Running;) {
|
|
|
if (MainLoop.EventsPending (wait)) {
|
|
|
+ // Notify Toplevel it's ready
|
|
|
+ if (firstIteration) {
|
|
|
+ state.Toplevel.OnReady ();
|
|
|
+ }
|
|
|
+ firstIteration = false;
|
|
|
+
|
|
|
MainLoop.MainIteration ();
|
|
|
Iteration?.Invoke (null, EventArgs.Empty);
|
|
|
} else if (wait == false)
|
|
@@ -2426,7 +2456,7 @@ namespace Terminal.Gui {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- internal static bool DebugDrawBounds;
|
|
|
+ internal static bool DebugDrawBounds = false;
|
|
|
|
|
|
// Need to look into why this does not work properly.
|
|
|
static void DrawBounds (View v)
|