mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +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 OtherElementCallback OnSelectedElementChanged;
|
||||||
public TabNextElementCallback GetTabNextElement;
|
public TabNextElementCallback GetTabNextElement;
|
||||||
public GamepadNextElementCallback GetGamepadNextElement;
|
public GamepadNextElementCallback GetGamepadNextElement;
|
||||||
|
public OtherElementCallback OnChildAdded;
|
||||||
|
public OtherElementCallback OnChildRemoved;
|
||||||
|
|
||||||
public StyleProp<NinePatch> SelectionIndicator;
|
public StyleProp<NinePatch> SelectionIndicator;
|
||||||
public StyleProp<SoundEffectInstance> ActionSound;
|
public StyleProp<SoundEffectInstance> ActionSound;
|
||||||
|
@ -179,8 +181,8 @@ namespace MLEM.Ui.Elements {
|
||||||
element.AndChildren(e => {
|
element.AndChildren(e => {
|
||||||
e.Root = this.Root;
|
e.Root = this.Root;
|
||||||
e.System = this.System;
|
e.System = this.System;
|
||||||
if (this.Root != null)
|
this.Root?.OnElementAdded(e);
|
||||||
this.Root.OnElementAdded(e);
|
this.OnChildAdded?.Invoke(this, e);
|
||||||
});
|
});
|
||||||
this.SetSortedChildrenDirty();
|
this.SetSortedChildrenDirty();
|
||||||
element.SetAreaDirty();
|
element.SetAreaDirty();
|
||||||
|
@ -196,8 +198,8 @@ namespace MLEM.Ui.Elements {
|
||||||
element.AndChildren(e => {
|
element.AndChildren(e => {
|
||||||
e.Root = null;
|
e.Root = null;
|
||||||
e.System = null;
|
e.System = null;
|
||||||
if (this.Root != null)
|
this.Root?.OnElementRemoved(e);
|
||||||
this.Root.OnElementRemoved(e);
|
this.OnChildRemoved?.Invoke(this, e);
|
||||||
});
|
});
|
||||||
this.SetSortedChildrenDirty();
|
this.SetSortedChildrenDirty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue