using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MLEM.Graphics; namespace MLEM.Ui.Elements { /// /// A group element to be used inside of a . /// A group is an element that has no rendering or interaction on its own, but that can aid with automatic placement of child elements. /// If a grouping whose children scroll, and which has a , is desired, a panel with its set to can be used. /// public class Group : Element { /// /// Creates a new group with the given settings /// /// The group's anchor /// The group's size /// Whether the group's height should be based on its children's height, see . public Group(Anchor anchor, Vector2 size, bool setHeightBasedOnChildren = true) : this(anchor, size, false, setHeightBasedOnChildren) {} /// /// Creates a new group with the given settings /// /// The group's anchor /// The group's size /// Whether the group's width should be based on its children's width, see . /// Whether the group's height should be based on its children's height, see . public Group(Anchor anchor, Vector2 size, bool setWidthBasedOnChildren, bool setHeightBasedOnChildren) : base(anchor, size) { this.SetWidthBasedOnChildren = setWidthBasedOnChildren; this.SetHeightBasedOnChildren = setHeightBasedOnChildren; this.CanBeSelected = false; } /// public override void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteBatchContext context) { // since the group never accesses its own area when drawing, we have to update it manually this.UpdateAreaIfDirty(); base.Draw(time, batch, alpha, context); } } }