1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-27 02:29:23 +01:00
MLEM/MLEM.Ui/Elements/Group.cs

30 lines
1.3 KiB
C#
Raw Normal View History

2019-08-10 13:44:48 +02:00
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
2019-08-10 13:44:48 +02:00
namespace MLEM.Ui.Elements {
2020-05-22 17:02:24 +02:00
/// <summary>
/// A group element to be used inside of a <see cref="UiSystem"/>.
/// A group is an element that has no rendering or interaction on its own, but that can aid with automatic placement of child elements.
/// </summary>
2019-08-10 13:44:48 +02:00
public class Group : Element {
2020-05-22 17:02:24 +02:00
/// <summary>
/// Creates a new group with the given settings
/// </summary>
/// <param name="anchor">The group's anchor</param>
/// <param name="size">The group's size</param>
/// <param name="setHeightBasedOnChildren">Whether the group's height should be based on its children's height</param>
public Group(Anchor anchor, Vector2 size, bool setHeightBasedOnChildren = true) : base(anchor, size) {
this.SetHeightBasedOnChildren = setHeightBasedOnChildren;
2019-08-28 18:27:17 +02:00
this.CanBeSelected = false;
2019-08-10 13:44:48 +02:00
}
2020-05-22 17:02:24 +02:00
/// <inheritdoc />
public override void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) {
2020-05-17 00:59:15 +02:00
// since the group never accesses its own area when drawing, we have to update it manually
this.UpdateAreaIfDirty();
base.Draw(time, batch, alpha, blendState, samplerState, matrix);
}
2019-08-10 13:44:48 +02:00
}
}