Skip to content

Commit

Permalink
Add Control.SetOnlyStyleClass (space-wizards#820)
Browse files Browse the repository at this point in the history
This clears the collection of style classes and adds the new one. This allows controls to easily switch between several style classes without needing to keep track of the active one in their own code.
  • Loading branch information
Moneyl authored and PJB3005 committed May 28, 2019
1 parent d7f5c1d commit 6a9a727
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Robust.Client/UserInterface/Control.Styling.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.ViewVariables;

Expand Down Expand Up @@ -60,6 +60,13 @@ public void RemoveStyleClass(string className)
Restyle();
}

public void SetOnlyStyleClass(string className)
{
_styleClasses.Clear();
_styleClasses.Add(className);
Restyle();
}

private void Restyle(bool doChildren = true)
{
_styleProperties.Clear();
Expand Down

0 comments on commit 6a9a727

Please sign in to comment.