mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-25 01:39:23 +01:00
added child addition and removal callbacks
This commit is contained in:
parent
2461b78f1b
commit
af1918d545
1 changed files with 6 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue