1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 12:58:33 +01:00

added onrootremoved and on rootadded events to ui system

This commit is contained in:
Ellpeck 2019-12-05 14:53:13 +01:00
parent 69fd9797d0
commit bffcab3130

View file

@ -64,6 +64,8 @@ namespace MLEM.Ui {
public Element.GenericCallback OnElementAreaUpdated = e => e.OnAreaUpdated?.Invoke(e);
public Element.GenericCallback OnMousedElementChanged;
public Element.GenericCallback OnSelectedElementChanged;
public RootCallback OnRootAdded;
public RootCallback OnRootRemoved;
public UiSystem(GameWindow window, GraphicsDevice device, UiStyle style, InputHandler inputHandler = null) {
this.Controls = new UiControls(this, inputHandler);
@ -136,6 +138,7 @@ namespace MLEM.Ui {
e.System = this;
e.SetAreaDirty();
});
this.OnRootAdded?.Invoke(root);
return true;
}
@ -150,6 +153,7 @@ namespace MLEM.Ui {
e.System = null;
e.SetAreaDirty();
});
this.OnRootRemoved?.Invoke(root);
}
public RootElement Get(string name) {
@ -171,6 +175,8 @@ namespace MLEM.Ui {
root.Element.AndChildren(action);
}
public delegate void RootCallback(RootElement root);
}
public class RootElement {