mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
added onrootremoved and on rootadded events to ui system
This commit is contained in:
parent
69fd9797d0
commit
bffcab3130
1 changed files with 6 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue