mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Temporarily added SetContentSize to ScrollView and fixed other scenarios
This commit is contained in:
@@ -136,6 +136,13 @@ public class ScrollView : View
|
||||
ContentSizeChanged += ScrollViewContentSizeChanged;
|
||||
}
|
||||
|
||||
[ObsoleteAttribute ("This method is obsolete and will be removed in v2.", false)]
|
||||
public void SetContentSize (Size contentSize)
|
||||
{
|
||||
ContentSize = contentSize;
|
||||
}
|
||||
|
||||
|
||||
private void ScrollViewContentSizeChanged (object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (e.Size is null)
|
||||
|
||||
@@ -236,7 +236,7 @@ public class ASCIICustomButtonTest : Scenario
|
||||
}
|
||||
|
||||
// BUGBUG: set_ContentSize is supposed to be `protected`.
|
||||
_scrollView.ContentSize = new (25, pages * BUTTONS_ON_PAGE * BUTTON_HEIGHT);
|
||||
_scrollView.SetContentSize (new (25, pages * BUTTONS_ON_PAGE * BUTTON_HEIGHT));
|
||||
|
||||
if (_smallerWindow)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Clipping : Scenario
|
||||
var scrollView = new ScrollView { X = 3, Y = 3, Width = 50, Height = 20 };
|
||||
scrollView.ColorScheme = Colors.ColorSchemes ["Menu"];
|
||||
// BUGBUG: set_ContentSize is supposed to be `protected`.
|
||||
scrollView.ContentSize = new (200, 100);
|
||||
scrollView.SetContentSize (new (200, 100));
|
||||
|
||||
//ContentOffset = Point.Empty,
|
||||
scrollView.AutoHideScrollBars = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terminal.Gui;
|
||||
|
||||
@@ -51,6 +52,12 @@ public class ContentScrolling : Scenario
|
||||
MouseEvent += VirtualDemoView_MouseEvent;
|
||||
}
|
||||
|
||||
[ObsoleteAttribute ("This method is obsolete and will be removed in v2.", false)]
|
||||
public void SetContentSize (Size contentSize)
|
||||
{
|
||||
ContentSize = contentSize;
|
||||
}
|
||||
|
||||
private void VirtualDemoView_MouseEvent (object sender, MouseEventEventArgs e)
|
||||
{
|
||||
if (e.MouseEvent.Flags == MouseFlags.WheeledDown)
|
||||
@@ -245,7 +252,7 @@ public class ContentScrolling : Scenario
|
||||
return;
|
||||
}
|
||||
// BUGBUG: set_ContentSize is supposed to be `protected`.
|
||||
view.ContentSize = view.ContentSize with { Width = e.NewValue };
|
||||
view.SetContentSize (view.ContentSize with { Width = e.NewValue });
|
||||
}
|
||||
|
||||
var labelComma = new Label
|
||||
@@ -273,7 +280,7 @@ public class ContentScrolling : Scenario
|
||||
return;
|
||||
}
|
||||
// BUGBUG: set_ContentSize is supposed to be `protected`.
|
||||
view.ContentSize = view.ContentSize with { Height = e.NewValue };
|
||||
view.SetContentSize (view.ContentSize with { Height = e.NewValue });
|
||||
}
|
||||
|
||||
var cbClearOnlyVisible = new CheckBox
|
||||
@@ -355,8 +362,8 @@ public class ContentScrolling : Scenario
|
||||
{
|
||||
X = Pos.Center (),
|
||||
Y = Pos.Bottom (textView) + 1,
|
||||
Width = Dim.Auto(DimAutoStyle.Content, maximumContentDim: Dim.Func (() => view.ContentSize.Width)),
|
||||
Height = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Percent(20)),
|
||||
Width = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Func (() => view.ContentSize.Width)),
|
||||
Height = Dim.Auto (DimAutoStyle.Content, maximumContentDim: Dim.Percent (20)),
|
||||
};
|
||||
|
||||
charMap.Accept += (s, e) =>
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Scrolling : Scenario
|
||||
ShowHorizontalScrollIndicator = true
|
||||
};
|
||||
// BUGBUG: set_ContentSize is supposed to be `protected`.
|
||||
scrollView.ContentSize = new (120, 40);
|
||||
scrollView.SetContentSize (new (120, 40));
|
||||
scrollView.Padding.Thickness = new (1);
|
||||
|
||||
label.Text = $"{scrollView}\nContentSize: {scrollView.ContentSize}\nContentOffset: {scrollView.ContentOffset}";
|
||||
|
||||
Reference in New Issue
Block a user