Beispiel #1
0
        private bool ShouldPaneDiamondVisible()
        {
            if (DockPane == null)
            {
                return(false);
            }

            if (DragHandler.DragControl == DockPane)
            {
                return(false);
            }

            if (DragHandler.DragControl == DockPane.DockListContainer)
            {
                return(false);
            }

            IDockContent content = DragHandler.DragControl as IDockContent;

            if (content != null && DockPane.Contents.Contains(content) && DockPane.DisplayingContents.Count == 1)
            {
                return(false);
            }

            return(DragHandler.IsDockStateValid(DockPane.DockState));
        }
Beispiel #2
0
        private bool ShouldPanelIndicatorVisible(DockState dockState)
        {
            if (!Visible)
            {
                return(false);
            }

            if (DockPanel.DockWindows[dockState].Visible)
            {
                return(false);
            }

            return(DragHandler.IsDockStateValid(dockState));
        }
Beispiel #3
0
        internal void TestDrop(DragHandler dragHandler)
        {
            if (!dragHandler.IsDockStateValid(DockState) ||
                DisplayingList.Count != 1)
            {
                return;
            }

            Point ptMouse = Control.MousePosition;
            uint  lParam  = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y);

            if (User32.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION)
            {
                dragHandler.DockOutline.Show(DisplayingList[0], -1);
            }
        }
Beispiel #4
0
        internal void TestDrop(DragHandler dragHandler)
        {
            if (!dragHandler.IsDockStateValid(DockState))
            {
                return;
            }

            Point ptMouse = Control.MousePosition;

            HitTestResult hitTestResult = GetHitTest(ptMouse);

            if (hitTestResult.HitArea == HitTestArea.Caption)
            {
                dragHandler.DockOutline.Show(this, -1);
            }
            else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1)
            {
                dragHandler.DockOutline.Show(this, hitTestResult.Index);
            }
        }
Beispiel #5
0
		internal void TestDrop(DragHandler dragHandler)
		{
			if (!dragHandler.IsDockStateValid(DockState))
				return;

			Point ptMouse = Control.MousePosition;

			HitTestResult hitTestResult = GetHitTest(ptMouse);
			if (hitTestResult.HitArea == HitTestArea.Caption)
				dragHandler.DockOutline.Show(this, -1);
			else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1)
				dragHandler.DockOutline.Show(this, hitTestResult.Index);
		}
		internal void TestDrop(DragHandler dragHandler, Point pt)
		{
			if (DockState == DockState.Document)
				DockPanel.TestDrop(dragHandler, pt);

			if (dragHandler.DropTarget.DropTo != null)
				return;

			if (DockHelper.IsDockStateAutoHide(DockState))
				return;

			if (!dragHandler.IsDockStateValid(DockState))
				return;

			if (dragHandler.DragSource == DragSource.FloatWindow &&
				FloatWindow == dragHandler.DragControl)
				return;

			if (dragHandler.DragSource == DragSource.Pane &&
				dragHandler.DragControl == this)
				return;

			if (dragHandler.DragSource == DragSource.Content && 
				dragHandler.DragControl == this &&
				DockState == DockState.Document &&
				DisplayingContents.Count == 1)
				return;

			Point ptClient = PointToClient(pt);
			Rectangle rectPane = DisplayingRectangle;
			int dragSize = MeasurePane.DragSize;
			if (ptClient.Y - rectPane.Top >= 0 && ptClient.Y - rectPane.Top < dragSize)
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Top);
			else if (rectPane.Bottom - ptClient.Y >= 0 && rectPane.Bottom - ptClient.Y < dragSize)
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Bottom);
			else if (rectPane.Right - ptClient.X >= 0 && rectPane.Right - ptClient.X < dragSize)
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Right);
			else if (ptClient.X - rectPane.Left >= 0 && ptClient.X - rectPane.Left < dragSize)
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Left);
			else
			{
				if (rectPane.Height <= TabStripRectangle.Height)
					return;

				HitTestResult hitTestResult = GetHitTest(pt);
				if (hitTestResult.HitArea == HitTestArea.Caption)
					dragHandler.DropTarget.SetDropTarget(this, -1);
				else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1)
					dragHandler.DropTarget.SetDropTarget(this, hitTestResult.Index);
				else if (DockState == DockState.Float && !HasCaption &&
					((ptClient.Y - rectPane.Top >= dragSize && ptClient.Y - rectPane.Top < 2 * dragSize) ||
					(rectPane.Bottom - ptClient.Y >= dragSize && rectPane.Bottom - ptClient.Y < 2 * dragSize) ||
					(rectPane.Right - ptClient.X >= dragSize && rectPane.Right - ptClient.X < 2 * dragSize) ||
					(ptClient.X - rectPane.Left >= dragSize && ptClient.X - rectPane.Left < 2 * dragSize)))
					dragHandler.DropTarget.SetDropTarget(this, -1);
				else
					return;
			}

			if (dragHandler.DropTarget.SameAsOldValue)
				return;

			dragHandler.DragOutline = GetTestDropOutline(dragHandler.DropTarget.Dock, dragHandler.DropTarget.ContentIndex);
		}
Beispiel #7
0
		internal void TestDrop(DragHandler dragHandler, Point pt)
		{
			if (DockArea.Width <=0 || DockArea.Height <= 0)
				return;

			Point ptClient = PointToClient(pt);

			int dragSize = MeasurePane.DragSize;
			Rectangle rectDoc = DocumentRectangle;

			if (ptClient.Y - rectDoc.Top >= 0 && ptClient.Y - rectDoc.Top < dragSize &&
				DockWindows[DockState.DockTop].DisplayingList.Count == 0 &&
				dragHandler.IsDockStateValid(DockState.DockTop))
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Top);
			else if (rectDoc.Bottom - ptClient.Y >= 0 && rectDoc.Bottom - ptClient.Y < dragSize &&
				DockWindows[DockState.DockBottom].DisplayingList.Count == 0 &&
				dragHandler.IsDockStateValid(DockState.DockBottom))
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Bottom);
			else if (rectDoc.Right - ptClient.X >= 0 && rectDoc.Right - ptClient.X < dragSize &&
				DockWindows[DockState.DockRight].DisplayingList.Count == 0 &&
				dragHandler.IsDockStateValid(DockState.DockRight))
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Right);
			else if (ptClient.X - rectDoc.Left >= 0 && ptClient.X - rectDoc.Left < dragSize &&
				DockWindows[DockState.DockLeft].DisplayingList.Count == 0 &&
				dragHandler.IsDockStateValid(DockState.DockLeft))
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Left);
			else if (((ptClient.Y - rectDoc.Top >= dragSize && ptClient.Y - rectDoc.Top < 2 * dragSize) ||
				(rectDoc.Bottom - ptClient.Y >= dragSize && rectDoc.Bottom - ptClient.Y < 2 * dragSize) ||
				(rectDoc.Right - ptClient.X >= dragSize && rectDoc.Right - ptClient.X < 2 * dragSize) ||
				(ptClient.X - rectDoc.Left >= dragSize && ptClient.X - rectDoc.Left < 2 * dragSize)) &&
				DockWindows[DockState.Document].DisplayingList.Count == 0 &&
				dragHandler.IsDockStateValid(DockState.Document))
				dragHandler.DropTarget.SetDropTarget(this, DockStyle.Fill);
			else
				return;

			if (dragHandler.DropTarget.SameAsOldValue)
				return;

			Rectangle rect = DockArea;
			if (dragHandler.DropTarget.Dock == DockStyle.Top)
				rect.Height = (int)(DockArea.Height * DockTopPortion);
			else if (dragHandler.DropTarget.Dock == DockStyle.Bottom)
			{
				rect.Height = (int)(DockArea.Height * DockBottomPortion);
				rect.Y = DockArea.Bottom - rect.Height;
			}
			else if (dragHandler.DropTarget.Dock == DockStyle.Left)
				rect.Width = (int)(DockArea.Width * DockLeftPortion);
			else if (dragHandler.DropTarget.Dock == DockStyle.Right)
			{
				rect.Width = (int)(DockArea.Width * DockRightPortion);
				rect.X = DockArea.Right - rect.Width;
			}
			else if (dragHandler.DropTarget.Dock == DockStyle.Fill)
				rect = DocumentRectangle;

			rect.Location = PointToScreen(rect.Location);
			dragHandler.DragOutline = DrawHelper.CreateDragOutline(rect, dragSize);
		}
Beispiel #8
0
        internal void TestDrop(DragHandler dragHandler, Point pt)
        {
            if (DockArea.Width <= 0 || DockArea.Height <= 0)
            {
                return;
            }

            Point ptClient = PointToClient(pt);

            int       dragSize = MeasurePane.DragSize;
            Rectangle rectDoc  = DocumentRectangle;

            if (ptClient.Y - rectDoc.Top >= 0 && ptClient.Y - rectDoc.Top < dragSize &&
                DockWindows[DockState.DockTop].DisplayingList.Count == 0 &&
                dragHandler.IsDockStateValid(DockState.DockTop))
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Top);
            }
            else if (rectDoc.Bottom - ptClient.Y >= 0 && rectDoc.Bottom - ptClient.Y < dragSize &&
                     DockWindows[DockState.DockBottom].DisplayingList.Count == 0 &&
                     dragHandler.IsDockStateValid(DockState.DockBottom))
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Bottom);
            }
            else if (rectDoc.Right - ptClient.X >= 0 && rectDoc.Right - ptClient.X < dragSize &&
                     DockWindows[DockState.DockRight].DisplayingList.Count == 0 &&
                     dragHandler.IsDockStateValid(DockState.DockRight))
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Right);
            }
            else if (ptClient.X - rectDoc.Left >= 0 && ptClient.X - rectDoc.Left < dragSize &&
                     DockWindows[DockState.DockLeft].DisplayingList.Count == 0 &&
                     dragHandler.IsDockStateValid(DockState.DockLeft))
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Left);
            }
            else if (((ptClient.Y - rectDoc.Top >= dragSize && ptClient.Y - rectDoc.Top < 2 * dragSize) ||
                      (rectDoc.Bottom - ptClient.Y >= dragSize && rectDoc.Bottom - ptClient.Y < 2 * dragSize) ||
                      (rectDoc.Right - ptClient.X >= dragSize && rectDoc.Right - ptClient.X < 2 * dragSize) ||
                      (ptClient.X - rectDoc.Left >= dragSize && ptClient.X - rectDoc.Left < 2 * dragSize)) &&
                     DockWindows[DockState.Document].DisplayingList.Count == 0 &&
                     dragHandler.IsDockStateValid(DockState.Document))
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Fill);
            }
            else
            {
                return;
            }

            if (dragHandler.DropTarget.SameAsOldValue)
            {
                return;
            }

            Rectangle rect = DockArea;

            if (dragHandler.DropTarget.Dock == DockStyle.Top)
            {
                rect.Height = (int)(DockArea.Height * DockTopPortion);
            }
            else if (dragHandler.DropTarget.Dock == DockStyle.Bottom)
            {
                rect.Height = (int)(DockArea.Height * DockBottomPortion);
                rect.Y      = DockArea.Bottom - rect.Height;
            }
            else if (dragHandler.DropTarget.Dock == DockStyle.Left)
            {
                rect.Width = (int)(DockArea.Width * DockLeftPortion);
            }
            else if (dragHandler.DropTarget.Dock == DockStyle.Right)
            {
                rect.Width = (int)(DockArea.Width * DockRightPortion);
                rect.X     = DockArea.Right - rect.Width;
            }
            else if (dragHandler.DropTarget.Dock == DockStyle.Fill)
            {
                rect = DocumentRectangle;
            }

            rect.Location           = PointToScreen(rect.Location);
            dragHandler.DragOutline = DrawHelper.CreateDragOutline(rect, dragSize);
        }
Beispiel #9
0
		internal void TestDrop(DragHandler dragHandler)
		{
			if (!dragHandler.IsDockStateValid(DockState) ||
				DisplayingList.Count != 1)
				return;

			Point ptMouse = Control.MousePosition;
			uint lParam = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y);
			if (User32.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION)
				dragHandler.DockOutline.Show(DisplayingList[0], -1);
		}
Beispiel #10
0
        internal virtual void TestDrop(DragHandler dragHandler, Point pt)
        {
            if (DockState == DockState.Document)
            {
                DockManager.TestDrop(dragHandler, pt);
            }

            if (dragHandler.DropTarget.DropTo != null)
            {
                return;
            }

            if (DockHelper.IsDockStateAutoHide(DockState))
            {
                return;
            }

            if (!dragHandler.IsDockStateValid(DockState))
            {
                return;
            }

            if (dragHandler.DragSource == DragHandler.DragSources.FloatWindow &&
                ContentWindow.FloatWindow == dragHandler.DragControl)
            {
                return;
            }

            if (dragHandler.DragSource == DragHandler.DragSources.ContentWindow &&
                dragHandler.DragControl == this)
            {
                return;
            }

            if (dragHandler.DragSource == DragHandler.DragSources.Content &&
                dragHandler.DragControl == this &&
                DockState == DockState.Document &&
                CountOfVisibleContents == 1)
            {
                return;
            }

            Point     ptClient      = PointToClient(pt);
            Rectangle rectTabWindow = TabWindowRectangle;
            int       dragSize      = MeasureContentWindow.DragSize;

            if (ptClient.Y - rectTabWindow.Top >= 0 && ptClient.Y - rectTabWindow.Top < dragSize)
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Top);
            }
            else if (rectTabWindow.Bottom - ptClient.Y >= 0 && rectTabWindow.Bottom - ptClient.Y < dragSize)
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Bottom);
            }
            else if (rectTabWindow.Right - ptClient.X >= 0 && rectTabWindow.Right - ptClient.X < dragSize)
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Right);
            }
            else if (ptClient.X - rectTabWindow.Left >= 0 && ptClient.X - rectTabWindow.Left < dragSize)
            {
                dragHandler.DropTarget.SetDropTarget(this, DockStyle.Left);
            }
            else
            {
                if (rectTabWindow.Height <= GetTabStripRectangle().Height)
                {
                    return;
                }

                HitTestResult hitTestResult = GetHitTest(pt);
                if (hitTestResult.HitArea == HitTestArea.Caption)
                {
                    dragHandler.DropTarget.SetDropTarget(this, -1);
                }
                else if (hitTestResult.HitArea == HitTestArea.TabStrip && hitTestResult.Index != -1)
                {
                    dragHandler.DropTarget.SetDropTarget(this, hitTestResult.Index);
                }
                else if (DockState == DockState.Float && !HasCaption &&
                         ((ptClient.Y - rectTabWindow.Top >= dragSize && ptClient.Y - rectTabWindow.Top < 2 * dragSize) ||
                          (rectTabWindow.Bottom - ptClient.Y >= dragSize && rectTabWindow.Bottom - ptClient.Y < 2 * dragSize) ||
                          (rectTabWindow.Right - ptClient.X >= dragSize && rectTabWindow.Right - ptClient.X < 2 * dragSize) ||
                          (ptClient.X - rectTabWindow.Left >= dragSize && ptClient.X - rectTabWindow.Left < 2 * dragSize)))
                {
                    dragHandler.DropTarget.SetDropTarget(this, -1);
                }
                else
                {
                    return;
                }
            }

            if (dragHandler.DropTarget.SameAsOldValue)
            {
                return;
            }

            dragHandler.DragFrame = GetTestDropDragFrame(dragHandler.DropTarget.Dock, dragHandler.DropTarget.ContentIndex);
        }