Base for dockable containers.
Inheritance: Control
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        protected virtual void DoRedundancyCheck()
        {
            if (!IsEmpty)
            {
                return;
            }

            DockBase pDockParent = Parent as DockBase;

            if (null == pDockParent)
            {
                return;
            }

            pDockParent.OnRedundantChildDock(this);
        }
Esempio n. 4
0
 protected virtual void OnRedundantChildDock(DockBase dock)
 {
     dock.IsHidden = true;
     DoRedundancyCheck();
     DoConsolidateCheck();
 }
Esempio n. 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;
        }
Esempio n. 6
0
        public void TestDockBase()
        {
            var control = new DockBase(canvas);

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