Exemplo n.º 1
0
        public override bool DragAndDrop_CanAcceptPackage(Package p)
        {
            if (!m_AllowReorder)
                return false;

            if (p.Name == "TabButtonMove")
                return true;

            return false;
        }
Exemplo n.º 2
0
        public static void ControlDeleted(Controls.Control control)
        {
            if (SourceControl == control)
            {
                SourceControl = null;
                CurrentPackage = null;
                HoveredControl = null;
                m_LastPressedControl = null;
            }

            if (m_LastPressedControl == control)
                m_LastPressedControl = null;

            if (HoveredControl == control)
                HoveredControl = null;

            if (m_NewHoveredControl == control)
                m_NewHoveredControl = null;
        }
Exemplo n.º 3
0
 public override void DragAndDrop_StartDragging(Package package, int x, int y)
 {
     DragAndDrop.SourceControl = Parent;
     DragAndDrop.SourceControl.DragAndDrop_StartDragging(package, x, y);
 }
Exemplo n.º 4
0
        private static bool ShouldStartDraggingControl( int x, int y )
        {
            // We're not holding a control down..
            if (m_LastPressedControl == null)
                return false;

            // Not been dragged far enough
            int length = Math.Abs(x - m_LastPressedPos.X) + Math.Abs(y - m_LastPressedPos.Y);
            if (length < 5)
                return false;

            // Create the dragging package

            CurrentPackage = m_LastPressedControl.DragAndDrop_GetPackage(m_LastPressedPos.X, m_LastPressedPos.Y);

            // We didn't create a package!
            if (CurrentPackage == null)
            {
                m_LastPressedControl = null;
                SourceControl = null;
                return false;
            }

            // Now we're dragging something!
            SourceControl = m_LastPressedControl;
            InputHandler.MouseFocus = null;
            m_LastPressedControl = null;
            CurrentPackage.DrawControl = null;

            // Some controls will want to decide whether they should be dragged at that moment.
            // This function is for them (it defaults to true)
            if (!SourceControl.DragAndDrop_ShouldStartDrag())
            {
                SourceControl = null;
                CurrentPackage = null;
                return false;
            }

            SourceControl.DragAndDrop_StartDragging(CurrentPackage, m_LastPressedPos.X, m_LastPressedPos.Y);

            return true;
        }
Exemplo n.º 5
0
        public static bool Start(Controls.Control control, Package package)
        {
            if (CurrentPackage != null)
            {
                return false;
            }

            CurrentPackage = package;
            SourceControl = control;
            return true;
        }
Exemplo n.º 6
0
 // giver
 public virtual void DragAndDrop_StartDragging(Package package, int x, int y)
 {
     package.HoldOffset = CanvasPosToLocal(new Point(x, y));
     package.DrawControl = this;
 }
Exemplo n.º 7
0
 // receiver
 public virtual void DragAndDrop_HoverLeave(Package p)
 {
 }
Exemplo n.º 8
0
 // receiver
 public virtual bool DragAndDrop_HandleDrop(Package p, int x, int y)
 {
     DragAndDrop.SourceControl.Parent = this;
     return true;
 }
Exemplo n.º 9
0
 private bool AddDown(Package p)
 {
     Parent.MovePaneVertically(DraggedPane, 0, false);
     return false;
 }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
0
        public override bool DragAndDrop_CanAcceptPackage(Package p)
        {
            // A TAB button dropped
            if (p.Name == "TabButtonMove")
                return true;

            // a TAB window dropped
            if (p.Name == "TabWindowMove")
                return true;

            return false;
        }
Exemplo n.º 12
0
        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Point LocalPos = CanvasPosToLocal(new Point(x, y));

            TabButton button = DragAndDrop.SourceControl as TabButton;
            TabControl tabControl = Parent as TabControl;
            if (tabControl != null && button != null)
            {
                if (button.TabControl != tabControl)
                {
                    // We've moved tab controls!
                    tabControl.AddPage(button);
                }
            }

            Control droppedOn = GetControlAt(LocalPos.X, LocalPos.Y);
            if (droppedOn != null && droppedOn != this)
            {
                Point dropPos = droppedOn.CanvasPosToLocal(new Point(x, y));
                DragAndDrop.SourceControl.BringNextToControl(droppedOn, dropPos.X > droppedOn.Width/2);
            }
            else
            {
                DragAndDrop.SourceControl.BringToFront();
            }
            return true;
        }
Exemplo n.º 13
0
 public override void DragAndDrop_HoverLeave(Package p)
 {
     if (m_TabDragControl != null)
     {
         RemoveChild(m_TabDragControl, false); // [omeg] need to do that explicitely
         m_TabDragControl.Dispose();
     }
     m_TabDragControl = null;
 }
Exemplo n.º 14
0
        public override void DragAndDrop_HoverEnter(Package p, int x, int y)
        {
            if (m_TabDragControl != null)
            {
                throw new InvalidOperationException("ERROR! TabStrip::DragAndDrop_HoverEnter");
            }

            m_TabDragControl = new Highlight(this);
            m_TabDragControl.MouseInputEnabled = false;
            m_TabDragControl.SetSize(3, Height);
        }
Exemplo n.º 15
0
        public override void DragAndDrop_Hover(Package p, int x, int y)
        {
            Point localPos = CanvasPosToLocal(new Point(x, y));

            Control droppedOn = GetControlAt(localPos.X, localPos.Y);
            if (droppedOn != null && droppedOn != this)
            {
                Point dropPos = droppedOn.CanvasPosToLocal(new Point(x, y));
                m_TabDragControl.SetBounds(new Rectangle(0, 0, 3, Height));
                m_TabDragControl.BringToFront();
                m_TabDragControl.SetPosition(droppedOn.X - 1, 0);

                if (dropPos.X > droppedOn.Width/2)
                {
                    m_TabDragControl.MoveBy(droppedOn.Width - 1, 0);
                }
                m_TabDragControl.Dock = Pos.None;
            }
            else
            {
                m_TabDragControl.Dock = Pos.Left;
                m_TabDragControl.BringToFront();
            }
        }
Exemplo n.º 16
0
 public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
 {
     return dropAction.Invoke(p);
 }
Exemplo n.º 17
0
 private bool AddCenter(Package p)
 {
     Parent.MovePane(DraggedPane, PaneGroup);
     return false;
 }
Exemplo n.º 18
0
        public override void DragAndDrop_Hover(Package p, int x, int y)
        {
            Vector2i pos = CanvasPosToLocal(new Vector2i(x, y));
            Pos dir = GetDroppedTabDirection(pos.X, pos.Y);

            if (dir == Pos.Fill)
            {
                if (null == m_DockedTabControl)
                {
                    m_HoverRect = new Rectangle(0,0,0,0);
                    return;
                }

                m_HoverRect = InnerBounds;
                return;
            }

            m_HoverRect = RenderBounds;

            int HelpBarWidth = 0;

            if (dir == Pos.Left)
            {
                HelpBarWidth = (int)(m_HoverRect.Width * 0.25f);
                m_HoverRect.Width = HelpBarWidth;
            }

            if (dir == Pos.Right)
            {
                HelpBarWidth = (int)(m_HoverRect.Width * 0.25f);
                m_HoverRect.X = m_HoverRect.Width - HelpBarWidth;
                m_HoverRect.Width = HelpBarWidth;
            }

            if (dir == Pos.Top)
            {
                HelpBarWidth = (int)(m_HoverRect.Height * 0.25f);
                m_HoverRect.Height = HelpBarWidth;
            }

            if (dir == Pos.Bottom)
            {
                HelpBarWidth = (int)(m_HoverRect.Height * 0.25f);
                m_HoverRect.Y = m_HoverRect.Height - HelpBarWidth;
                m_HoverRect.Height = HelpBarWidth;
            }

            if ((dir == Pos.Top || dir == Pos.Bottom) && !m_DropFar)
            {
                if (m_Left != null && m_Left.IsVisible)
                {
                    m_HoverRect.X += m_Left.Width;
                    m_HoverRect.Width -= m_Left.Width;
                }

                if (m_Right != null && m_Right.IsVisible)
                {
                    m_HoverRect.Width -= m_Right.Width;
                }
            }

            if ((dir == Pos.Left || dir == Pos.Right) && !m_DropFar)
            {
                if (m_Top != null && m_Top.IsVisible)
                {
                    m_HoverRect.Y += m_Top.Height;
                    m_HoverRect.Height -= m_Top.Height;
                }

                if (m_Bottom != null && m_Bottom.IsVisible)
                {
                    m_HoverRect.Height -= m_Bottom.Height;
                }
            }
        }
Exemplo n.º 19
0
 // receiver
 public virtual bool DragAndDrop_CanAcceptPackage(Package p)
 {
     return false;
 }
Exemplo n.º 20
0
 public override void DragAndDrop_HoverEnter(Package p, int x, int y)
 {
     m_DrawHover = true;
 }
Exemplo n.º 21
0
 // receiver
 public virtual void DragAndDrop_HoverEnter(Package p, int x, int y)
 {
 }
Exemplo n.º 22
0
 public override void DragAndDrop_HoverLeave(Package p)
 {
     m_DrawHover = false;
 }
Exemplo n.º 23
0
 // giver
 public virtual void DragAndDrop_SetPackage(bool draggable, String name = "", object userData = null)
 {
     if (m_DragAndDrop_Package == null)
     {
         m_DragAndDrop_Package = new Package();
         m_DragAndDrop_Package.IsDraggable = draggable;
         m_DragAndDrop_Package.Name = name;
         m_DragAndDrop_Package.UserData = userData;
     }
 }
Exemplo n.º 24
0
 private bool AddLeft(Package p)
 {
     Parent.MovePaneHorizontally(DraggedPane, 0, false);
     return false;
 }
Exemplo n.º 25
0
 public override bool DragAndDrop_CanAcceptPackage(Package p)
 {
     if (p.Name == "TabButtonMove")
         PaneManager.ShowDockHelper(this);
      return base.DragAndDrop_CanAcceptPackage(p);
 }
Exemplo n.º 26
0
 private bool AddRigth(Package p)
 {
     Parent.MovePaneHorizontally(DraggedPane, 0, true);
     return false;
 }
Exemplo n.º 27
0
        private static bool onDrop(int x, int y)
        {
            bool success = false;

            if (HoveredControl != null)
            {
                HoveredControl.DragAndDrop_HoverLeave(CurrentPackage);
                success = HoveredControl.DragAndDrop_HandleDrop(CurrentPackage, x, y);
            }

            // Report back to the source control, to tell it if we've been successful.
            SourceControl.DragAndDrop_EndDragging(success, x, y);

            CurrentPackage = null;
            SourceControl = null;

            return true;
        }
Exemplo n.º 28
0
        private bool AddUp(Package p)
        {
            Console.WriteLine("AddUp");

            Parent.MovePaneVertically(DraggedPane, 0, true);
            return false;
        }
Exemplo n.º 29
0
 public override bool DragAndDrop_CanAcceptPackage(Package p)
 {
     return true;
 }
Exemplo n.º 30
0
 private bool AddLeft(Package p)
 {
     PaneManager.MovePaneHorizontally(DraggedPane,PaneGroup,0,false);
     return false;
 }