예제 #1
0
        public ContainerListDragButton(ContainerList parent)
        {
            InitializeComponent();

            mParent = parent;

            this.Margin    = new Padding(0);
            this.BackColor = parent.BackColor;

            this.AllowDrop = true;
        }
예제 #2
0
        override public DragDropEffects ValidateDragTarget(Control toMove, Control target, DragEventArgs e)
        {
            PropertyFlowList ctrlMove   = toMove.Tag as PropertyFlowList;
            PropertyFlowList ctrlTarget = target.Tag as PropertyFlowList;

            ContainerList        targetList      = target as ContainerList;
            DynamicContainerList basidtargetList = target as DynamicContainerList;

            //to empty list //Also a basic typed super list.   Types must match
            if (basidtargetList != null && ctrlMove != null)
            {
                if (basidtargetList.mListDataObjectType == ctrlMove.SelectedObject.GetType())
                {
                    //if())
                    return(DragDropEffects.Move);
                }
            }

            //What to do if it is just another super list?
            //if (targetList != null && toMove != null)
            //{
            //   SuperListDragButton button = toMove as SuperListDragButton;
            //   if (targetList.GetType() == button.GetParentList().GetType())
            //   {
            //      return DragDropEffects.Move;
            //   }
            //}


            if (ctrlMove == null || ctrlTarget == null)
            {
                return(DragDropEffects.None);
            }

            if ((e.KeyState & 8) == 8 && (e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy)
            {
                //return DragDropEffects.Copy;
            }
            else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move)
            {
                if (ctrlMove == ctrlTarget)
                {
                    //we return move here because it makes the animation look better
                    return(DragDropEffects.Move);
                }
                if (ctrlMove.SelectedObject.GetType() == ctrlTarget.SelectedObject.GetType())
                {
                    return(DragDropEffects.Move);
                }
            }

            return(DragDropEffects.None);
        }
예제 #3
0
        public virtual void OnCopyRequest(ContainerList otherlist, ContainerListDragButton toMove)//, SuperListDragButton target)
        {
            //Control c = toMove.Tag as Control;
            ////otherlist.re
            //OnDelete(toMove);
            //otherlist.AddRow(c);

            //OnReordered();
            //otherlist.OnReordered();

            //if (NeedsResize != null)
            //   NeedsResize(this, null);
        }
예제 #4
0
        public void OnTransferRequest(ContainerList otherlist, ContainerListDragButton toMove)//, SuperListDragButton target)
        {
            Control c = toMove.Tag as Control;

            //otherlist.re
            OnDelete(toMove);
            otherlist.AddRow(c);

            OnReordered();
            otherlist.OnReordered();

            if (NeedsResize != null)
            {
                NeedsResize(this, null);
            }
        }
예제 #5
0
        override public void HandleDrop(DragEventArgs e, ContainerListDragButton otherButton, ContainerListDragButton thisButton)
        {
            PropertyFlowList ctrlMove   = otherButton.Tag as PropertyFlowList;
            PropertyFlowList ctrlTarget = thisButton.Tag as PropertyFlowList;

            if (e.Effect == DragDropEffects.Move)
            {
                //if (ctrlMove.SelectedObject == ctrlTarget.SelectedObject)
                if (ctrlMove.Parent == ctrlTarget.Parent)
                {
                    this.OnReOrderRequest(otherButton, thisButton);
                }
                else if (ctrlMove.SelectedObject.GetType() == ctrlTarget.SelectedObject.GetType())
                {
                    ContainerList senderParent = otherButton.GetParentList();
                    senderParent.OnTransferRequest(this, otherButton);
                    //return DragDropEffects.Move;
                }
            }
        }
예제 #6
0
 void SuperList_DragDrop(object sender, DragEventArgs e)
 {
     if (mControls.Count == 0)
     {
         if (e.Data.GetDataPresent(typeof(ContainerListDragButton)))
         {
             object data = e.Data.GetData(typeof(ContainerListDragButton));
             ContainerListDragButton otherButton = data as ContainerListDragButton;
             if (otherButton != null)
             {
                 ContainerList senderParent = otherButton.GetParentList();
                 if (e.Effect == DragDropEffects.Move)
                 {
                     senderParent.OnTransferRequest(this, otherButton);
                 }
                 else if (e.Effect == DragDropEffects.Copy)
                 {
                     senderParent.OnCopyRequest(this, otherButton);
                 }
             }
         }
     }
 }