/// <summary>Constructor that initializes the various resources that we use in rendering.</summary>
		/// <param name="parentWindow">Parent window that this renderer belongs to.</param>
		public ChromeTabRenderer(TitleBarTabs parentWindow)
			: base(parentWindow)
		{
			// Initialize the various images to use during rendering
			_activeLeftSideImage = Resources.ChromeLeft;
			_activeRightSideImage = Resources.ChromeRight;
			_activeCenterImage = Resources.ChromeCenter;
			_inactiveLeftSideImage = Resources.ChromeInactiveLeft;
			_inactiveRightSideImage = Resources.ChromeInactiveRight;
			_inactiveCenterImage = Resources.ChromeInactiveCenter;
			_closeButtonImage = Resources.ChromeClose;
			_closeButtonHoverImage = Resources.ChromeCloseHover;
			_background = Resources.ChromeBackground;
			_addButtonImage = new Bitmap(Resources.ChromeAdd);
			_addButtonHoverImage = new Bitmap(Resources.ChromeAddHover);

			// Set the various positioning properties
			CloseButtonMarginTop = 6;
			CloseButtonMarginLeft = 2;
			AddButtonMarginTop = 5;
			AddButtonMarginLeft = -3;
			CaptionMarginTop = 5;
			IconMarginTop = 6;
			IconMarginRight = 5;
			AddButtonMarginRight = 5;
		}
		/// <summary>
		/// Adds <paramref name="window" /> to <see cref="_openWindows" /> and attaches event handlers to its <see cref="Form.FormClosed" /> event to keep track
		/// of it.
		/// </summary>
		/// <param name="window">Window that we're opening.</param>
		public void OpenWindow(TitleBarTabs window)
		{
			if (!_openWindows.Contains(window))
			{
				window.ApplicationContext = this;

				_openWindows.Add(window);
				window.FormClosed += window_FormClosed;
			}
		}
		/// <summary>Constructor; takes the initial window to display and, if it's not closing, opens it and shows it.</summary>
		/// <param name="initialFormInstance">Initial window to display.</param>
		public void Start(TitleBarTabs initialFormInstance)
		{
			if (initialFormInstance.IsClosing)
				ExitThread();

			else
			{
				OpenWindow(initialFormInstance);
				initialFormInstance.Show();
			}
		}
		/// <summary>Creates the overlay window and attaches it to <paramref name="parentForm" />.</summary>
		/// <param name="parentForm">Parent form that the overlay should be rendered on top of.</param>
		protected TitleBarTabsOverlay(TitleBarTabs parentForm)
		{
			_parentForm = parentForm;

			// We don't want this window visible in the taskbar
			ShowInTaskbar = false;
			FormBorderStyle = FormBorderStyle.Sizable;
			MinimizeBox = false;
			MaximizeBox = false;
			_aeroEnabled = _parentForm.IsCompositionEnabled;

			Show(_parentForm);
			AttachHandlers();
		}
		/// <summary>Default constructor that initializes the <see cref="_parentWindow" /> and <see cref="ShowAddButton" /> properties.</summary>
		/// <param name="parentWindow">The parent window that this renderer instance belongs to.</param>
		protected BaseTabRenderer(TitleBarTabs parentWindow)
		{
			_parentWindow = parentWindow;
			ShowAddButton = true;
			TabRepositionDragDistance = 10;
			TabTearDragDistance = 10;

			parentWindow.Tabs.CollectionModified += Tabs_CollectionModified;

			if (parentWindow._overlay != null)
			{
				parentWindow._overlay.MouseMove += Overlay_MouseMove;
				parentWindow._overlay.MouseUp += Overlay_MouseUp;
				parentWindow._overlay.MouseDown += Overlay_MouseDown;
			}
		}
		/// <summary>Retrieves or creates the overlay for <paramref name="parentForm" />.</summary>
		/// <param name="parentForm">Parent form that we are to create the overlay for.</param>
		/// <returns>Newly-created or previously existing overlay for <paramref name="parentForm" />.</returns>
		public static TitleBarTabsOverlay GetInstance(TitleBarTabs parentForm)
		{
			if (!_parents.ContainsKey(parentForm))
				_parents.Add(parentForm, new TitleBarTabsOverlay(parentForm));

			return _parents[parentForm];
		}
		/// <summary>Default constructor that initializes the various properties.</summary>
		/// <param name="parent">Parent window that contains this tab.</param>
		public TitleBarTab(TitleBarTabs parent)
		{
			ShowCloseButton = true;
			Parent = parent;
		}