mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 00:07:58 +01:00
Scenario clean up
This commit is contained in:
@@ -1457,7 +1457,6 @@ public static partial class Application
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: In PR #3273, FindDeepestView will return adornments. Update logic below to fix adornment mouse handling
|
||||
var view = View.FindDeepestView (Current, mouseEvent.X, mouseEvent.Y);
|
||||
|
||||
if (view is { })
|
||||
|
||||
@@ -19,12 +19,15 @@ namespace UICatalog.Scenarios;
|
||||
/// <summary>
|
||||
/// This Scenario demonstrates building a custom control (a class deriving from View) that: - Provides a
|
||||
/// "Character Map" application (like Windows' charmap.exe). - Helps test unicode character rendering in Terminal.Gui -
|
||||
/// Illustrates how to use ScrollView to do infinite scrolling
|
||||
/// Illustrates how to do infinite scrolling
|
||||
/// </summary>
|
||||
[ScenarioMetadata ("Character Map", "Unicode viewer demonstrating the ScrollView control.")]
|
||||
[ScenarioMetadata ("Character Map", "Unicode viewer demonstrating infinite content, scrolling, and Unicode.")]
|
||||
[ScenarioCategory ("Text and Formatting")]
|
||||
[ScenarioCategory ("Drawing")]
|
||||
[ScenarioCategory ("Controls")]
|
||||
[ScenarioCategory ("ScrollView")]
|
||||
[ScenarioCategory ("Layout")]
|
||||
[ScenarioCategory ("Scrolling")]
|
||||
|
||||
public class CharacterMap : Scenario
|
||||
{
|
||||
public Label _errorLabel;
|
||||
@@ -36,7 +39,7 @@ public class CharacterMap : Scenario
|
||||
{
|
||||
Application.Init ();
|
||||
|
||||
var top = new Window ()
|
||||
var top = new Window
|
||||
{
|
||||
BorderStyle = LineStyle.None
|
||||
};
|
||||
@@ -105,26 +108,26 @@ public class CharacterMap : Scenario
|
||||
|
||||
// if user clicks the mouse in TableView
|
||||
_categoryList.MouseClick += (s, e) =>
|
||||
{
|
||||
_categoryList.ScreenToCell (e.MouseEvent.X, e.MouseEvent.Y, out int? clickedCol);
|
||||
{
|
||||
_categoryList.ScreenToCell (e.MouseEvent.X, e.MouseEvent.Y, out int? clickedCol);
|
||||
|
||||
if (clickedCol != null && e.MouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked))
|
||||
{
|
||||
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
|
||||
string prevSelection = table.Data.ElementAt (_categoryList.SelectedRow).Category;
|
||||
isDescending = !isDescending;
|
||||
if (clickedCol != null && e.MouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked))
|
||||
{
|
||||
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
|
||||
string prevSelection = table.Data.ElementAt (_categoryList.SelectedRow).Category;
|
||||
isDescending = !isDescending;
|
||||
|
||||
_categoryList.Table = CreateCategoryTable (clickedCol.Value, isDescending);
|
||||
_categoryList.Table = CreateCategoryTable (clickedCol.Value, isDescending);
|
||||
|
||||
table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
|
||||
table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
|
||||
|
||||
_categoryList.SelectedRow = table.Data
|
||||
.Select ((item, index) => new { item, index })
|
||||
.FirstOrDefault (x => x.item.Category == prevSelection)
|
||||
?.index
|
||||
?? -1;
|
||||
}
|
||||
};
|
||||
_categoryList.SelectedRow = table.Data
|
||||
.Select ((item, index) => new { item, index })
|
||||
.FirstOrDefault (x => x.item.Category == prevSelection)
|
||||
?.index
|
||||
?? -1;
|
||||
}
|
||||
};
|
||||
|
||||
int longestName = UnicodeRange.Ranges.Max (r => r.Category.GetColumns ());
|
||||
|
||||
@@ -138,14 +141,13 @@ public class CharacterMap : Scenario
|
||||
_categoryList.Width = _categoryList.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 4;
|
||||
|
||||
_categoryList.SelectedCellChanged += (s, args) =>
|
||||
{
|
||||
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
|
||||
_charMap.StartCodePoint = table.Data.ToArray () [args.NewRow].Start;
|
||||
};
|
||||
{
|
||||
EnumerableTableSource<UnicodeRange> table = (EnumerableTableSource<UnicodeRange>)_categoryList.Table;
|
||||
_charMap.StartCodePoint = table.Data.ToArray () [args.NewRow].Start;
|
||||
};
|
||||
|
||||
top.Add (_categoryList);
|
||||
|
||||
|
||||
// TODO: Replace this with Dim.Auto when that's ready
|
||||
_categoryList.Initialized += _categoryList_Initialized;
|
||||
|
||||
@@ -466,8 +468,9 @@ internal class CharMap : View
|
||||
MouseEvent += Handle_MouseEvent;
|
||||
|
||||
// Prototype scrollbars
|
||||
Padding.Thickness = new Thickness (0, 0, 1, 1);
|
||||
var up = new Button ()
|
||||
Padding.Thickness = new (0, 0, 1, 1);
|
||||
|
||||
var up = new Button
|
||||
{
|
||||
AutoSize = false,
|
||||
X = Pos.AnchorEnd (1),
|
||||
@@ -478,15 +481,11 @@ internal class CharMap : View
|
||||
NoDecorations = true,
|
||||
Title = CM.Glyphs.UpArrow.ToString (),
|
||||
WantContinuousButtonPressed = true,
|
||||
CanFocus = false,
|
||||
|
||||
};
|
||||
up.Accept += (sender, args) =>
|
||||
{
|
||||
args.Cancel = ScrollVertical (-1) == true;
|
||||
CanFocus = false
|
||||
};
|
||||
up.Accept += (sender, args) => { args.Cancel = ScrollVertical (-1) == true; };
|
||||
|
||||
var down = new Button ()
|
||||
var down = new Button
|
||||
{
|
||||
AutoSize = false,
|
||||
X = Pos.AnchorEnd (1),
|
||||
@@ -497,15 +496,11 @@ internal class CharMap : View
|
||||
NoDecorations = true,
|
||||
Title = CM.Glyphs.DownArrow.ToString (),
|
||||
WantContinuousButtonPressed = true,
|
||||
CanFocus = false,
|
||||
|
||||
};
|
||||
down.Accept += (sender, args) =>
|
||||
{
|
||||
ScrollVertical (1);
|
||||
CanFocus = false
|
||||
};
|
||||
down.Accept += (sender, args) => { ScrollVertical (1); };
|
||||
|
||||
var left = new Button ()
|
||||
var left = new Button
|
||||
{
|
||||
AutoSize = false,
|
||||
X = 0,
|
||||
@@ -516,15 +511,11 @@ internal class CharMap : View
|
||||
NoDecorations = true,
|
||||
Title = CM.Glyphs.LeftArrow.ToString (),
|
||||
WantContinuousButtonPressed = true,
|
||||
CanFocus = false,
|
||||
|
||||
};
|
||||
left.Accept += (sender, args) =>
|
||||
{
|
||||
ScrollHorizontal (-1);
|
||||
CanFocus = false
|
||||
};
|
||||
left.Accept += (sender, args) => { ScrollHorizontal (-1); };
|
||||
|
||||
var right = new Button ()
|
||||
var right = new Button
|
||||
{
|
||||
AutoSize = false,
|
||||
X = Pos.AnchorEnd (2),
|
||||
@@ -535,14 +526,9 @@ internal class CharMap : View
|
||||
NoDecorations = true,
|
||||
Title = CM.Glyphs.RightArrow.ToString (),
|
||||
WantContinuousButtonPressed = true,
|
||||
CanFocus = false,
|
||||
|
||||
CanFocus = false
|
||||
};
|
||||
right.Accept += (sender, args) =>
|
||||
{
|
||||
ScrollHorizontal (1);
|
||||
};
|
||||
|
||||
right.Accept += (sender, args) => { ScrollHorizontal (1); };
|
||||
|
||||
Padding.Add (up, down, left, right);
|
||||
}
|
||||
@@ -553,6 +539,7 @@ internal class CharMap : View
|
||||
{
|
||||
ScrollVertical (1);
|
||||
e.Handled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -576,7 +563,6 @@ internal class CharMap : View
|
||||
{
|
||||
ScrollHorizontal (-1);
|
||||
e.Handled = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,6 +595,7 @@ internal class CharMap : View
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_selected = value;
|
||||
|
||||
if (IsInitialized)
|
||||
@@ -640,6 +627,7 @@ internal class CharMap : View
|
||||
Viewport = Viewport with { X = col - width };
|
||||
}
|
||||
}
|
||||
|
||||
SetNeedsDisplay ();
|
||||
SelectedCodePointChanged?.Invoke (this, new (SelectedCodePoint, null));
|
||||
}
|
||||
@@ -882,7 +870,6 @@ internal class CharMap : View
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
if (me.Y == 0)
|
||||
@@ -971,7 +958,7 @@ internal class CharMap : View
|
||||
{
|
||||
var client = new UcdApiClient ();
|
||||
var decResponse = string.Empty;
|
||||
string getCodePointError = string.Empty;
|
||||
var getCodePointError = string.Empty;
|
||||
|
||||
var waitIndicator = new Dialog
|
||||
{
|
||||
@@ -1037,7 +1024,7 @@ internal class CharMap : View
|
||||
document.RootElement,
|
||||
new
|
||||
JsonSerializerOptions
|
||||
{ WriteIndented = true }
|
||||
{ WriteIndented = true }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1050,16 +1037,16 @@ internal class CharMap : View
|
||||
var dlg = new Dialog { Title = title, Buttons = [copyGlyph, copyCP, cancel] };
|
||||
|
||||
copyGlyph.Accept += (s, a) =>
|
||||
{
|
||||
CopyGlyph ();
|
||||
dlg.RequestStop ();
|
||||
};
|
||||
{
|
||||
CopyGlyph ();
|
||||
dlg.RequestStop ();
|
||||
};
|
||||
|
||||
copyCP.Accept += (s, a) =>
|
||||
{
|
||||
CopyCodePoint ();
|
||||
dlg.RequestStop ();
|
||||
};
|
||||
{
|
||||
CopyCodePoint ();
|
||||
dlg.RequestStop ();
|
||||
};
|
||||
cancel.Accept += (s, a) => dlg.RequestStop ();
|
||||
|
||||
var rune = (Rune)SelectedCodePoint;
|
||||
@@ -1258,4 +1245,4 @@ internal class UnicodeRange
|
||||
|
||||
return ranges.Concat (nonBmpRanges).OrderBy (r => r.Category).ToList ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace UICatalog.Scenarios;
|
||||
|
||||
[ScenarioMetadata ("Clipping", "Used to test that things clip correctly")]
|
||||
[ScenarioCategory ("Tests")]
|
||||
[ScenarioCategory ("Drawing")]
|
||||
[ScenarioCategory ("Scrolling")]
|
||||
public class Clipping : Scenario
|
||||
{
|
||||
public override void Init ()
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
using Terminal.Gui;
|
||||
|
||||
namespace UICatalog.Scenarios;
|
||||
|
||||
[ScenarioMetadata ("Coordinates", "Demonstrates Screen, Frame, Content, and Viewport coordinates.")]
|
||||
[ScenarioCategory ("Layout")]
|
||||
public sealed class Coordinates : Scenario
|
||||
{
|
||||
public override void Main ()
|
||||
{
|
||||
// Init
|
||||
Application.Init ();
|
||||
|
||||
// Setup - Create a top-level application window and configure it.
|
||||
Window app = new ()
|
||||
{
|
||||
Title = $"Application/Screen",
|
||||
BorderStyle = LineStyle.HeavyDotted
|
||||
};
|
||||
|
||||
View frame = new ()
|
||||
{
|
||||
Title = "",
|
||||
Text = "Content - Location (0 0), Size: (54, 14)",
|
||||
X = 3,
|
||||
Y = 3,
|
||||
Width = 60,
|
||||
Height = 20,
|
||||
ColorScheme = new ColorScheme (new Attribute (Color.Black, Color.White))
|
||||
};
|
||||
frame.Margin.Thickness = new (1);
|
||||
frame.Margin.ColorScheme = new ColorScheme (new Attribute (Color.Black, Color.BrightRed));
|
||||
frame.Margin.Add (new Label () { Title = "Margin - Frame-Relative Location (0,0)" });
|
||||
frame.Border.LineStyle = LineStyle.None;
|
||||
frame.Border.Thickness = new (1);
|
||||
frame.Border.ColorScheme = new ColorScheme (new Attribute (Color.Black, Color.BrightGreen));
|
||||
frame.Border.Add (new Label () { Title = "Border - Frame-Relative Location (1,1)" });
|
||||
frame.Padding.Thickness = new (1);
|
||||
frame.Padding.ColorScheme = new ColorScheme (new Attribute (Color.Black, Color.BrightYellow));
|
||||
frame.Padding.Add (new Label () { Title = "Padding - Frame-Relative Location (2,2)" });
|
||||
|
||||
app.Add (frame);
|
||||
// Run - Start the application.
|
||||
Application.Run (app);
|
||||
app.Dispose ();
|
||||
|
||||
// Shutdown - Calling Application.Shutdown is required.
|
||||
Application.Shutdown ();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ namespace UICatalog.Scenarios;
|
||||
[ScenarioCategory ("Dialogs")]
|
||||
[ScenarioCategory ("Text and Formatting")]
|
||||
[ScenarioCategory ("Top Level Windows")]
|
||||
[ScenarioCategory ("Scrolling")]
|
||||
|
||||
public class ListColumns : Scenario
|
||||
{
|
||||
private ColorScheme _alternatingColorScheme;
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace UICatalog.Scenarios;
|
||||
[ScenarioMetadata ("Scrolling", "Demonstrates ScrollView etc...")]
|
||||
[ScenarioCategory ("Controls")]
|
||||
[ScenarioCategory ("ScrollView")]
|
||||
[ScenarioCategory ("Scrolling")]
|
||||
[ScenarioCategory ("Tests")]
|
||||
public class Scrolling : Scenario
|
||||
{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Terminal.Gui;
|
||||
|
||||
namespace UICatalog.Scenarios;
|
||||
|
||||
[ScenarioMetadata ("_Virtual Content Scrolling Demo", "Demonstrates scrolling built-into View")]
|
||||
[ScenarioMetadata ("Virtual Content", "Demonstrates using Viewport to enable scrolling content.")]
|
||||
[ScenarioCategory ("Layout")]
|
||||
public class VirtualScrolling : Scenario
|
||||
[ScenarioCategory ("Drawing")]
|
||||
public class VirtualContent : Scenario
|
||||
{
|
||||
private ViewDiagnosticFlags _diagnosticFlags;
|
||||
|
||||
public class VirtualDemoView : FrameView
|
||||
{
|
||||
public VirtualDemoView ()
|
||||
@@ -18,13 +18,12 @@ public class VirtualScrolling : Scenario
|
||||
Width = Dim.Fill ();
|
||||
Height = Dim.Fill ();
|
||||
ColorScheme = Colors.ColorSchemes ["Base"];
|
||||
Text = "Virtual Demo View Text. This is long text.\nThe second line.\n3\n4\n5th line\nLine 6. This is a longer line that should wrap automatically.";
|
||||
Text = "Virtual Content Text. This is long text.\nThe second line.\n3\n4\n5th line\nLine 6. This is a longer line that should wrap automatically.";
|
||||
CanFocus = true;
|
||||
BorderStyle = LineStyle.Rounded;
|
||||
Arrangement = ViewArrangement.Fixed;
|
||||
|
||||
// TODO: Add a way to set the scroll settings in the Scenario
|
||||
ContentSize = new Size (60, 40);
|
||||
ContentSize = new (60, 40);
|
||||
ViewportSettings |= ViewportSettings.ClearVisibleContentOnly;
|
||||
|
||||
// Things this view knows how to do
|
||||
@@ -34,23 +33,13 @@ public class VirtualScrolling : Scenario
|
||||
AddCommand (Command.ScrollRight, () => ScrollHorizontal (1));
|
||||
AddCommand (Command.ScrollLeft, () => ScrollHorizontal (-1));
|
||||
|
||||
//AddCommand (Command.PageUp, () => PageUp ());
|
||||
//AddCommand (Command.PageDown, () => PageDown ());
|
||||
//AddCommand (Command.TopHome, () => Home ());
|
||||
//AddCommand (Command.BottomEnd, () => End ());
|
||||
|
||||
// Default keybindings for all ListViews
|
||||
KeyBindings.Add (Key.CursorUp, Command.ScrollUp);
|
||||
KeyBindings.Add (Key.CursorDown, Command.ScrollDown);
|
||||
KeyBindings.Add (Key.CursorLeft, Command.ScrollLeft);
|
||||
KeyBindings.Add (Key.CursorRight, Command.ScrollRight);
|
||||
|
||||
//KeyBindings.Add (Key.PageUp, Command.PageUp);
|
||||
//KeyBindings.Add (Key.PageDown, Command.PageDown);
|
||||
//KeyBindings.Add (Key.Home, Command.TopHome);
|
||||
//KeyBindings.Add (Key.End, Command.BottomEnd);
|
||||
|
||||
Border.Add (new Label () { X = 23 });
|
||||
Border.Add (new Label { X = 23 });
|
||||
LayoutComplete += VirtualDemoView_LayoutComplete;
|
||||
|
||||
MouseEvent += VirtualDemoView_MouseEvent;
|
||||
@@ -61,8 +50,10 @@ public class VirtualScrolling : Scenario
|
||||
if (e.MouseEvent.Flags == MouseFlags.WheeledDown)
|
||||
{
|
||||
ScrollVertical (1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.MouseEvent.Flags == MouseFlags.WheeledUp)
|
||||
{
|
||||
ScrollVertical (-1);
|
||||
@@ -73,20 +64,19 @@ public class VirtualScrolling : Scenario
|
||||
if (e.MouseEvent.Flags == MouseFlags.WheeledRight)
|
||||
{
|
||||
ScrollHorizontal (1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.MouseEvent.Flags == MouseFlags.WheeledLeft)
|
||||
{
|
||||
ScrollHorizontal (-1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void VirtualDemoView_LayoutComplete (object sender, LayoutEventArgs e)
|
||||
{
|
||||
var status = Border.Subviews.OfType<Label> ().FirstOrDefault ();
|
||||
Label status = Border.Subviews.OfType<Label> ().FirstOrDefault ();
|
||||
|
||||
if (status is { })
|
||||
{
|
||||
@@ -96,18 +86,17 @@ public class VirtualScrolling : Scenario
|
||||
SetNeedsDisplay ();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Main ()
|
||||
{
|
||||
Application.Init ();
|
||||
|
||||
var view = new VirtualDemoView { Title = "Virtual Scrolling" };
|
||||
var view = new VirtualDemoView { Title = "Virtual Content" };
|
||||
|
||||
// Add Scroll Setting UI to Padding
|
||||
view.Padding.Thickness = new (0, 3, 0, 0);
|
||||
view.Padding.ColorScheme = Colors.ColorSchemes["Error"];
|
||||
view.Padding.ColorScheme = Colors.ColorSchemes ["Error"];
|
||||
|
||||
var cbAllowNegativeX = new CheckBox ()
|
||||
var cbAllowNegativeX = new CheckBox
|
||||
{
|
||||
Title = "Allow _X < 0",
|
||||
Y = 0,
|
||||
@@ -130,7 +119,7 @@ public class VirtualScrolling : Scenario
|
||||
|
||||
view.Padding.Add (cbAllowNegativeX);
|
||||
|
||||
var cbAllowNegativeY = new CheckBox ()
|
||||
var cbAllowNegativeY = new CheckBox
|
||||
{
|
||||
Title = "Allow _Y < 0",
|
||||
X = Pos.Right (cbAllowNegativeX) + 1,
|
||||
@@ -153,11 +142,11 @@ public class VirtualScrolling : Scenario
|
||||
}
|
||||
|
||||
view.Padding.Add (cbAllowNegativeY);
|
||||
|
||||
var cbAllowXGreaterThanContentWidth = new CheckBox ()
|
||||
|
||||
var cbAllowXGreaterThanContentWidth = new CheckBox
|
||||
{
|
||||
Title = "Allow X > Content",
|
||||
Y = Pos.Bottom(cbAllowNegativeX),
|
||||
Y = Pos.Bottom (cbAllowNegativeX),
|
||||
CanFocus = false
|
||||
};
|
||||
cbAllowXGreaterThanContentWidth.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth);
|
||||
@@ -177,7 +166,7 @@ public class VirtualScrolling : Scenario
|
||||
|
||||
view.Padding.Add (cbAllowXGreaterThanContentWidth);
|
||||
|
||||
var cbAllowYGreaterThanContentHeight = new CheckBox ()
|
||||
var cbAllowYGreaterThanContentHeight = new CheckBox
|
||||
{
|
||||
Title = "Allow Y > Content",
|
||||
X = Pos.Right (cbAllowXGreaterThanContentWidth) + 1,
|
||||
@@ -201,38 +190,38 @@ public class VirtualScrolling : Scenario
|
||||
|
||||
view.Padding.Add (cbAllowYGreaterThanContentHeight);
|
||||
|
||||
var labelContentSize = new Label ()
|
||||
var labelContentSize = new Label
|
||||
{
|
||||
Title = "_ContentSize:",
|
||||
Y = Pos.Bottom(cbAllowYGreaterThanContentHeight),
|
||||
Y = Pos.Bottom (cbAllowYGreaterThanContentHeight)
|
||||
};
|
||||
|
||||
var contentSizeWidth = new Buttons.NumericUpDown()
|
||||
var contentSizeWidth = new Buttons.NumericUpDown
|
||||
{
|
||||
Value = view.ContentSize.Width,
|
||||
X = Pos.Right (labelContentSize) + 1,
|
||||
Y = Pos.Top (labelContentSize),
|
||||
Y = Pos.Top (labelContentSize)
|
||||
};
|
||||
contentSizeWidth.ValueChanged += ContentSizeWidth_ValueChanged;
|
||||
|
||||
void ContentSizeWidth_ValueChanged (object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
view.ContentSize = view.ContentSize with { Width = ((Buttons.NumericUpDown)sender).Value };
|
||||
view.ContentSize = view.ContentSize with { Width = ((Buttons.NumericUpDown)sender).Value };
|
||||
}
|
||||
|
||||
var labelComma = new Label ()
|
||||
var labelComma = new Label
|
||||
{
|
||||
Title = ", ",
|
||||
X = Pos.Right (contentSizeWidth),
|
||||
Y = Pos.Top (labelContentSize),
|
||||
Y = Pos.Top (labelContentSize)
|
||||
};
|
||||
|
||||
var contentSizeHeight = new Buttons.NumericUpDown ()
|
||||
var contentSizeHeight = new Buttons.NumericUpDown
|
||||
{
|
||||
Value = view.ContentSize.Height,
|
||||
X = Pos.Right (labelComma),
|
||||
Y = Pos.Top (labelContentSize),
|
||||
CanFocus =false
|
||||
CanFocus = false
|
||||
};
|
||||
contentSizeHeight.ValueChanged += ContentSizeHeight_ValueChanged;
|
||||
|
||||
@@ -241,8 +230,7 @@ public class VirtualScrolling : Scenario
|
||||
view.ContentSize = view.ContentSize with { Height = ((Buttons.NumericUpDown)sender).Value };
|
||||
}
|
||||
|
||||
|
||||
var cbClearOnlyVisible = new CheckBox ()
|
||||
var cbClearOnlyVisible = new CheckBox
|
||||
{
|
||||
Title = "Clear only Visible Content",
|
||||
X = Pos.Right (contentSizeHeight) + 1,
|
||||
@@ -266,7 +254,6 @@ public class VirtualScrolling : Scenario
|
||||
|
||||
view.Padding.Add (labelContentSize, contentSizeWidth, labelComma, contentSizeHeight, cbClearOnlyVisible);
|
||||
|
||||
|
||||
// Add demo views to show that things work correctly
|
||||
var textField = new TextField { X = 20, Y = 7, Width = 15, Text = "Test TextField" };
|
||||
|
||||
@@ -274,15 +261,15 @@ public class VirtualScrolling : Scenario
|
||||
colorPicker.BorderStyle = LineStyle.RoundedDotted;
|
||||
|
||||
colorPicker.ColorChanged += (s, e) =>
|
||||
{
|
||||
colorPicker.SuperView.ColorScheme = new (colorPicker.SuperView.ColorScheme)
|
||||
{
|
||||
Normal = new (
|
||||
colorPicker.SuperView.ColorScheme.Normal.Foreground,
|
||||
e.Color
|
||||
)
|
||||
};
|
||||
};
|
||||
{
|
||||
colorPicker.SuperView.ColorScheme = new (colorPicker.SuperView.ColorScheme)
|
||||
{
|
||||
Normal = new (
|
||||
colorPicker.SuperView.ColorScheme.Normal.Foreground,
|
||||
e.Color
|
||||
)
|
||||
};
|
||||
};
|
||||
|
||||
var textView = new TextView
|
||||
{
|
||||
@@ -296,7 +283,7 @@ public class VirtualScrolling : Scenario
|
||||
};
|
||||
textView.Border.Thickness = new (1, 3, 1, 1);
|
||||
|
||||
var charMap = new Scenarios.CharMap ()
|
||||
var charMap = new CharMap
|
||||
{
|
||||
X = Pos.Center (),
|
||||
Y = Pos.Bottom (textView) + 1,
|
||||
@@ -333,7 +320,8 @@ public class VirtualScrolling : Scenario
|
||||
Id = "label2",
|
||||
X = 0,
|
||||
Y = 30,
|
||||
Text = "This label is long. It should clip to the Viewport (but not ContentArea). This is a virtual scrolling demo. Use the arrow keys and/or mouse wheel to scroll the content.",
|
||||
Text =
|
||||
"This label is long. It should clip to the Viewport (but not ContentArea). This is a virtual scrolling demo. Use the arrow keys and/or mouse wheel to scroll the content."
|
||||
};
|
||||
longLabel.TextFormatter.WordWrap = true;
|
||||
view.Add (longLabel);
|
||||
Reference in New Issue
Block a user