mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
added events for when a root element is added or removed from a ui
This commit is contained in:
parent
b0d146849d
commit
2cc77f42cd
1 changed files with 11 additions and 1 deletions
|
@ -268,6 +268,7 @@ namespace MLEM.Ui {
|
|||
e.SetAreaDirty();
|
||||
});
|
||||
this.OnRootAdded?.Invoke(root);
|
||||
root.OnAddedToUi?.Invoke(this);
|
||||
this.SortRoots();
|
||||
return root;
|
||||
}
|
||||
|
@ -289,6 +290,7 @@ namespace MLEM.Ui {
|
|||
e.SetAreaDirty();
|
||||
});
|
||||
this.OnRootRemoved?.Invoke(root);
|
||||
root.OnRemovedFromUi?.Invoke(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -417,9 +419,17 @@ namespace MLEM.Ui {
|
|||
/// </summary>
|
||||
public Element.GenericCallback OnElementAdded;
|
||||
/// <summary>
|
||||
/// Even that is invoked when a <see cref="Element"/> is removed rom this root element of any of its children.
|
||||
/// Event that is invoked when a <see cref="Element"/> is removed rom this root element of any of its children.
|
||||
/// </summary>
|
||||
public Element.GenericCallback OnElementRemoved;
|
||||
/// <summary>
|
||||
/// Event that is invoked when this <see cref="RootElement"/> gets added to a <see cref="UiSystem"/> in <see cref="UiSystem.Add"/>
|
||||
/// </summary>
|
||||
public Action<UiSystem> OnAddedToUi;
|
||||
/// <summary>
|
||||
/// Event that is invoked when this <see cref="RootElement"/> gets removed from a <see cref="UiSystem"/> in <see cref="UiSystem.Remove"/>
|
||||
/// </summary>
|
||||
public Action<UiSystem> OnRemovedFromUi;
|
||||
|
||||
internal RootElement(string name, Element element, UiSystem system) {
|
||||
this.Name = name;
|
||||
|
|
Loading…
Reference in a new issue