using System;
using System.Drawing;
using System.Windows.Forms;
using TD.SandDock.Rendering;

namespace TD.SandDock
{
	public abstract class LayoutSystemBase : IDisposable
	{
		internal void a(SandDockManager A_0, DockContainer A_1, LayoutSystemBase A_2, DockControl A_3, Point A_4, DockingHints A_5, DockingManager A_6)
		{
			if (A_6 == DockingManager.Whidbey && TD.SandDock.a.f())
			{
				this.g = new e(A_0, this.DockContainer, this, A_3, A_4, A_5, true);
			}
			else
			{
				this.g = new j(A_0, this.DockContainer, this, A_3, A_4, A_5, true);
			}
			this.g.b(new j.a(this.OnDockingManagerCommitted));
			this.g.a(new EventHandler(this.OnDockingManagerCancelled));
		}

		private void a()
		{
			this.g.a(new j.a(this.OnDockingManagerCommitted));
			this.g.b(new EventHandler(this.OnDockingManagerCancelled));
			this.g = null;
		}

		internal virtual void OnDockingManagerCommitted(j.b target)
		{
			this.a();
		}

		internal virtual void OnDockingManagerCancelled(object sender, EventArgs e)
		{
			this.a();
		}

		public void SetWorkingSize(Size size)
		{
			this.f = new SizeF((float)size.Width, (float)size.Height);
		}

		public DockContainer DockContainer
		{
			get
			{
				return this.d;
			}
		}

		public bool IsInContainer
		{
			get
			{
				return this.d != null;
			}
		}

		public LayoutSystemBase Parent
		{
			get
			{
				return this.c;
			}
		}

		internal virtual void SetDockContainer(DockContainer dockContainer)
		{
			this.d = dockContainer;
		}

		internal LayoutSystemBase()
		{
		}

		protected internal virtual void OnDragOver(DragEventArgs drgevent)
		{
		}

		protected internal virtual void OnMouseMove(MouseEventArgs e)
		{
		}

		protected internal virtual void OnMouseLeave()
		{
		}

		protected internal virtual void OnMouseDoubleClick()
		{
		}

		protected internal virtual void OnMouseDown(MouseEventArgs e)
		{
		}

		protected internal virtual void OnMouseUp(MouseEventArgs e)
		{
		}

		protected internal virtual void Layout(RendererBase renderer, Graphics graphics, Rectangle bounds, bool floating)
		{
			this.e = bounds;
		}

		public Rectangle Bounds
		{
			get
			{
				return this.e;
			}
		}

		internal abstract void Paint(RendererBase renderer, Graphics graphics, Font font);

		public virtual void Dispose()
		{
			if (this.c is SplitLayoutSystem)
			{
				((SplitLayoutSystem)this.c).LayoutSystems.Remove(this);
			}
			this.SetDockContainer(null);
		}

		internal const int a = 250;

		internal const int b = 400;

		internal LayoutSystemBase c = null;

		private DockContainer d = null;

		private Rectangle e = Rectangle.Empty;

		internal SizeF f = new SizeF(250f, 400f);

		internal j g = null;
	}
}
