Remove constructors with frame parameters from CheckBox class.

This commit is contained in:
BDisp
2024-01-15 18:32:13 +00:00
parent 6b190d6dfd
commit 6d6553a2a4
3 changed files with 6 additions and 29 deletions

View File

@@ -46,29 +46,6 @@ public class CheckBox : View {
SetInitialProperties (s, is_checked);
}
/// <summary>
/// Initializes a new instance of <see cref="CheckBox"/> using <see cref="LayoutStyle.Absolute"/> layout.
/// </summary>
/// <remarks>
/// The size of <see cref="CheckBox"/> is computed based on the
/// text length. This <see cref="CheckBox"/> is not toggled.
/// </remarks>
public CheckBox (int x, int y, string s) : this (x, y, s, false)
{
}
/// <summary>
/// Initializes a new instance of <see cref="CheckBox"/> using <see cref="LayoutStyle.Absolute"/> layout.
/// </summary>
/// <remarks>
/// The size of <see cref="CheckBox"/> is computed based on the
/// text length.
/// </remarks>
public CheckBox (int x, int y, string s, bool is_checked) : base (new Rect (x, y, s.Length, 1))
{
SetInitialProperties (s, is_checked);
}
// TODO: v2 - Remove constructors with parameters
/// <summary>
/// Private helper to set the initial properties of the View that were provided via constructors.

View File

@@ -151,8 +151,8 @@ namespace UICatalog.Scenarios {
ColorScheme = Colors.Error
});
subWinofFV.Add (new CheckBox (0, 1, "Check me"));
subWinofFV.Add (new CheckBox (0, 2, "Or, Check me"));
subWinofFV.Add (new CheckBox ("Check me") { Y = 1 });
subWinofFV.Add (new CheckBox ("Or, Check me") { Y = 2 });
frame.Add (subWinofFV);
var subFrameViewofFV = new FrameView ("this is a Sub-FrameView") {
@@ -165,10 +165,10 @@ namespace UICatalog.Scenarios {
};
subFrameViewofFV.Add (new TextField (0, 0, 15, "Edit Me"));
subFrameViewofFV.Add (new CheckBox (0, 1, "Check me"));
subFrameViewofFV.Add (new CheckBox ("Check me") { Y = 1 });
// BUGBUG: This checkbox is not shown even though frameViewFV has 3 rows in
// its client area. #522
subFrameViewofFV.Add (new CheckBox (0, 2, "Or, Check me"));
subFrameViewofFV.Add (new CheckBox ("Or, Check me") { Y = 2 });
frame.Add (new CheckBox ("Btn1 (Y = Pos.AnchorEnd (1))") {
X = 0,

View File

@@ -36,7 +36,7 @@ namespace Terminal.Gui.ViewsTests {
Assert.True (ckb.CanFocus);
Assert.Equal (new Rect (0, 0, 6, 1), ckb.Frame);
ckb = new CheckBox (1, 2, "Test");
ckb = new CheckBox ("Test") { X = 1, Y = 2 };
Assert.True (ckb.AutoSize);
Assert.False (ckb.Checked);
Assert.False (ckb.AllowNullChecked);
@@ -45,7 +45,7 @@ namespace Terminal.Gui.ViewsTests {
Assert.True (ckb.CanFocus);
Assert.Equal (new Rect (1, 2, 6, 1), ckb.Frame);
ckb = new CheckBox (3, 4, "Test", true);
ckb = new CheckBox ("Test", true) { X = 3, Y = 4 };
Assert.True (ckb.AutoSize);
Assert.True (ckb.Checked);
Assert.False (ckb.AllowNullChecked);