From 320ff8bfc951d8e2e5833322621ea43e716c38bd Mon Sep 17 00:00:00 2001 From: Tig Date: Sat, 26 Oct 2024 12:29:58 -0700 Subject: [PATCH] IDesignable for SpinnerView --- Terminal.Gui/Views/SpinnerView/SpinnerView.cs | 10 +++++++++- UICatalog/Scenarios/AllViewsTester.cs | 4 ++-- UICatalog/Scenarios/SpinnerStyles.cs | 4 +--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Terminal.Gui/Views/SpinnerView/SpinnerView.cs b/Terminal.Gui/Views/SpinnerView/SpinnerView.cs index 474ef57f5..f2ffc8389 100644 --- a/Terminal.Gui/Views/SpinnerView/SpinnerView.cs +++ b/Terminal.Gui/Views/SpinnerView/SpinnerView.cs @@ -11,7 +11,7 @@ namespace Terminal.Gui; /// By default animation only occurs when you call . Use /// to make the automate calls to . /// -public class SpinnerView : View +public class SpinnerView : View, IDesignable { private const int DEFAULT_DELAY = 130; private static readonly SpinnerStyle DEFAULT_STYLE = new SpinnerStyle.Line (); @@ -289,4 +289,12 @@ public class SpinnerView : View Width = GetSpinnerWidth (); } } + + bool IDesignable.EnableForDesign () + { + Style = new SpinnerStyle.Points (); + SpinReverse = true; + AutoSpin = true; + return true; + } } diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs index 5d378db5e..251017611 100644 --- a/UICatalog/Scenarios/AllViewsTester.cs +++ b/UICatalog/Scenarios/AllViewsTester.cs @@ -191,8 +191,8 @@ public class AllViewsTester : Scenario // We have two choices: // 1) Call Layout explicitly // 2) Throw LayoutException so Layout tries again - //_eventLog.Layout (); - throw new LayoutException ("_eventLog"); + _eventLog.Layout (); + //throw new LayoutException ("_eventLog"); } return _eventLog.Frame.Width; diff --git a/UICatalog/Scenarios/SpinnerStyles.cs b/UICatalog/Scenarios/SpinnerStyles.cs index 294d47491..4d269042f 100644 --- a/UICatalog/Scenarios/SpinnerStyles.cs +++ b/UICatalog/Scenarios/SpinnerStyles.cs @@ -13,7 +13,6 @@ public class SpinnerViewStyles : Scenario { public override void Main () { - Application.Init (); Window app = new () @@ -28,7 +27,7 @@ public class SpinnerViewStyles : Scenario foreach (Type style in typeof (SpinnerStyle).GetNestedTypes ()) { - styleDict.Add (i, new KeyValuePair (style.Name, style)); + styleDict.Add (i, new (style.Name, style)); i++; } @@ -212,7 +211,6 @@ public class SpinnerViewStyles : Scenario app.Unloaded -= App_Unloaded; } - Application.Run (app); app.Dispose ();