using System.Drawing;
using System.Drawing.Drawing2D;

namespace TD.SandDock.Rendering
{
	internal class a
	{
		public static void a(Graphics A_0, Rectangle A_1, Image A_2, string A_3, Font A_4, Color A_5, Color A_6, Brush A_7, Color A_8, Color A_9, Color A_10, bool A_11, int A_12, int A_13, StringFormat A_14)
		{
			using (Pen pen = new Pen(A_8))
			{
				A_0.DrawLine(pen, A_1.Left, A_1.Bottom - 2, A_1.Left + 1, A_1.Bottom - 2);
				A_0.DrawLine(pen, A_1.Left + 1, A_1.Bottom - 2, A_1.Left + A_12 - 3, A_1.Top + 2);
				A_0.DrawLine(pen, A_1.Left + A_12 - 3, A_1.Top + 2, A_1.Left + A_12 - 2, A_1.Top + 2);
				A_0.DrawLine(pen, A_1.Left + A_12 - 1, A_1.Top + 1, A_1.Left + A_12, A_1.Top + 1);
				A_0.DrawLine(pen, A_1.Left + A_12 + 1, A_1.Top, A_1.Right - 3, A_1.Top);
				A_0.DrawLine(pen, A_1.Right - 3, A_1.Top, A_1.Right - 1, A_1.Top + 2);
				A_0.DrawLine(pen, A_1.Right - 1, A_1.Top + 2, A_1.Right - 1, A_1.Bottom - 2);
			}
			using (Pen pen2 = new Pen(A_9))
			{
				A_0.DrawLine(pen2, A_1.Left + 2, A_1.Bottom - 2, A_1.Left + A_12 - 3, A_1.Top + 3);
				A_0.DrawLine(pen2, A_1.Left + A_12 - 3, A_1.Top + 3, A_1.Left + A_12 - 2, A_1.Top + 3);
				A_0.DrawLine(pen2, A_1.Left + A_12 - 1, A_1.Top + 2, A_1.Left + A_12, A_1.Top + 2);
				A_0.DrawLine(pen2, A_1.Left + A_12 + 1, A_1.Top + 1, A_1.Right - 4, A_1.Top + 1);
			}
			using (Pen pen3 = new Pen(A_10))
			{
				A_0.DrawLine(pen3, A_1.Right - 3, A_1.Top + 1, A_1.Right - 2, A_1.Top + 2);
				A_0.DrawLine(pen3, A_1.Right - 2, A_1.Top + 2, A_1.Right - 2, A_1.Bottom - 2);
			}
			Point[] points = new Point[5]
			{
				new Point(A_1.Left + 2, A_1.Bottom - 1),
				new Point(A_1.Left + A_12 - 3, A_1.Top + 4),
				new Point(A_1.Left + A_12 + 1, A_1.Top + 2),
				new Point(A_1.Right - 2, A_1.Top + 2),
				new Point(A_1.Right - 2, A_1.Bottom - 1)
			};
			using (LinearGradientBrush brush = new LinearGradientBrush(A_1, A_5, A_6, LinearGradientMode.Vertical))
			{
				A_0.FillPolygon(brush, points);
			}
			if (A_11)
			{
				using Pen pen4 = new Pen(A_6);
				A_0.DrawLine(pen4, A_1.Left, A_1.Bottom - 1, A_1.Right - 1, A_1.Bottom - 1);
			}
			A_1.X += A_13;
			A_1.Width -= A_13;
			if (A_2 != null)
			{
				A_0.DrawImage(A_2, A_1.X + 4, A_1.Y + 2, 16, 16);
				A_1.X += 20;
				A_1.Width -= 20;
			}
			if (A_1.Width > 8)
			{
				A_0.DrawString(A_3, A_4, SystemBrushes.ControlText, A_1, A_14);
			}
		}

		public static void a(Graphics A_0, Rectangle A_1, Image A_2, string A_3, Font A_4, Color A_5, Color A_6, Brush A_7)
		{
			Rectangle rect = A_1;
			rect.Inflate(-1, 0);
			rect.Height--;
			using (LinearGradientBrush brush = new LinearGradientBrush(new Point(rect.X, rect.Y - 1), new Point(rect.X, rect.Bottom), A_5, A_6))
			{
				A_0.FillRectangle(brush, rect);
			}
			A_0.DrawLines(points: new Point[6]
			{
				new Point(A_1.Left, A_1.Top),
				new Point(A_1.Left, A_1.Bottom - 3),
				new Point(A_1.Left + 2, A_1.Bottom - 1),
				new Point(A_1.Right - 3, A_1.Bottom - 1),
				new Point(A_1.Right - 1, A_1.Bottom - 3),
				new Point(A_1.Right - 1, A_1.Top)
			}, pen: SystemPens.ControlDark);
			if (A_1.Width >= 24)
			{
				A_0.DrawImage(A_2, new Rectangle(A_1.X + 4, A_1.Y + 2, A_2.Width, A_2.Height));
			}
			A_1.X += 23;
			A_1.Width -= 25;
			if (A_1.Width > 8)
			{
				A_0.DrawString(A_3, A_4, A_7, A_1, EverettRenderer.StandardStringFormat);
			}
		}

		public static void a(Graphics A_0, Rectangle A_1, DockSide A_2, Image A_3, string A_4, Font A_5, Color A_6, Color A_7, Brush A_8, bool A_9)
		{
			bool flag = false;
			Point[] array = new Point[6];
			switch (A_2)
			{
			case DockSide.Left:
			{
				ref Point reference19 = ref array[0];
				reference19 = new Point(A_1.Left, A_1.Top);
				ref Point reference20 = ref array[1];
				reference20 = new Point(A_1.Right - 2, A_1.Top);
				ref Point reference21 = ref array[2];
				reference21 = new Point(A_1.Right, A_1.Top + 2);
				ref Point reference22 = ref array[3];
				reference22 = new Point(A_1.Right, A_1.Bottom - 2);
				ref Point reference23 = ref array[4];
				reference23 = new Point(A_1.Right - 2, A_1.Bottom);
				ref Point reference24 = ref array[5];
				reference24 = new Point(A_1.Left, A_1.Bottom);
				flag = true;
				break;
			}
			case DockSide.Right:
			{
				ref Point reference13 = ref array[0];
				reference13 = new Point(A_1.Left + 2, A_1.Top);
				ref Point reference14 = ref array[1];
				reference14 = new Point(A_1.Right, A_1.Top);
				ref Point reference15 = ref array[2];
				reference15 = new Point(A_1.Right, A_1.Bottom);
				ref Point reference16 = ref array[3];
				reference16 = new Point(A_1.Left + 2, A_1.Bottom);
				ref Point reference17 = ref array[4];
				reference17 = new Point(A_1.Left, A_1.Bottom - 2);
				ref Point reference18 = ref array[5];
				reference18 = new Point(A_1.Left, A_1.Top + 2);
				flag = true;
				break;
			}
			case DockSide.Top:
			{
				ref Point reference7 = ref array[0];
				reference7 = new Point(A_1.Left, A_1.Top);
				ref Point reference8 = ref array[1];
				reference8 = new Point(A_1.Right, A_1.Top);
				ref Point reference9 = ref array[2];
				reference9 = new Point(A_1.Right, A_1.Bottom - 2);
				ref Point reference10 = ref array[3];
				reference10 = new Point(A_1.Right - 2, A_1.Bottom);
				ref Point reference11 = ref array[4];
				reference11 = new Point(A_1.Left + 2, A_1.Bottom);
				ref Point reference12 = ref array[5];
				reference12 = new Point(A_1.Left, A_1.Bottom - 2);
				break;
			}
			case DockSide.Bottom:
			{
				ref Point reference = ref array[0];
				reference = new Point(A_1.Left + 2, A_1.Top);
				ref Point reference2 = ref array[1];
				reference2 = new Point(A_1.Right - 2, A_1.Top);
				ref Point reference3 = ref array[2];
				reference3 = new Point(A_1.Right, A_1.Top + 2);
				ref Point reference4 = ref array[3];
				reference4 = new Point(A_1.Right, A_1.Bottom);
				ref Point reference5 = ref array[4];
				reference5 = new Point(A_1.Left, A_1.Bottom);
				ref Point reference6 = ref array[5];
				reference6 = new Point(A_1.Left, A_1.Top + 2);
				break;
			}
			}
			LinearGradientMode linearGradientMode = ((A_2 != DockSide.Left && A_2 != DockSide.Right) ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal);
			using (LinearGradientBrush brush = new LinearGradientBrush(A_1, A_6, A_7, linearGradientMode))
			{
				A_0.FillPolygon(brush, array);
			}
			A_0.DrawPolygon(SystemPens.ControlDark, array);
			A_1.Inflate(-2, -2);
			if (flag)
			{
				A_1.Offset(0, 1);
			}
			else
			{
				A_1.Offset(1, 0);
			}
			A_0.DrawImage(A_3, new Rectangle(A_1.Left, A_1.Top, A_3.Width, A_3.Height));
			if (A_4.Length != 0)
			{
				int num = (A_9 ? 21 : 23);
				if (flag)
				{
					A_1.Offset(0, num);
					A_0.DrawString(A_4, A_5, A_8, A_1, EverettRenderer.StandardVerticalStringFormat);
				}
				else
				{
					A_1.Offset(num, 0);
					A_0.DrawString(A_4, A_5, A_8, A_1, EverettRenderer.StandardStringFormat);
				}
			}
		}
	}
}
