Fixed warnings

This commit is contained in:
Tig
2024-06-17 06:53:57 -07:00
parent 18f4913693
commit 71e5118cdb
13 changed files with 33 additions and 40 deletions

View File

@@ -177,15 +177,15 @@ public static partial class Application
/// </para>
/// <para>
/// <see cref="Shutdown"/> must be called when the application is closing (typically after
/// <see cref="Run(Func{Exception, bool}, ConsoleDriver)"/> has returned) to ensure resources are cleaned up and
/// <see cref="Run{T}"/> has returned) to ensure resources are cleaned up and
/// terminal settings
/// restored.
/// </para>
/// <para>
/// The <see cref="Run{T}(Func{Exception, bool}, ConsoleDriver)"/> function combines
/// The <see cref="Run{T}"/> function combines
/// <see cref="Init(ConsoleDriver, string)"/> and <see cref="Run(Toplevel, Func{Exception, bool})"/>
/// into a single
/// call. An application cam use <see cref="Run{T}(Func{Exception, bool}, ConsoleDriver)"/> without explicitly calling
/// call. An application cam use <see cref="Run{T}"/> without explicitly calling
/// <see cref="Init(ConsoleDriver, string)"/>.
/// </para>
/// <param name="driver">

View File

@@ -4,7 +4,7 @@ namespace Terminal.Gui;
#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
/// <summary>
/// Provides context for a <see cref="Command"/> that is being invoked.
/// </summary
/// </summary>
/// <remarks>
/// <para>
/// To define a <see cref="Command"/> that is invoked with context,

View File

@@ -336,10 +336,16 @@ public abstract class Pos
/// <returns></returns>
internal virtual bool ReferencesOtherViews () { return false; }
/// <summary>
/// Indicates whether the specified type is in the hierarchy of this Pos object.
/// </summary>
/// <param name="type"></param>
/// <param name="pos"></param>
/// <returns></returns>
public bool Has (Type type, out Pos pos)
{
pos = this;
if (type == GetType())
if (type == GetType ())
{
return true;
}

View File

@@ -107,7 +107,7 @@ public partial class View
/// Called when the <see cref="BorderStyle"/> is changing. Invokes <see cref="BorderStyleChanging"/>, which allows the event to be cancelled.
/// </summary>
/// <remarks>
/// Override <see cref="SetBorderStyle"/> to prevent the <see cref="BorderStyle"/> from changing. Set <see cref="StateEventArgs{T}.Cancel"/> to `true` to cancel the event.
/// Override <see cref="SetBorderStyle"/> to prevent the <see cref="BorderStyle"/> from changing.
/// </remarks>
/// <param name="e"></param>
protected void OnBorderStyleChanging (StateEventArgs<LineStyle> e)
@@ -163,6 +163,9 @@ public partial class View
Border.LineStyle = value;
}
/// <summary>
/// Fired when the <see cref="BorderStyle"/> is changing. Allows the event to be cancelled.
/// </summary>
public event EventHandler<StateEventArgs<LineStyle>> BorderStyleChanging;
/// <summary>

View File

@@ -783,10 +783,11 @@ public partial class View
/// </summary>
/// <param name="commands"></param>
/// <param name="key">The key that caused the commands to be invoked, if any.</param>
/// <param name="keyBinding"></param>
/// <returns>
/// <see langword="null"/> if no command was found.
/// <see langword="true"/> if the command was invoked and it handled the command.
/// <see langword="false"/> if the command was invoked and it did not handle the command.
/// <see langword="true"/> if the command was invoked the command was handled.
/// <see langword="false"/> if the command was invoked and the command was not handled.
/// </returns>
public bool? InvokeCommands (Command [] commands, [CanBeNull] Key key = null, [CanBeNull] KeyBinding? keyBinding = null)
{

View File

@@ -85,7 +85,7 @@ public class Bar : View
}
}
/// <summary>Inserts a <see cref="Shortcut"/> in the specified index of <see cref="Items"/>.</summary>
/// <summary>Inserts a <see cref="Shortcut"/> in the specified index of <see cref="View.Subviews"/>.</summary>
/// <param name="index">The zero-based index at which item should be inserted.</param>
/// <param name="item">The item to insert.</param>
public void AddShortcutAt (int index, Shortcut item)
@@ -107,7 +107,7 @@ public class Bar : View
SetNeedsDisplay ();
}
/// <summary>Removes a <see cref="Shortcut"/> at specified index of <see cref="Items"/>.</summary>
/// <summary>Removes a <see cref="Shortcut"/> at specified index of <see cref="View.Subviews"/>.</summary>
/// <param name="index">The zero-based index of the item to remove.</param>
/// <returns>The <see cref="Shortcut"/> removed.</returns>
public Shortcut RemoveShortcut (int index)
@@ -157,8 +157,6 @@ public class Bar : View
// All CommandView's are the same width, all HelpView's are the same width,
// all KeyView's are the same width
var maxCommandWidth = 0;
var maxHelpWidth = 0;
var minKeyWidth = 0;
List<Shortcut> shortcuts = Subviews.Where (s => s is Shortcut && s.Visible).Cast<Shortcut> ().ToList ();

View File

@@ -9,7 +9,7 @@ namespace Terminal.Gui;
/// </summary>
/// <remarks>
/// To run the <see cref="Dialog"/> modally, create the <see cref="Dialog"/>, and pass it to
/// <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/>. This will execute the dialog until
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/>. This will execute the dialog until
/// it terminates via the
/// [ESC] or [CTRL-Q] key, or when one of the views or buttons added to the dialog calls
/// <see cref="Application.RequestStop"/>.

View File

@@ -36,7 +36,7 @@ public enum OpenMode
/// </para>
/// <para>
/// To use, create an instance of <see cref="OpenDialog"/>, and pass it to
/// <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/>. This will run the dialog modally, and when this returns,
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/>. This will run the dialog modally, and when this returns,
/// the list of files will be available on the <see cref="FilePaths"/> property.
/// </para>
/// <para>To select more than one file, users can use the spacebar, or control-t.</para>

View File

@@ -17,7 +17,7 @@ namespace Terminal.Gui;
/// <remarks>
/// <para>
/// To use, create an instance of <see cref="SaveDialog"/>, and pass it to
/// <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/>. This will run the dialog modally, and when this returns,
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/>. This will run the dialog modally, and when this returns,
/// the <see cref="FileName"/>property will contain the selected file name or null if the user canceled.
/// </para>
/// </remarks>

View File

@@ -8,18 +8,6 @@ namespace Terminal.Gui;
// TODO: It can mean "Application-scoped key binding" or "A key binding that is displayed in a visual way".
// TODO: I tried `BarItem` but that's not great either as it implies it can only be used in `Bar`s.
[Flags]
[GenerateEnumExtensionMethods (FastHasFlags = true)]
public enum ShortcutStyles
{
None = 0,
SeparatorBefore = 8,
SeparatorAfter = 16,
}
/// <summary>
/// Displays a command, help text, and a key binding. When the key is pressed, the command will be invoked. Useful for
/// displaying a command in <see cref="Bar"/> such as a
@@ -29,7 +17,7 @@ public enum ShortcutStyles
/// <para>
/// When the user clicks on the <see cref="Shortcut"/> or presses the key
/// specified by <see cref="Key"/> the <see cref="Command.Accept"/> command is invoked, causing the
/// <see cref="Accept"/> event to be fired
/// <see cref="View.Accept"/> event to be fired
/// </para>
/// <para>
/// If <see cref="KeyBindingScope"/> is <see cref="KeyBindingScope.Application"/>, the <see cref="Command.Accept"/>
@@ -53,13 +41,13 @@ public enum ShortcutStyles
/// </remarks>
public class Shortcut : View
{
/// <summary>
/// Creates a new instance of <see cref="Shortcut"/>;
/// </summary>
/// <param name="key"></param>
/// <param name="command"></param>
/// <param name="commandText"></param>
/// <param name="action"></param>
/// <param name="helpText"></param>
public Shortcut (Key key, string commandText, Action action, string helpText = null)
{
Id = "_shortcut";
@@ -166,8 +154,6 @@ public class Shortcut : View
}
}
public ShortcutStyles ShortcutStyle { get; set; } = ShortcutStyles.None;
// When one of the subviews is "empty" we don't want to show it. So we
// Use Add/Remove. We need to be careful to add them in the right order
// so Pos.Align works correctly.
@@ -417,7 +403,7 @@ public class Shortcut : View
{
// When the CommandView fires its Accept event, we want to act as though the
// Shortcut was clicked.
if (base.OnAccept() == true)
if (base.OnAccept () == true)
{
e.Cancel = true;
}
@@ -646,7 +632,7 @@ public class Shortcut : View
/// Gets or sets the action to be invoked when the shortcut key is pressed or the shortcut is clicked on with the mouse.
/// </summary>
/// <remarks>
/// Note, the <see cref="Accept"/> event is fired first, and if cancelled, <see cref="Action"/> will not be invoked.
/// Note, the <see cref="View.Accept"/> event is fired first, and if cancelled, the event will not be invoked.
/// </remarks>
[CanBeNull]
public Action Action { get; set; }
@@ -691,7 +677,7 @@ public class Shortcut : View
}
// Set KeyView's colors to show "hot"
if (IsInitialized && base.ColorScheme is {})
if (IsInitialized && base.ColorScheme is { })
{
var cs = new ColorScheme (base.ColorScheme)
{

View File

@@ -1961,7 +1961,6 @@ public class TextView : View
private readonly HistoryText _historyText = new ();
private bool _allowsReturn = true;
private bool _allowsTab = true;
private int _bottomOffset, _rightOffset;
private bool _clickWithSelecting;
// The column we are tracking, or -1 if we are not tracking any column

View File

@@ -7,7 +7,7 @@ namespace Terminal.Gui;
/// <remarks>
/// <para>
/// Toplevels can run as modal (popup) views, started by calling
/// <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/>. They return control to the caller when
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/>. They return control to the caller when
/// <see cref="Application.RequestStop(Toplevel)"/> has been called (which sets the <see cref="Toplevel.Running"/>
/// property to <c>false</c>).
/// </para>
@@ -15,7 +15,7 @@ namespace Terminal.Gui;
/// A Toplevel is created when an application initializes Terminal.Gui by calling <see cref="Application.Init"/>.
/// The application Toplevel can be accessed via <see cref="Application.Top"/>. Additional Toplevels can be created
/// and run (e.g. <see cref="Dialog"/>s. To run a Toplevel, create the <see cref="Toplevel"/> and call
/// <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/>.
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/>.
/// </para>
/// </remarks>
public partial class Toplevel : View
@@ -445,7 +445,7 @@ public partial class Toplevel : View
/// perform tasks when the <see cref="Toplevel"/> has been laid out and focus has been set. changes.
/// <para>
/// A Ready event handler is a good place to finalize initialization after calling
/// <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/> on this <see cref="Toplevel"/>.
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/> on this <see cref="Toplevel"/>.
/// </para>
/// </summary>
public event EventHandler Ready;

View File

@@ -125,7 +125,7 @@ public class Wizard : Dialog
/// <description>Add the Wizard to a containing view with <see cref="View.Add(View)"/>.</description>
/// </item>
/// </list>
/// If a non-Modal Wizard is added to the application after <see cref="Application.Run(Toplevel, Func{Exception, bool}, ConsoleDriver)"/> has
/// If a non-Modal Wizard is added to the application after <see cref="Application.Run(Toplevel, Func{Exception, bool})"/> has
/// been called the first step must be explicitly set by setting <see cref="CurrentStep"/> to
/// <see cref="GetNextStep()"/>:
/// <code>