Browse Source

IDesignable for SpinnerView

Tig 9 months ago
parent
commit
320ff8bfc9

+ 9 - 1
Terminal.Gui/Views/SpinnerView/SpinnerView.cs

@@ -11,7 +11,7 @@ namespace Terminal.Gui;
 ///     By default animation only occurs when you call <see cref="SpinnerView.AdvanceAnimation()"/>. Use
 ///     <see cref="AutoSpin"/> to make the automate calls to <see cref="SpinnerView.AdvanceAnimation()"/>.
 /// </remarks>
-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;
+    }
 }

+ 2 - 2
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;

+ 1 - 3
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<string, Type> (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 ();