mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
added a condition to removechildren
This commit is contained in:
parent
e7c7a5bbc2
commit
b699333434
1 changed files with 5 additions and 2 deletions
|
@ -178,9 +178,12 @@ namespace MLEM.Ui.Elements {
|
|||
this.SetAreaDirty();
|
||||
}
|
||||
|
||||
public void RemoveChildren() {
|
||||
public void RemoveChildren(Func<Element, bool> condition = null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue