using System;
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[] array = new Point[5];
			array[0] = new Point(A_1.Left + 2, A_1.Bottom - 1);
			array[1] = new Point(A_1.Left + A_12 - 3, A_1.Top + 4);
			array[2] = new Point(A_1.Left + A_12 + 1, A_1.Top + 2);
			array[3] = new Point(A_1.Right - 2, A_1.Top + 2);
			array[4] = new Point(A_1.Right - 2, A_1.Bottom - 1);
			using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(A_1, A_5, A_6, LinearGradientMode.Vertical))
			{
				A_0.FillPolygon(linearGradientBrush, array);
			}
			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 linearGradientBrush = new LinearGradientBrush(new Point(rect.X, rect.Y - 1), new Point(rect.X, rect.Bottom), A_5, A_6))
			{
				A_0.FillRectangle(linearGradientBrush, rect);
			}
			Point[] array = new Point[6];
			array[0] = new Point(A_1.Left, A_1.Top);
			array[1] = new Point(A_1.Left, A_1.Bottom - 3);
			array[2] = new Point(A_1.Left + 2, A_1.Bottom - 1);
			array[3] = new Point(A_1.Right - 3, A_1.Bottom - 1);
			array[4] = new Point(A_1.Right - 1, A_1.Bottom - 3);
			array[5] = new Point(A_1.Right - 1, A_1.Top);
			A_0.DrawLines(SystemPens.ControlDark, array);
			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.Top:
				array[0] = new Point(A_1.Left, A_1.Top);
				array[1] = new Point(A_1.Right, A_1.Top);
				array[2] = new Point(A_1.Right, A_1.Bottom - 2);
				array[3] = new Point(A_1.Right - 2, A_1.Bottom);
				array[4] = new Point(A_1.Left + 2, A_1.Bottom);
				array[5] = new Point(A_1.Left, A_1.Bottom - 2);
				break;
			case DockSide.Bottom:
				array[0] = new Point(A_1.Left + 2, A_1.Top);
				array[1] = new Point(A_1.Right - 2, A_1.Top);
				array[2] = new Point(A_1.Right, A_1.Top + 2);
				array[3] = new Point(A_1.Right, A_1.Bottom);
				array[4] = new Point(A_1.Left, A_1.Bottom);
				array[5] = new Point(A_1.Left, A_1.Top + 2);
				break;
			case DockSide.Left:
				array[0] = new Point(A_1.Left, A_1.Top);
				array[1] = new Point(A_1.Right - 2, A_1.Top);
				array[2] = new Point(A_1.Right, A_1.Top + 2);
				array[3] = new Point(A_1.Right, A_1.Bottom - 2);
				array[4] = new Point(A_1.Right - 2, A_1.Bottom);
				array[5] = new Point(A_1.Left, A_1.Bottom);
				flag = true;
				break;
			case DockSide.Right:
				array[0] = new Point(A_1.Left + 2, A_1.Top);
				array[1] = new Point(A_1.Right, A_1.Top);
				array[2] = new Point(A_1.Right, A_1.Bottom);
				array[3] = new Point(A_1.Left + 2, A_1.Bottom);
				array[4] = new Point(A_1.Left, A_1.Bottom - 2);
				array[5] = new Point(A_1.Left, A_1.Top + 2);
				flag = true;
				break;
			}
			LinearGradientMode linearGradientMode = (A_2 == DockSide.Left || A_2 == DockSide.Right) ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical;
			using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(A_1, A_6, A_7, linearGradientMode))
			{
				A_0.FillPolygon(linearGradientBrush, 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);
					return;
				}
				A_1.Offset(num, 0);
				A_0.DrawString(A_4, A_5, A_8, A_1, EverettRenderer.StandardStringFormat);
			}
		}
	}
}
