using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; namespace Content.Client.UserInterface { public static class ButtonHelpers { /// /// This searches recursively through all the children of "parent" /// and sets the Disabled value of any buttons found to "val" /// /// The control which childrens get searched /// The value to which disabled gets set public static void SetButtonDisabledRecursive(Control parent, bool val) { foreach (var child in parent.Children) { if (child is Button but) { but.Disabled = val; continue; } if (child.ChildCount > 0) { SetButtonDisabledRecursive(child, val); } } } } }