|
@@ -6,15 +6,12 @@ using Terminal.Gui;
|
|
|
|
|
|
namespace UICatalog.Scenarios;
|
|
namespace UICatalog.Scenarios;
|
|
|
|
|
|
-[ScenarioMetadata (Name: "Sliders", Description: "Demonstrates the Slider view.")]
|
|
|
|
|
|
+[ScenarioMetadata ("Sliders", "Demonstrates the Slider view.")]
|
|
[ScenarioCategory ("Controls")]
|
|
[ScenarioCategory ("Controls")]
|
|
public class Sliders : Scenario {
|
|
public class Sliders : Scenario {
|
|
public override void Setup ()
|
|
public override void Setup ()
|
|
{
|
|
{
|
|
MakeSliders (Win, new List<object> { 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000 });
|
|
MakeSliders (Win, new List<object> { 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000 });
|
|
-
|
|
|
|
- #region configView
|
|
|
|
-
|
|
|
|
var configView = new FrameView {
|
|
var configView = new FrameView {
|
|
Title = "Configuration",
|
|
Title = "Configuration",
|
|
X = Pos.Percent (50),
|
|
X = Pos.Percent (50),
|
|
@@ -27,88 +24,70 @@ public class Sliders : Scenario {
|
|
Win.Add (configView);
|
|
Win.Add (configView);
|
|
|
|
|
|
#region Config Slider
|
|
#region Config Slider
|
|
-
|
|
|
|
- var slider = new Slider<string> () {
|
|
|
|
|
|
+ var slider = new Slider<string> {
|
|
Title = "Options",
|
|
Title = "Options",
|
|
- X = Pos.Center (),
|
|
|
|
|
|
+ X = 0,
|
|
Y = 0,
|
|
Y = 0,
|
|
Type = SliderType.Multiple,
|
|
Type = SliderType.Multiple,
|
|
Width = Dim.Fill (),
|
|
Width = Dim.Fill (),
|
|
|
|
+ Height = 4,
|
|
AllowEmpty = true,
|
|
AllowEmpty = true,
|
|
BorderStyle = LineStyle.Single
|
|
BorderStyle = LineStyle.Single
|
|
};
|
|
};
|
|
|
|
|
|
- slider.Style.SetChar.Attribute = new Terminal.Gui.Attribute (Color.BrightGreen, Color.Black);
|
|
|
|
- slider.Style.LegendAttributes.SetAttribute = new Terminal.Gui.Attribute (Color.Green, Color.Black);
|
|
|
|
|
|
+ slider.Style.SetChar.Attribute = new Attribute (Color.BrightGreen, Color.Black);
|
|
|
|
+ slider.Style.LegendAttributes.SetAttribute = new Attribute (Color.Green, Color.Black);
|
|
|
|
|
|
slider.Options = new List<SliderOption<string>> {
|
|
slider.Options = new List<SliderOption<string>> {
|
|
- new SliderOption<string>{
|
|
|
|
- Legend="Legends"
|
|
|
|
- },
|
|
|
|
- new SliderOption<string>{
|
|
|
|
- Legend="RangeAllowSingle"
|
|
|
|
- },
|
|
|
|
- new SliderOption<string>{
|
|
|
|
- Legend="Spacing"
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
+ new () {
|
|
|
|
+ Legend = "Legends"
|
|
|
|
+ },
|
|
|
|
+ new () {
|
|
|
|
+ Legend = "RangeAllowSingle"
|
|
|
|
+ },
|
|
|
|
+ new () {
|
|
|
|
+ Legend = "EndSpacing"
|
|
|
|
+ },
|
|
|
|
+ new () {
|
|
|
|
+ Legend = "AutoSize"
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
|
|
configView.Add (slider);
|
|
configView.Add (slider);
|
|
|
|
|
|
slider.OptionsChanged += (sender, e) => {
|
|
slider.OptionsChanged += (sender, e) => {
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
- if (e.Options.ContainsKey (0))
|
|
|
|
- s.ShowLegends = true;
|
|
|
|
- else
|
|
|
|
- s.ShowLegends = false;
|
|
|
|
-
|
|
|
|
- if (e.Options.ContainsKey (1))
|
|
|
|
- s.RangeAllowSingle = true;
|
|
|
|
- else
|
|
|
|
- s.RangeAllowSingle = false;
|
|
|
|
-
|
|
|
|
- if (e.Options.ContainsKey (2))
|
|
|
|
- s.ShowSpacing = true;
|
|
|
|
- else
|
|
|
|
- s.ShowSpacing = false;
|
|
|
|
|
|
+ s.ShowLegends = e.Options.ContainsKey (0);
|
|
|
|
+ s.RangeAllowSingle = e.Options.ContainsKey (1);
|
|
|
|
+ s.ShowEndSpacing = e.Options.ContainsKey (2);
|
|
|
|
+ s.AutoSize = e.Options.ContainsKey (3);
|
|
|
|
+ if (!s.AutoSize) {
|
|
|
|
+ if (s.Orientation == Orientation.Horizontal) {
|
|
|
|
+ s.Width = Dim.Percent (50);
|
|
|
|
+ var h = s.ShowLegends && s.LegendsOrientation == Orientation.Vertical ? s.Options.Max (o => o.Legend.Length) + 3 : 4;
|
|
|
|
+ s.Height = h;
|
|
|
|
+ } else {
|
|
|
|
+ var w = s.ShowLegends ? s.Options.Max (o => o.Legend.Length) + 3 : 3;
|
|
|
|
+ s.Width = w;
|
|
|
|
+ s.Height = Dim.Fill ();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (Win.IsInitialized) {
|
|
if (Win.IsInitialized) {
|
|
Win.LayoutSubviews ();
|
|
Win.LayoutSubviews ();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- slider.SetOption (0);
|
|
|
|
- slider.SetOption (1);
|
|
|
|
-
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
- #region InnerSpacing Input
|
|
|
|
- // var innerspacing_slider = new Slider<string> ("Innerspacing", new List<string> { "Auto", "0", "1", "2", "3", "4", "5" }) {
|
|
|
|
- // X = Pos.Center (),
|
|
|
|
- // Y = Pos.Bottom (slider) + 1
|
|
|
|
- // };
|
|
|
|
-
|
|
|
|
- // innerspacing_slider.SetOption (0);
|
|
|
|
-
|
|
|
|
- // configView.Add (innerspacing_slider);
|
|
|
|
-
|
|
|
|
- // innerspacing_slider.OptionsChanged += (options) => {
|
|
|
|
- // foreach (var s in leftView.Subviews.OfType<Slider> () ()) {
|
|
|
|
- // if (options.ContainsKey (0)) { }
|
|
|
|
- // //s.la = S.SliderLayout.Auto;
|
|
|
|
- // else {
|
|
|
|
- // s.InnerSpacing = options.Keys.First () - 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // };
|
|
|
|
- #endregion
|
|
|
|
|
|
+ slider.SetOption (0); // Legends
|
|
|
|
+ slider.SetOption (1); // RangeAllowSingle
|
|
|
|
+ //slider.SetOption (3); // AutoSize
|
|
|
|
|
|
#region Slider Orientation Slider
|
|
#region Slider Orientation Slider
|
|
-
|
|
|
|
var slider_orientation_slider = new Slider<string> (new List<string> { "Horizontal", "Vertical" }) {
|
|
var slider_orientation_slider = new Slider<string> (new List<string> { "Horizontal", "Vertical" }) {
|
|
Title = "Slider Orientation",
|
|
Title = "Slider Orientation",
|
|
X = 0,
|
|
X = 0,
|
|
Y = Pos.Bottom (slider) + 1,
|
|
Y = Pos.Bottom (slider) + 1,
|
|
Width = Dim.Fill (),
|
|
Width = Dim.Fill (),
|
|
|
|
+ Height = 4,
|
|
BorderStyle = LineStyle.Single
|
|
BorderStyle = LineStyle.Single
|
|
};
|
|
};
|
|
|
|
|
|
@@ -117,17 +96,12 @@ public class Sliders : Scenario {
|
|
configView.Add (slider_orientation_slider);
|
|
configView.Add (slider_orientation_slider);
|
|
|
|
|
|
slider_orientation_slider.OptionsChanged += (sender, e) => {
|
|
slider_orientation_slider.OptionsChanged += (sender, e) => {
|
|
-
|
|
|
|
View prev = null;
|
|
View prev = null;
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
-
|
|
|
|
if (e.Options.ContainsKey (0)) {
|
|
if (e.Options.ContainsKey (0)) {
|
|
s.Orientation = Orientation.Horizontal;
|
|
s.Orientation = Orientation.Horizontal;
|
|
|
|
|
|
- s.AdjustBestHeight ();
|
|
|
|
- s.Width = Dim.Percent (50);
|
|
|
|
-
|
|
|
|
- s.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.HLine };
|
|
|
|
|
|
+ s.Style.SpaceChar = new Cell { Rune = CM.Glyphs.HLine };
|
|
|
|
|
|
if (prev == null) {
|
|
if (prev == null) {
|
|
s.LayoutStyle = LayoutStyle.Absolute;
|
|
s.LayoutStyle = LayoutStyle.Absolute;
|
|
@@ -142,11 +116,7 @@ public class Sliders : Scenario {
|
|
} else if (e.Options.ContainsKey (1)) {
|
|
} else if (e.Options.ContainsKey (1)) {
|
|
s.Orientation = Orientation.Vertical;
|
|
s.Orientation = Orientation.Vertical;
|
|
|
|
|
|
- s.AdjustBestWidth ();
|
|
|
|
- s.Height = Dim.Fill ();
|
|
|
|
-
|
|
|
|
- s.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.VLine };
|
|
|
|
-
|
|
|
|
|
|
+ s.Style.SpaceChar = new Cell { Rune = CM.Glyphs.VLine };
|
|
|
|
|
|
if (prev == null) {
|
|
if (prev == null) {
|
|
s.LayoutStyle = LayoutStyle.Absolute;
|
|
s.LayoutStyle = LayoutStyle.Absolute;
|
|
@@ -158,19 +128,29 @@ public class Sliders : Scenario {
|
|
s.Y = 0;
|
|
s.Y = 0;
|
|
prev = s;
|
|
prev = s;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (s.Orientation == Orientation.Horizontal) {
|
|
|
|
+ s.Width = Dim.Percent (50);
|
|
|
|
+ var h = s.ShowLegends && s.LegendsOrientation == Orientation.Vertical ? s.Options.Max (o => o.Legend.Length) + 3 : 4;
|
|
|
|
+ s.Height = h;
|
|
|
|
+ } else {
|
|
|
|
+ var w = s.ShowLegends ? s.Options.Max (o => o.Legend.Length) + 3 : 3;
|
|
|
|
+ s.Width = w;
|
|
|
|
+ s.Height = Dim.Fill ();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
Win.LayoutSubviews ();
|
|
Win.LayoutSubviews ();
|
|
};
|
|
};
|
|
-
|
|
|
|
- #endregion
|
|
|
|
|
|
+ #endregion Slider Orientation Slider
|
|
|
|
|
|
#region Legends Orientation Slider
|
|
#region Legends Orientation Slider
|
|
-
|
|
|
|
var legends_orientation_slider = new Slider<string> (new List<string> { "Horizontal", "Vertical" }) {
|
|
var legends_orientation_slider = new Slider<string> (new List<string> { "Horizontal", "Vertical" }) {
|
|
Title = "Legends Orientation",
|
|
Title = "Legends Orientation",
|
|
X = Pos.Center (),
|
|
X = Pos.Center (),
|
|
Y = Pos.Bottom (slider_orientation_slider) + 1,
|
|
Y = Pos.Bottom (slider_orientation_slider) + 1,
|
|
Width = Dim.Fill (),
|
|
Width = Dim.Fill (),
|
|
|
|
+ Height = 4,
|
|
BorderStyle = LineStyle.Single
|
|
BorderStyle = LineStyle.Single
|
|
};
|
|
};
|
|
|
|
|
|
@@ -180,143 +160,170 @@ public class Sliders : Scenario {
|
|
|
|
|
|
legends_orientation_slider.OptionsChanged += (sender, e) => {
|
|
legends_orientation_slider.OptionsChanged += (sender, e) => {
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
- if (e.Options.ContainsKey (0))
|
|
|
|
|
|
+ if (e.Options.ContainsKey (0)) {
|
|
s.LegendsOrientation = Orientation.Horizontal;
|
|
s.LegendsOrientation = Orientation.Horizontal;
|
|
- else if (e.Options.ContainsKey (1))
|
|
|
|
|
|
+ } else if (e.Options.ContainsKey (1)) {
|
|
s.LegendsOrientation = Orientation.Vertical;
|
|
s.LegendsOrientation = Orientation.Vertical;
|
|
|
|
+ }
|
|
|
|
+ if (s.Orientation == Orientation.Horizontal) {
|
|
|
|
+ s.Width = Dim.Percent (50);
|
|
|
|
+ var h = s.ShowLegends && s.LegendsOrientation == Orientation.Vertical ? s.Options.Max (o => o.Legend.Length) + 3 : 4;
|
|
|
|
+ s.Height = h;
|
|
|
|
+ } else {
|
|
|
|
+ var w = s.ShowLegends ? s.Options.Max (o => o.Legend.Length) + 3 : 3;
|
|
|
|
+ s.Width = w;
|
|
|
|
+ s.Height = Dim.Fill ();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
Win.LayoutSubviews ();
|
|
Win.LayoutSubviews ();
|
|
};
|
|
};
|
|
-
|
|
|
|
- #endregion
|
|
|
|
|
|
+ #endregion Legends Orientation Slider
|
|
|
|
|
|
#region Color Slider
|
|
#region Color Slider
|
|
|
|
+ foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
|
|
+ s.Style.OptionChar.Attribute = Win.GetNormalColor ();
|
|
|
|
+ s.Style.SetChar.Attribute = Win.GetNormalColor ();
|
|
|
|
+ s.Style.LegendAttributes.SetAttribute = Win.GetNormalColor ();
|
|
|
|
+ s.Style.RangeChar.Attribute = Win.GetNormalColor ();
|
|
|
|
+ }
|
|
|
|
|
|
- var sliderColor = new Slider<(Color, Color)> () {
|
|
|
|
- Title = "Color",
|
|
|
|
- X = Pos.Center (),
|
|
|
|
|
|
+ var sliderFGColor = new Slider<(Color, Color)> {
|
|
|
|
+ Title = "FG Color",
|
|
|
|
+ X = 0,
|
|
Y = Pos.Bottom (legends_orientation_slider) + 1,
|
|
Y = Pos.Bottom (legends_orientation_slider) + 1,
|
|
Type = SliderType.Single,
|
|
Type = SliderType.Single,
|
|
- Width = Dim.Fill (),
|
|
|
|
BorderStyle = LineStyle.Single,
|
|
BorderStyle = LineStyle.Single,
|
|
- AllowEmpty = false
|
|
|
|
|
|
+ AllowEmpty = false,
|
|
|
|
+ Orientation = Orientation.Vertical,
|
|
|
|
+ LegendsOrientation = Orientation.Horizontal,
|
|
|
|
+ AutoSize = true
|
|
};
|
|
};
|
|
|
|
|
|
- sliderColor.Style.SetChar.Attribute = new Terminal.Gui.Attribute (Color.BrightGreen, Color.Black);
|
|
|
|
- sliderColor.Style.LegendAttributes.SetAttribute = new Terminal.Gui.Attribute (Color.Green, Color.Blue);
|
|
|
|
|
|
+ sliderFGColor.Style.SetChar.Attribute = new Attribute (Color.BrightGreen, Color.Black);
|
|
|
|
+ sliderFGColor.Style.LegendAttributes.SetAttribute = new Attribute (Color.Green, Color.Blue);
|
|
|
|
|
|
- sliderColor.LegendsOrientation = Orientation.Vertical;
|
|
|
|
var colorOptions = new List<SliderOption<(Color, Color)>> ();
|
|
var colorOptions = new List<SliderOption<(Color, Color)>> ();
|
|
foreach (var colorIndex in Enum.GetValues<ColorName> ()) {
|
|
foreach (var colorIndex in Enum.GetValues<ColorName> ()) {
|
|
var colorName = colorIndex.ToString ();
|
|
var colorName = colorIndex.ToString ();
|
|
colorOptions.Add (new SliderOption<(Color, Color)> {
|
|
colorOptions.Add (new SliderOption<(Color, Color)> {
|
|
- Data = (new Color((ColorName)colorIndex), Win.GetNormalColor ().Background),
|
|
|
|
|
|
+ Data = (new Color (colorIndex), new Color (colorIndex)),
|
|
Legend = colorName,
|
|
Legend = colorName,
|
|
- LegendAbbr = (Rune)colorName [0],
|
|
|
|
|
|
+ LegendAbbr = (Rune)colorName [0]
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- sliderColor.Options = colorOptions;
|
|
|
|
|
|
+ sliderFGColor.Options = colorOptions;
|
|
|
|
|
|
- configView.Add (sliderColor);
|
|
|
|
|
|
+ configView.Add (sliderFGColor);
|
|
|
|
|
|
- sliderColor.OptionsChanged += (sender, e) => {
|
|
|
|
|
|
+ sliderFGColor.OptionsChanged += (sender, e) => {
|
|
if (e.Options.Count != 0) {
|
|
if (e.Options.Count != 0) {
|
|
var data = e.Options.First ().Value.Data;
|
|
var data = e.Options.First ().Value.Data;
|
|
-
|
|
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
- s.Style.OptionChar.Attribute = new Attribute (data.Item1, data.Item2);
|
|
|
|
- s.Style.SetChar.Attribute = new Attribute (data.Item1, data.Item2);
|
|
|
|
- s.Style.LegendAttributes.SetAttribute = new Attribute (data.Item1, Win.GetNormalColor ().Background);
|
|
|
|
- s.Style.RangeChar.Attribute = new Attribute (data.Item1, Win.GetNormalColor ().Background);
|
|
|
|
- s.Style.SpaceChar.Attribute = new Attribute (data.Item1, Win.GetNormalColor ().Background);
|
|
|
|
- s.Style.LegendAttributes.NormalAttribute = new Attribute (data.Item1, Win.GetNormalColor ().Background);
|
|
|
|
- // Here we can not call SetNeedDisplay(), because the OptionsChanged was triggered by Key Pressing,
|
|
|
|
- // that internaly calls SetNeedDisplay.
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
|
|
- s.Style.SetChar.Attribute = null;
|
|
|
|
- s.Style.LegendAttributes.SetAttribute = null;
|
|
|
|
- s.Style.RangeChar.Attribute = null;
|
|
|
|
|
|
+ s.ColorScheme = new ColorScheme (s.ColorScheme);
|
|
|
|
+ s.ColorScheme.Normal = new Attribute (data.Item2, s.ColorScheme.Normal.Background);
|
|
|
|
+
|
|
|
|
+ s.Style.OptionChar.Attribute = new Attribute (data.Item1, s.ColorScheme.Normal.Background);
|
|
|
|
+ s.Style.SetChar.Attribute = new Attribute (data.Item1, s.Style.SetChar.Attribute?.Background ?? s.ColorScheme.Normal.Background);
|
|
|
|
+ s.Style.LegendAttributes.SetAttribute = new Attribute (data.Item1, s.ColorScheme.Normal.Background);
|
|
|
|
+ s.Style.RangeChar.Attribute = new Attribute (data.Item1, s.ColorScheme.Normal.Background);
|
|
|
|
+ s.Style.SpaceChar.Attribute = new Attribute (data.Item1, s.ColorScheme.Normal.Background);
|
|
|
|
+ s.Style.LegendAttributes.NormalAttribute = new Attribute (data.Item1, s.ColorScheme.Normal.Background);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- // Set option after Eventhandler def, so it updates the sliders color.
|
|
|
|
- // sliderColor.SetOption (2);
|
|
|
|
|
|
+ var sliderBGColor = new Slider<(Color, Color)> {
|
|
|
|
+ Title = "BG Color",
|
|
|
|
+ X = Pos.Right (sliderFGColor),
|
|
|
|
+ Y = Pos.Top (sliderFGColor),
|
|
|
|
+ Type = SliderType.Single,
|
|
|
|
+ BorderStyle = LineStyle.Single,
|
|
|
|
+ AllowEmpty = false,
|
|
|
|
+ Orientation = Orientation.Vertical,
|
|
|
|
+ LegendsOrientation = Orientation.Horizontal,
|
|
|
|
+ AutoSize = true
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ sliderBGColor.Style.SetChar.Attribute = new Attribute (Color.BrightGreen, Color.Black);
|
|
|
|
+ sliderBGColor.Style.LegendAttributes.SetAttribute = new Attribute (Color.Green, Color.Blue);
|
|
|
|
|
|
- #endregion
|
|
|
|
|
|
+ sliderBGColor.Options = colorOptions;
|
|
|
|
|
|
- #endregion
|
|
|
|
|
|
+ configView.Add (sliderBGColor);
|
|
|
|
|
|
- Win.FocusFirst ();
|
|
|
|
|
|
+ sliderBGColor.OptionsChanged += (sender, e) => {
|
|
|
|
+ if (e.Options.Count != 0) {
|
|
|
|
+ var data = e.Options.First ().Value.Data;
|
|
|
|
|
|
|
|
+ foreach (var s in Win.Subviews.OfType<Slider> ()) {
|
|
|
|
+ s.ColorScheme = new ColorScheme (s.ColorScheme);
|
|
|
|
+ s.ColorScheme.Normal = new Attribute (s.ColorScheme.Normal.Foreground, data.Item2);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ #endregion Color Slider
|
|
|
|
+ #endregion Config Slider
|
|
|
|
+
|
|
|
|
+ Win.FocusFirst ();
|
|
|
|
+ Application.Top.Initialized += (s, e) => Application.Top.LayoutSubviews ();
|
|
}
|
|
}
|
|
|
|
|
|
public void MakeSliders (View v, List<object> options)
|
|
public void MakeSliders (View v, List<object> options)
|
|
{
|
|
{
|
|
var types = Enum.GetValues (typeof (SliderType)).Cast<SliderType> ().ToList ();
|
|
var types = Enum.GetValues (typeof (SliderType)).Cast<SliderType> ().ToList ();
|
|
-
|
|
|
|
Slider prev = null;
|
|
Slider prev = null;
|
|
|
|
|
|
foreach (var type in types) {
|
|
foreach (var type in types) {
|
|
- var view = new Slider (options, Orientation.Horizontal) {
|
|
|
|
|
|
+ var view = new Slider (options) {
|
|
Title = type.ToString (),
|
|
Title = type.ToString (),
|
|
X = 0,
|
|
X = 0,
|
|
- //X = Pos.Right (view) + 1,
|
|
|
|
Y = prev == null ? 0 : Pos.Bottom (prev),
|
|
Y = prev == null ? 0 : Pos.Bottom (prev),
|
|
- //Y = Pos.Center (),
|
|
|
|
- Width = Dim.Percent (50),
|
|
|
|
BorderStyle = LineStyle.Single,
|
|
BorderStyle = LineStyle.Single,
|
|
Type = type,
|
|
Type = type,
|
|
- LegendsOrientation = Orientation.Horizontal,
|
|
|
|
- AllowEmpty = true,
|
|
|
|
|
|
+ AllowEmpty = true
|
|
};
|
|
};
|
|
v.Add (view);
|
|
v.Add (view);
|
|
prev = view;
|
|
prev = view;
|
|
- };
|
|
|
|
-
|
|
|
|
- var singleOptions = new List<object> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 };
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- var single = new Slider (singleOptions, Orientation.Horizontal) {
|
|
|
|
- Title = "Actual slider",
|
|
|
|
|
|
+ var singleOptions = new List<object>
|
|
|
|
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 };
|
|
|
|
+ var single = new Slider (singleOptions) {
|
|
|
|
+ Title = "Continuous",
|
|
X = 0,
|
|
X = 0,
|
|
- //X = Pos.Right (view) + 1,
|
|
|
|
Y = prev == null ? 0 : Pos.Bottom (prev),
|
|
Y = prev == null ? 0 : Pos.Bottom (prev),
|
|
- //Y = Pos.Center (),
|
|
|
|
Type = SliderType.Single,
|
|
Type = SliderType.Single,
|
|
- //BorderStyle = LineStyle.Single,
|
|
|
|
- LegendsOrientation = Orientation.Horizontal,
|
|
|
|
- Width = Dim.Percent (50),
|
|
|
|
- AllowEmpty = false,
|
|
|
|
- //ShowSpacing = true
|
|
|
|
|
|
+ BorderStyle = LineStyle.Single,
|
|
|
|
+ AllowEmpty = false
|
|
};
|
|
};
|
|
|
|
|
|
single.LayoutStarted += (s, e) => {
|
|
single.LayoutStarted += (s, e) => {
|
|
if (single.Orientation == Orientation.Horizontal) {
|
|
if (single.Orientation == Orientation.Horizontal) {
|
|
- single.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.HLine };
|
|
|
|
- single.Style.OptionChar = new Cell () { Rune = CM.Glyphs.HLine };
|
|
|
|
|
|
+ single.Style.SpaceChar = new Cell { Rune = CM.Glyphs.HLine };
|
|
|
|
+ single.Style.OptionChar = new Cell { Rune = CM.Glyphs.HLine };
|
|
} else {
|
|
} else {
|
|
- single.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.VLine };
|
|
|
|
- single.Style.OptionChar = new Cell () { Rune = CM.Glyphs.VLine };
|
|
|
|
|
|
+ single.Style.SpaceChar = new Cell { Rune = CM.Glyphs.VLine };
|
|
|
|
+ single.Style.OptionChar = new Cell { Rune = CM.Glyphs.VLine };
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- single.Style.SetChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment };
|
|
|
|
- single.Style.DragChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment };
|
|
|
|
|
|
+ single.Style.SetChar = new Cell { Rune = CM.Glyphs.ContinuousMeterSegment };
|
|
|
|
+ single.Style.DragChar = new Cell { Rune = CM.Glyphs.ContinuousMeterSegment };
|
|
|
|
|
|
v.Add (single);
|
|
v.Add (single);
|
|
|
|
|
|
- var label = new Label () {
|
|
|
|
- X = 0,
|
|
|
|
- Y = Pos.Bottom (single),
|
|
|
|
- Height = 1,
|
|
|
|
- Width = Dim.Width (single),
|
|
|
|
- Text = $"{single.GetSetOptions ().FirstOrDefault ()}"
|
|
|
|
- };
|
|
|
|
single.OptionsChanged += (s, e) => {
|
|
single.OptionsChanged += (s, e) => {
|
|
- label.Text = $"{e.Options.FirstOrDefault ().Key}";
|
|
|
|
|
|
+ single.Title = $"Continuous {e.Options.FirstOrDefault ().Key}";
|
|
};
|
|
};
|
|
|
|
|
|
- v.Add (label);
|
|
|
|
|
|
+ var oneOption = new List<object> { "The Only Option" };
|
|
|
|
+ var one = new Slider (oneOption) {
|
|
|
|
+ Title = "One Option",
|
|
|
|
+ X = 0,
|
|
|
|
+ Y = prev == null ? 0 : Pos.Bottom (single),
|
|
|
|
+ Type = SliderType.Single,
|
|
|
|
+ BorderStyle = LineStyle.Single,
|
|
|
|
+ AllowEmpty = false
|
|
|
|
+ };
|
|
|
|
+ v.Add (one);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|