using System.Numerics; using Voile.Input; using Voile.Rendering; namespace Voile.UI; public interface IElement { /// /// This element's position in pixels relative to the viewport top-left edge. /// public Vector2 GlobalPosition { get; } /// /// The size of this element. /// public Rect Size { get; set; } } public interface IParentableElement { /// /// This parentable element's children. /// public IReadOnlyList Children { get; } /// /// Add a child element to this element. /// /// Child . public void AddChild(UIElement child); /// /// Remove a child element from this element. /// /// Child to remove. public void RemoveChild(UIElement child); } public interface IResizeableElement { /// /// Get a minimum rectangle size for this element. /// public abstract Rect MinimumSize { get; } } public interface IUpdatableElement { /// /// Specifies if this element's properties have changed, making it necessary to update it. /// public bool Dirty { get; } /// /// Update this element. /// void Update(); /// /// Marks this element as changed, requiring an update. /// void MarkDirty(); } public interface IRenderableElement { /// /// Specifies if this element should be drawn. /// public bool Visible { get; set; } /// /// Render this element. /// /// Renderer to call draw operations on. /// A style to use to draw this element. public void Render(RenderSystem renderer, Style style); /// /// Draws this element's size bounds. /// /// Renderer to use. public void DrawSize(RenderSystem renderer); } public interface IInputElement { /// /// Specifies if this element should ignore inputs. /// public bool IgnoreInput { get; set; } /// /// Send an input action to this element. /// /// Input action to send. void Input(UIInputContext action); } public interface IAnchorableElement { public Anchor Anchor { get; set; } public Vector2 AnchorOffset { get; set; } public void ApplyAnchor(Vector2 parentPosition, Rect parentRect); }