|
@@ -1,12 +1,23 @@
|
|
|
namespace Terminal.Gui;
|
|
|
|
|
|
/// <summary>
|
|
|
-/// The Label <see cref="View"/> displays a string at a given position and supports multiple lines separated by
|
|
|
-/// newline characters. Multi-line Labels support word wrap.
|
|
|
+/// The Label <see cref="View"/> displays text that describes the View next in the <see cref="View.Subviews"/>. When
|
|
|
+/// Label
|
|
|
+/// recieves a <see cref="Command.HotKey"/> command it will pass it to the next <see cref="View"/> in
|
|
|
+/// <see cref="View.Subviews"/>.
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
-/// The <see cref="Label"/> view is functionality identical to <see cref="View"/> and is included for API
|
|
|
-/// backwards compatibility.
|
|
|
+/// <para>
|
|
|
+/// <see cref="Label.Title"/> and <see cref="Label.Text"/> are the same property. When <see cref="Label.Title"/> is
|
|
|
+/// set
|
|
|
+/// <see cref="Label.Text"/> is also set. When <see cref="Label.Text"/> is set <see cref="Label.Title"/> is also
|
|
|
+/// set.
|
|
|
+/// </para>
|
|
|
+/// <para>
|
|
|
+/// If <see cref="Label.CanFocus"/> is <see langword="false"/> and the use clicks on the Label,
|
|
|
+/// the <see cref="Command.HotKey"/> will be invoked on the next <see cref="View"/> in
|
|
|
+/// <see cref="View.Subviews"/>."
|
|
|
+/// </para>
|
|
|
/// </remarks>
|
|
|
public class Label : View
|
|
|
{
|
|
@@ -17,7 +28,7 @@ public class Label : View
|
|
|
Width = Dim.Auto (DimAutoStyle.Text);
|
|
|
|
|
|
// Things this view knows how to do
|
|
|
- AddCommand (Command.HotKey, context => InvokeHotKeyOnNext(context));
|
|
|
+ AddCommand (Command.HotKey, InvokeHotKeyOnNext);
|
|
|
|
|
|
TitleChanged += Label_TitleChanged;
|
|
|
MouseClick += Label_MouseClick;
|
|
@@ -37,14 +48,14 @@ public class Label : View
|
|
|
TextFormatter.HotKeySpecifier = HotKeySpecifier;
|
|
|
}
|
|
|
|
|
|
- /// <inheritdoc />
|
|
|
+ /// <inheritdoc/>
|
|
|
public override string Text
|
|
|
{
|
|
|
- get => base.Title;
|
|
|
- set => base.Text = base.Title = value;
|
|
|
+ get => Title;
|
|
|
+ set => base.Text = Title = value;
|
|
|
}
|
|
|
|
|
|
- /// <inheritdoc />
|
|
|
+ /// <inheritdoc/>
|
|
|
public override Rune HotKeySpecifier
|
|
|
{
|
|
|
get => base.HotKeySpecifier;
|
|
@@ -54,9 +65,10 @@ public class Label : View
|
|
|
private bool? InvokeHotKeyOnNext (CommandContext context)
|
|
|
{
|
|
|
int me = SuperView?.Subviews.IndexOf (this) ?? -1;
|
|
|
+
|
|
|
if (me != -1 && me < SuperView?.Subviews.Count - 1)
|
|
|
{
|
|
|
- SuperView?.Subviews [me + 1].InvokeCommand(Command.HotKey, context.Key, context.KeyBinding);
|
|
|
+ SuperView?.Subviews [me + 1].InvokeCommand (Command.HotKey, context.Key, context.KeyBinding);
|
|
|
}
|
|
|
|
|
|
return true;
|