using System;
using System.Drawing;

namespace TD.SandDock.Rendering
{
	public class BoxModel
	{
		public BoxModel()
		{
			this.a = new BoxEdges();
			this.b = new BoxEdges();
		}

		public BoxModel(int width, int height, int paddingLeft, int paddingTop, int paddingRight, int paddingBottom, int marginLeft, int marginTop, int marginRight, int marginBottom)
		{
			this.c = width;
			this.d = height;
			this.b = new BoxEdges(paddingLeft, paddingTop, paddingRight, paddingBottom);
			this.a = new BoxEdges(marginLeft, marginTop, marginRight, marginBottom);
		}

		public int ExtraWidth
		{
			get
			{
				return this.a.Left + this.a.Right + this.b.Left + this.b.Right;
			}
		}

		public int ExtraHeight
		{
			get
			{
				return this.a.Top + this.a.Bottom + this.b.Top + this.b.Bottom;
			}
		}

		public Rectangle RemovePadding(Rectangle source)
		{
			source.X += this.b.Left;
			source.Y += this.b.Top;
			source.Width -= this.b.Left + this.b.Right;
			source.Height -= this.b.Top + this.b.Bottom;
			return source;
		}

		public Rectangle RemoveMargin(Rectangle source)
		{
			source.X += this.a.Left;
			source.Y += this.a.Top;
			source.Width -= this.a.Left + this.a.Right;
			source.Height -= this.a.Top + this.a.Bottom;
			return source;
		}

		public Size InnerSize
		{
			get
			{
				return new Size(this.c - this.a.Left - this.a.Right, this.d - this.a.Top - this.a.Bottom);
			}
		}

		public int Height
		{
			get
			{
				return this.d;
			}
			set
			{
				this.d = value;
			}
		}

		public int Width
		{
			get
			{
				return this.c;
			}
			set
			{
				this.c = value;
			}
		}

		public BoxEdges Margin
		{
			get
			{
				return this.a;
			}
			set
			{
				this.a = value;
			}
		}

		public BoxEdges Padding
		{
			get
			{
				return this.b;
			}
			set
			{
				this.b = value;
			}
		}

		private BoxEdges a;

		private BoxEdges b;

		private int c;

		private int d;
	}
}
