示例#1
0
        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Point pos = CanvasPosToLocal(new Point(x, y));
            Dock  dir = GetDroppedTabDirection(pos.X, pos.Y);

            Invalidate();

            DockedTabControl addTo = m_DockedTabControl;

            if (dir == Dock.Fill && addTo == null)
            {
                return(false);
            }

            if (dir != Dock.Fill)
            {
                DockBase dock = GetChildDock(dir);
                addTo = dock.m_DockedTabControl;

                if (!m_DropFar)
                {
                    dock.BringToFront();
                }
                else
                {
                    dock.SendToBack();
                }
            }

            if (p.Name == "TabButtonMove")
            {
                TabButton tabButton = DragAndDrop.SourceControl as TabButton;
                if (null == tabButton)
                {
                    return(false);
                }

                addTo.AddPage(tabButton);
            }

            if (p.Name == "TabWindowMove")
            {
                DockedTabControl tabControl = DragAndDrop.SourceControl as DockedTabControl;
                if (null == tabControl)
                {
                    return(false);
                }
                if (tabControl == addTo)
                {
                    return(false);
                }

                tabControl.MoveTabsTo(addTo);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Gets an inner docked control for the specified position.
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        protected virtual DockBase GetChildDock(Dock pos)
        {
            // todo: verify
            DockBase dock = null;

            switch (pos)
            {
            case Dock.Left:
                if (m_Left == null)
                {
                    m_Left       = new DockBase(this);
                    m_Left.Width = 200;
                    m_Left.SetupChildDock(pos);
                }
                dock = m_Left;
                break;

            case Dock.Right:
                if (m_Right == null)
                {
                    m_Right       = new DockBase(this);
                    m_Right.Width = 200;
                    m_Right.SetupChildDock(pos);
                }
                dock = m_Right;
                break;

            case Dock.Top:
                if (m_Top == null)
                {
                    m_Top        = new DockBase(this);
                    m_Top.Height = 200;
                    m_Top.SetupChildDock(pos);
                }
                dock = m_Top;
                break;

            case Dock.Bottom:
                if (m_Bottom == null)
                {
                    m_Bottom        = new DockBase(this);
                    m_Bottom.Height = 200;
                    m_Bottom.SetupChildDock(pos);
                }
                dock = m_Bottom;
                break;
            }

            if (dock != null)
            {
                dock.IsCollapsed = false;
            }

            return(dock);
        }
示例#3
0
        protected virtual void DoRedundancyCheck()
        {
            if (!IsEmpty)
            {
                return;
            }

            DockBase pDockParent = Parent as DockBase;

            if (null == pDockParent)
            {
                return;
            }

            pDockParent.OnRedundantChildDock(this);
        }
示例#4
0
 protected virtual void OnRedundantChildDock(DockBase dock)
 {
     dock.IsCollapsed = true;
     DoRedundancyCheck();
     DoConsolidateCheck();
 }