Base for dockable containers.
상속: Control
예제 #1
0
        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Vector2i pos = CanvasPosToLocal(new Vector2i(x, y));
            Pos      dir = GetDroppedTabDirection(pos.X, pos.Y);

            DockedTabControl addTo = m_DockedTabControl;

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

            if (dir != Pos.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);
            }

            Invalidate();

            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(Pos pos)
        {
            // todo: verify
            DockBase dock = null;

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

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

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

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

            if (dock != null)
            {
                dock.IsHidden = 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.IsHidden = true;
     DoRedundancyCheck();
     DoConsolidateCheck();
 }
예제 #5
0
        /// <summary>
        /// Gets an inner docked control for the specified position.
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        protected virtual DockBase GetChildDock(Pos pos)
        {
            // todo: verify
            DockBase dock = null;
            switch (pos)
            {
                case Pos.Left:
                    if (m_Left == null)
                    {
                        m_Left = new DockBase(this);
                        m_Left.SetupChildDock(pos);
                    }
                    dock = m_Left;
                    break;

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

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

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

            if (dock != null)
                dock.IsHidden = false;

            return dock;
        }
예제 #6
0
        public void TestDockBase()
        {
            var control = new DockBase(canvas);

            GUI.Test(control, "DockBase1");
        }
예제 #7
0
 protected virtual void OnRedundantChildDock(DockBase dock)
 {
     dock.IsHidden = true;
     DoRedundancyCheck();
     DoConsolidateCheck();
 }