Docked tab control.
Inheritance: TabControl
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
 public void MoveTabsTo(DockedTabControl target)
 {
     var children = TabStrip.Children.ToArray(); // copy because collection will be modified
     foreach (Control child in children)
     {
         TabButton button = child as TabButton;
         if (button == null)
             continue;
         target.AddPage(button);
     }
     Invalidate();
 }
Esempio n. 3
0
        public void MoveTabsTo(DockedTabControl target)
        {
            var children = TabStrip.Children.ToArray(); // copy because collection will be modified

            foreach (Control child in children)
            {
                TabButton button = child as TabButton;
                if (button == null)
                {
                    continue;
                }
                target.AddPage(button);
            }
            Invalidate();
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes an inner docked control for the specified position.
        /// </summary>
        /// <param name="pos">Dock position.</param>
        protected virtual void SetupChildDock(Pos pos)
        {
            if (m_DockedTabControl == null)
            {
                m_DockedTabControl                  = new DockedTabControl(this);
                m_DockedTabControl.TabRemoved      += OnTabRemoved;
                m_DockedTabControl.TabStripPosition = Pos.Bottom;
                m_DockedTabControl.TitleBarVisible  = true;
            }

            Dock = pos;

            Pos sizeDir;

            if (pos == Pos.Right)
            {
                sizeDir = Pos.Left;
            }
            else if (pos == Pos.Left)
            {
                sizeDir = Pos.Right;
            }
            else if (pos == Pos.Top)
            {
                sizeDir = Pos.Bottom;
            }
            else if (pos == Pos.Bottom)
            {
                sizeDir = Pos.Top;
            }
            else
            {
                throw new ArgumentException("Invalid dock", "pos");
            }

            if (m_Sizer != null)
            {
                m_Sizer.Dispose();
            }
            m_Sizer           = new Resizer(this);
            m_Sizer.Dock      = sizeDir;
            m_Sizer.ResizeDir = sizeDir;
            m_Sizer.SetSize(2, 2);
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes an inner docked control for the specified position.
        /// </summary>
        /// <param name="pos">Dock position.</param>
        protected virtual void SetupChildDock(Pos pos)
        {
            if (m_DockedTabControl == null)
            {
                m_DockedTabControl = new DockedTabControl(this);
                m_DockedTabControl.TabRemoved += OnTabRemoved;
                m_DockedTabControl.TabStripPosition = Pos.Bottom;
                m_DockedTabControl.TitleBarVisible = true;
            }

            Dock = pos;

            Pos sizeDir;
            if (pos == Pos.Right) sizeDir = Pos.Left;
            else if (pos == Pos.Left) sizeDir = Pos.Right;
            else if (pos == Pos.Top) sizeDir = Pos.Bottom;
            else if (pos == Pos.Bottom) sizeDir = Pos.Top;
            else throw new ArgumentException("Invalid dock", "pos");

            if (m_Sizer != null)
                m_Sizer.Dispose();
            m_Sizer = new Resizer(this);
            m_Sizer.Dock = sizeDir;
            m_Sizer.ResizeDir = sizeDir;
            m_Sizer.SetSize(2, 2);
        }
Esempio n. 6
0
        public void TestDockedTabControl()
        {
            var control = new DockedTabControl(canvas);

            GUI.Test(control, "DockedTabControl1");
        }