/// <summary>
 /// Creates a new DockEventArgs object.
 /// </summary>
 /// <param name="point">The point where to dock the window.</param>
 /// <param name="dockType">The needed target container type.</param>
 /// <param name="release">The state of the dock process. True, if dock is finally performed.</param>
 public DockEventArgs(Point point, DockContainerType dockType, bool release)
 {
     this.point = point;
     this.dockType = dockType;
     this.release = release;
     this.target = null;
 }
Exemple #2
0
 /// <summary>
 /// Creates a new DockEventArgs object.
 /// </summary>
 /// <param name="point">The point where to dock the window.</param>
 /// <param name="dockType">The needed target container type.</param>
 /// <param name="release">The state of the dock process. True, if dock is finally performed.</param>
 public DockEventArgs(Point point, DockContainerType dockType, bool release)
 {
     this.point         = point;
     this.dockType      = dockType;
     this.release       = release;
     this.target        = null;
     this.handled       = false;
     this.showDockGuide = false;
 }
 /// <summary>
 /// Creates a new DockEventArgs object.
 /// </summary>
 /// <param name="point">The point where to dock the window.</param>
 /// <param name="dockType">The needed target container type.</param>
 /// <param name="release">The state of the dock process. True, if dock is finally performed.</param>
 public DockEventArgs(Point point, DockContainerType dockType, bool release)
 {
     this.point = point;
     this.dockType = dockType;
     this.release = release;
     this.target = null;
     this.handled = false;
     this.showDockGuide = false;
 }
        /// <summary>
        /// Retrieves a container that matches a specific mouse location, when a window is dragged.
        /// </summary>
        /// <param name="type">The target container type.</param>
        /// <param name="pt">The target position.</param>
        /// <returns>A valid container or null, if no suitable container was found.</returns>
        protected DockContainer GetTarget(Size srcSize, DockContainerType type, Point pt)
        {
            // Prepare rectangles.
            Rectangle rcClient = RectangleToScreen(this.ClientRectangle);
            Rectangle rcDock = new Rectangle(rcClient.Left+this.DockPadding.Left,
                rcClient.Top+this.DockPadding.Top,
                rcClient.Width-this.DockPadding.Left-this.DockPadding.Right,
                rcClient.Height-this.DockPadding.Top-this.DockPadding.Bottom);

            // Test on split.
            if (rcDock.Contains(pt))
            {
                DockContainer cont = null;

                if (pt.X-rcDock.Left <= dockBorder)
                {
                    // Split left.
                    cont = new DockContainer();
                    cont.DockType = type;
                    cont.Dock = DockStyle.Left;
                    if (srcSize.Width > this.Width/2)
                        cont.Width = this.Width/2;
                    else
                        cont.Width = srcSize.Width;
                    cont.Height = this.Height;
                    cont.Location = new Point(rcClient.X, rcClient.Y);
                }
                else if (rcDock.Right-pt.X <= dockBorder)
                {
                    // Split right.
                    cont = new DockContainer();
                    cont.DockType = type;
                    cont.Dock = DockStyle.Right;
                    if (srcSize.Width > this.Width/2)
                        cont.Width = this.Width/2;
                    else
                        cont.Width = srcSize.Width;
                    cont.Height = this.Height;
                    cont.Location = new Point(rcClient.X+this.Width-cont.Width, rcClient.Y);
                }
                else if (pt.Y-rcDock.Top <= dockBorder)
                {
                    // Split top.
                    cont = new DockContainer();
                    cont.DockType = type;
                    cont.Dock = DockStyle.Top;
                    if (srcSize.Height > this.Height/2)
                        cont.Height = this.Height/2;
                    else
                        cont.Height = srcSize.Height;
                    cont.Width = this.Width;
                    cont.Location = new Point(rcClient.X, rcClient.Y);
                }
                else if (rcDock.Bottom-pt.Y <= dockBorder)
                {
                    // Split bottom.
                    cont = new DockContainer();
                    cont.DockType = type;
                    cont.Dock = DockStyle.Bottom;
                    if (srcSize.Height > this.Height/2)
                        cont.Height = this.Height/2;
                    else
                        cont.Height = srcSize.Height;
                    cont.Width = this.Width;
                    cont.Location = new Point(rcClient.X, rcClient.Y+this.Height-cont.Height);
                }

                return cont;
            }

            // Test on add to own panel list.
            if (rcClient.Contains(pt))
            {
                if ((pt.Y <= rcClient.Top+this.DockPadding.Top) && (dockType == type))
                    return this;
                else if ((dockType == type) && (dockType == DockContainerType.ToolWindow) && (panelList.Count > 1) && (pt.Y > rcClient.Top+this.Height-this.DockPadding.Bottom))
                    return this;
            }

            return null;
        }
        public DockContainer GetNextChild(DockContainerType type, DockContainer last)
        {
            DockContainer ret = null;

            foreach (DockContainer cont in containerList)
            {
                ret = cont.GetNextChild(type, last);
                if (ret != null)
                    return ret;
            }

            if ((containerList.Count == 0) && (dockType == type) && (this != last))
                ret = last;

            return ret;
        }