using System;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;

namespace TD.SandDock
{
	internal class p : a
	{
		public new delegate void a(int A_0);

		private new DockContainer m_a = null;

		private new r m_b = null;

		private new int m_c;

		private int d;

		private int e = 0;

		private new a f;

		private EventHandler g;

		[MethodImpl(MethodImplOptions.Synchronized)]
		[SpecialName]
		public void b(a A_0)
		{
			f = (a)Delegate.Combine(f, A_0);
		}

		[MethodImpl(MethodImplOptions.Synchronized)]
		[SpecialName]
		public void a(a A_0)
		{
			f = (a)Delegate.Remove(f, A_0);
		}

		[MethodImpl(MethodImplOptions.Synchronized)]
		[SpecialName]
		public void a(EventHandler A_0)
		{
			g = (EventHandler)Delegate.Combine(g, A_0);
		}

		[MethodImpl(MethodImplOptions.Synchronized)]
		[SpecialName]
		public void b(EventHandler A_0)
		{
			g = (EventHandler)Delegate.Remove(g, A_0);
		}

		public p(DockContainer A_0, r A_1, Point A_2)
			: base(A_0, A_0.DockingHints, A_2: false)
		{
			this.m_a = A_0;
			this.m_b = A_1;
			int num = A_1.f();
			switch (A_0.Dock)
			{
			case DockStyle.Left:
				this.m_c = A_2.X - (num - A_0.MinimumSize);
				d = A_2.X + (A_0.MaximumSize - num);
				break;
			case DockStyle.Right:
				this.m_c = A_2.X - (A_0.MaximumSize - num);
				d = A_2.X + (num - A_0.MinimumSize);
				break;
			case DockStyle.Top:
				this.m_c = A_2.Y - (num - A_0.MinimumSize);
				d = A_2.Y + (A_0.MaximumSize - num);
				break;
			case DockStyle.Bottom:
				this.m_c = A_2.Y - (A_0.MaximumSize - num);
				d = A_2.Y + (num - A_0.MinimumSize);
				break;
			}
			a(A_2);
		}

		public override void a(Point A_0)
		{
			Rectangle empty = Rectangle.Empty;
			if (this.m_a.Vertical)
			{
				empty = new Rectangle(A_0.X - 2, 0, 4, this.m_b.Height);
				if (empty.X < this.m_c)
				{
					empty.X = this.m_c;
				}
				if (empty.X > d - 4)
				{
					empty.X = d - 4;
				}
			}
			else
			{
				empty = new Rectangle(0, A_0.Y - 2, this.m_b.Width, 4);
				if (empty.Y < this.m_c)
				{
					empty.Y = this.m_c;
				}
				if (empty.Y > d - 4)
				{
					empty.Y = d - 4;
				}
			}
			switch (this.m_a.Dock)
			{
			case DockStyle.Left:
				e = this.m_b.Width + (empty.X - this.m_b.Width);
				break;
			case DockStyle.Right:
				e = this.m_b.Width - empty.X;
				break;
			case DockStyle.Top:
				e = this.m_b.Height + (empty.Y - this.m_b.Height);
				break;
			case DockStyle.Bottom:
				e = this.m_b.Height - empty.Y;
				break;
			}
			a(new Rectangle(this.m_b.PointToScreen(empty.Location), empty.Size), A_1: false);
		}

		public override void a()
		{
			base.a();
			if (f != null)
			{
				f(e);
			}
		}

		public override void c()
		{
			base.c();
			if (g != null)
			{
				g(this, EventArgs.Empty);
			}
		}

		public override void b()
		{
			base.b();
			this.m_a = null;
			this.m_b = null;
		}

		void IDisposable.Dispose()
		{
			//ILSpy generated this explicit interface implementation from .override directive in b
			this.b();
		}
	}
}
