1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-07 23:33:38 +02:00

added child addition and removal callbacks

This commit is contained in:
Ellpeck 2020-05-20 00:48:53 +02:00
parent 2461b78f1b
commit af1918d545

View file

@ -152,6 +152,8 @@ namespace MLEM.Ui.Elements {
public OtherElementCallback OnSelectedElementChanged;
public TabNextElementCallback GetTabNextElement;
public GamepadNextElementCallback GetGamepadNextElement;
public OtherElementCallback OnChildAdded;
public OtherElementCallback OnChildRemoved;
public StyleProp<NinePatch> SelectionIndicator;
public StyleProp<SoundEffectInstance> ActionSound;
@ -179,8 +181,8 @@ namespace MLEM.Ui.Elements {
element.AndChildren(e => {
e.Root = this.Root;
e.System = this.System;
if (this.Root != null)
this.Root.OnElementAdded(e);
this.Root?.OnElementAdded(e);
this.OnChildAdded?.Invoke(this, e);
});
this.SetSortedChildrenDirty();
element.SetAreaDirty();
@ -196,8 +198,8 @@ namespace MLEM.Ui.Elements {
element.AndChildren(e => {
e.Root = null;
e.System = null;
if (this.Root != null)
this.Root.OnElementRemoved(e);
this.Root?.OnElementRemoved(e);
this.OnChildRemoved?.Invoke(this, e);
});
this.SetSortedChildrenDirty();
}