Beispiel #1
0
        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Point pos = CanvasPosToLocal(new Point(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);
        }
Beispiel #2
0
 public void MoveTabsTo(DockedTabControl target)
 {
     var children = TabStrip.Children.ToArray(); // copy because collection will be modified
     foreach (Base child in children)
     {
         TabButton button = child as TabButton;
         if (button == null)
             continue;
         target.AddPage(button);
     }
     Invalidate();
 }
Beispiel #3
0
        public void MoveTabsTo(DockedTabControl target)
        {
            var children = TabStrip.Children.ToArray(); // copy because collection will be modified

            foreach (ControlBase child in children)
            {
                TabButton button = child as TabButton;
                if (button == null)
                {
                    continue;
                }
                target.AddPage(button);
            }
            Invalidate();
        }
Beispiel #4
0
 /// <summary>
 /// Add a new dock control.
 /// </summary>
 /// <param name="title">Title visible on title bar or tab.</param>
 /// <param name="control">Control to add.</param>
 public void Add(string title, ControlBase control)
 {
     m_DockedTabControl.AddPage(title, control);
 }