IDesignable for SpinnerView

This commit is contained in:
Tig
2024-10-26 12:29:58 -07:00
parent 6bfa8ba760
commit 320ff8bfc9
3 changed files with 12 additions and 6 deletions

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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 ();