Remove constructors with frame parameters from ScrollView class.

This commit is contained in:
BDisp
2024-01-15 21:53:41 +00:00
parent ec47ab1de5
commit a2c7e51db4
3 changed files with 14 additions and 15 deletions

View File

@@ -43,19 +43,10 @@ public class ScrollView : View {
ContentView _contentView;
ScrollBarView _vertical, _horizontal;
/// <summary>
/// Initializes a new instance of the <see cref="Gui.ScrollView"/> class using <see cref="LayoutStyle.Absolute"/> positioning.
/// </summary>
/// <param name="frame"></param>
public ScrollView (Rect frame) : base (frame)
{
SetInitialProperties (frame);
}
/// <summary>
/// Initializes a new instance of the <see cref="Gui.ScrollView"/> class using <see cref="LayoutStyle.Computed"/> positioning.
/// </summary>
public ScrollView () : base ()
public ScrollView ()
{
SetInitialProperties (Rect.Empty);
}

View File

@@ -25,7 +25,7 @@ public class Clipping : Scenario {
};
Application.Top.Add (label);
var scrollView = new ScrollView (new Rect (3, 3, 50, 20));
var scrollView = new ScrollView () { X = 3, Y = 3, Width = 50, Height = 20 };
scrollView.ColorScheme = Colors.Menu;
scrollView.ContentSize = new Size (200, 100);
//ContentOffset = new Point (0, 0),

View File

@@ -23,7 +23,7 @@ public class ScrollViewTests {
Assert.True (sv.AutoHideScrollBars);
Assert.True (sv.KeepContentAlwaysInViewport);
sv = new ScrollView (new Rect (1, 2, 20, 10));
sv = new ScrollView () { X = 1, Y = 2, Width = 20, Height = 10 };
Assert.Equal (LayoutStyle.Absolute, sv.LayoutStyle);
Assert.True (sv.CanFocus);
Assert.Equal (new Rect (1, 2, 20, 10), sv.Frame);
@@ -36,7 +36,9 @@ public class ScrollViewTests {
[Fact]
public void Adding_Views ()
{
var sv = new ScrollView (new Rect (0, 0, 20, 10)) {
var sv = new ScrollView () {
Width = 20,
Height = 10,
ContentSize = new Size (30, 20)
};
sv.Add (new View () { Width = 10, Height = 5 },
@@ -49,7 +51,9 @@ public class ScrollViewTests {
[Fact]
public void KeyBindings_Command ()
{
var sv = new ScrollView (new Rect (0, 0, 20, 10)) {
var sv = new ScrollView () {
Width = 20,
Height = 10,
ContentSize = new Size (40, 20)
};
sv.Add (new View () { Width = 20, Height = 5 },
@@ -606,7 +610,11 @@ public class ScrollViewTests {
view.Add (new Label (rule.Repeat (size.Width / rule.Length)) { AutoSize = false, Width = Dim.Fill () });
view.Add (new Label (rule.Repeat (size.Height / rule.Length), TextDirection.TopBottom_LeftRight) { Height = Dim.Fill (), AutoSize = false });
view.Add (new Label ("[ Press me! ]") { X = 1, Y = 1 });
var scrollView = new ScrollView (new Rect (1, 1, 15, 10)) {
var scrollView = new ScrollView () {
X = 1,
Y = 1,
Width = 15,
Height = 10,
ContentSize = size,
ShowHorizontalScrollIndicator = true,
ShowVerticalScrollIndicator = true