From ae4ced1cc126a0e7097c4a8ae74b8523dbd2e90e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 25 Sep 2019 16:47:19 +0200 Subject: [PATCH] added some more element events --- MLEM.Ui/Elements/Element.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index 424541a..77c6820 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -69,6 +69,8 @@ namespace MLEM.Ui.Elements { public Rectangle ChildPaddedArea => this.UnscrolledArea.Shrink(this.ScaledChildPadding); public Point ScaledChildPadding => this.childPadding.Multiply(this.Scale); + public DrawCallback OnDrawn; + public TimeCallback OnUpdated; public GenericCallback OnPressed; public GenericCallback OnSecondaryPressed; public GenericCallback OnSelected; @@ -420,6 +422,8 @@ namespace MLEM.Ui.Elements { } public virtual void Update(GameTime time) { + this.System.OnElementUpdated?.Invoke(this, time); + foreach (var child in this.GetRelevantChildren()) child.Update(time); } @@ -470,6 +474,8 @@ namespace MLEM.Ui.Elements { public delegate void DrawCallback(Element element, GameTime time, SpriteBatch batch, float alpha); + public delegate void TimeCallback(Element element, GameTime time); + public delegate Element TabNextElementCallback(bool backward, Element usualNext); public delegate Element GamepadNextElementCallback(Direction2 dir, Element usualNext);