1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 22:48:34 +01:00

added a condition to removechildren

This commit is contained in:
Ellpeck 2019-09-17 14:06:10 +02:00
parent e7c7a5bbc2
commit b699333434

View file

@ -178,9 +178,12 @@ namespace MLEM.Ui.Elements {
this.SetAreaDirty(); this.SetAreaDirty();
} }
public void RemoveChildren() { public void RemoveChildren(Func<Element, bool> condition = null) {
for (var i = this.Children.Count - 1; i >= 0; i--) { for (var i = this.Children.Count - 1; i >= 0; i--) {
this.RemoveChild(this.Children[i]); var child = this.Children[i];
if (condition == null || condition(child)) {
this.RemoveChild(child);
}
} }
} }