recrownedathenaeum/RecrownedAthenaeum/UI/Book/Page.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2019-01-13 20:22:53 +00:00
using RecrownedAthenaeum.UI.Modular;
namespace RecrownedAthenaeum.UI.Book
{
2019-01-14 07:26:46 +00:00
/// <summary>
/// A page a part of a <see cref="Book"/>.
/// </summary>
public class Page : UIModuleGroup
{
private readonly int pageX, pageY;
2019-01-14 07:26:46 +00:00
/// <summary>
/// Whether or not this book needs to be refreshed with new dimensions.
/// </summary>
public bool requiresSizeUpdate;
2019-01-14 07:26:46 +00:00
/// <summary>
/// Constructs a page.
/// </summary>
/// <param name="pageX">The X position in the book.</param>
/// <param name="pageY">The Y position in the book.</param>
public Page(int pageX, int pageY) : base(false)
{
this.pageX = pageX;
this.pageY = pageY;
2019-01-14 07:26:46 +00:00
requiresSizeUpdate = true;
Name = ToString();
}
2019-01-14 07:26:46 +00:00
/// <summary>
/// Called when this page is flagged as needing a size update.
/// </summary>
/// <param name="width">New width.</param>
/// <param name="height">New Height</param>
public virtual void ApplySize(int width, int height)
{
bounds.X = pageX * width;
bounds.Y = pageY * height;
bounds.Width = width;
bounds.Height = height;
2019-01-14 07:26:46 +00:00
requiresSizeUpdate = false;
}
}
}