mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Removing duplicate code.
This commit is contained in:
@@ -189,7 +189,9 @@ namespace Terminal.Gui {
|
||||
public virtual Key HotKey {
|
||||
get => hotKey;
|
||||
set {
|
||||
hotKey = TextFormatter.HotKey = value;
|
||||
if (hotKey != value) {
|
||||
hotKey = TextFormatter.HotKey = (value == Key.Unknown ? Key.Null : value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Terminal.Gui {
|
||||
Rune _leftDefault;
|
||||
Rune _rightDefault;
|
||||
Key hotKey = Key.Null;
|
||||
Rune hotKeySpecifier;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="Button"/> using <see cref="LayoutStyle.Computed"/> layout.
|
||||
@@ -155,19 +154,11 @@ namespace Terminal.Gui {
|
||||
} else if (v != Key.Null) {
|
||||
AddKeyBinding (Key.Space | v, Command.Accept);
|
||||
}
|
||||
hotKey = v;
|
||||
hotKey = TextFormatter.HotKey = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override Rune HotKeySpecifier {
|
||||
get => hotKeySpecifier;
|
||||
set {
|
||||
hotKeySpecifier = TextFormatter.HotKeySpecifier = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void UpdateTextFormatterText ()
|
||||
{
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace Terminal.Gui {
|
||||
/// The <see cref="CheckBox"/> <see cref="View"/> shows an on/off toggle that the user can set
|
||||
/// </summary>
|
||||
public class CheckBox : View {
|
||||
Key hotKey = Key.Null;
|
||||
Rune hotKeySpecifier;
|
||||
Rune charChecked;
|
||||
Rune charUnChecked;
|
||||
bool @checked;
|
||||
@@ -118,25 +116,6 @@ namespace Terminal.Gui {
|
||||
return Text.RuneSubstring (0, Math.Min (Frame.Width - 2, Text.RuneCount));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override Key HotKey {
|
||||
get => hotKey;
|
||||
set {
|
||||
if (hotKey != value) {
|
||||
var v = value == Key.Unknown ? Key.Null : value;
|
||||
hotKey = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override Rune HotKeySpecifier {
|
||||
get => hotKeySpecifier;
|
||||
set {
|
||||
hotKeySpecifier = TextFormatter.HotKeySpecifier = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The state of the <see cref="CheckBox"/>
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user