override public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton thisButton) { FunctorEditor ctrlMove = otherButton.Tag as FunctorEditor; FunctorEditor ctrlTarget = thisButton.Tag as FunctorEditor; if (e.Effect == DragDropEffects.Move) { if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost && ctrlMove.Parent == ctrlTarget.Parent) { this.OnReOrderRequest(otherButton, thisButton); } else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) { SuperList senderParent = otherButton.GetParentList(); senderParent.OnTransferRequest(this, otherButton); //return DragDropEffects.Move; } else { MessageBox.Show("asdf"); } } else if (e.Effect == DragDropEffects.Copy) { if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) { SuperList senderParent = otherButton.GetParentList(); senderParent.OnCopyRequest(this, otherButton); //return DragDropEffects.Move; } } }
public SuperListDragButton(SuperList parent) { InitializeComponent(); mParent = parent; this.Margin = new Padding(0); this.BackColor = parent.BackColor; this.AllowDrop = true; }
override public DragDropEffects ValidateDragTarget(Control toMove, Control target, DragEventArgs e) { PropertyFlowList ctrlMove = toMove.Tag as PropertyFlowList; PropertyFlowList ctrlTarget = target.Tag as PropertyFlowList; SuperList targetList = target as SuperList; BasicTypedSuperList basidtargetList = target as BasicTypedSuperList; //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); }
public virtual void OnCopyRequest(SuperList otherlist, SuperListDragButton 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); }
public void OnTransferRequest(SuperList otherlist, SuperListDragButton 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); } }
override public DragDropEffects ValidateDragTarget(Control toMove, Control target, DragEventArgs e) { FunctorEditor ctrlMove = toMove.Tag as FunctorEditor; FunctorEditor ctrlTarget = target.Tag as FunctorEditor; SuperList targetList = target as SuperList; //to empty list if (targetList != null) { SuperListDragButton button = toMove as SuperListDragButton; if (targetList.GetType() == button.GetParentList().GetType()) { if ((e.KeyState & 8) == 8 && (e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) { return(DragDropEffects.Copy); } else { 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.LogicalHost == ctrlTarget.LogicalHost) { return(DragDropEffects.Move); } else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) { return(DragDropEffects.Move); } } return(DragDropEffects.None); }
override public void HandleDrop(DragEventArgs e, SuperListDragButton otherButton, SuperListDragButton 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()) { SuperList senderParent = otherButton.GetParentList(); senderParent.OnTransferRequest(this, otherButton); //return DragDropEffects.Move; } } }
public override void OnCopyRequest(SuperList otherlist, SuperListDragButton toMove) { //base.OnCopyRequest(otherlist, toMove); Control c = toMove.Tag as Control; FunctorEditor f = c as FunctorEditor; if (f == null) { return; } TriggerCondition comp = f.Tag as TriggerCondition; if (comp == null) { return; } //comp.CopyTo TriggerControl trigCont = otherlist.Parent.Parent as TriggerControl; TriggerClipboard temp = new TriggerClipboard(); //temp.CopyValues(this.mParentTriggerNamespace.GetValueList()); temp.mValues = this.ParentTriggerNamespace.GetValues(); int newID; TriggerCondition e = temp.GetCondition(comp, this.mParentTriggerNamespace); ConditionsList ef = otherlist as ConditionsList; //mParentTriggerNamespace.InsertCondition(trigCont.Trigger.ID, e, temp.mValues, out newID); mParentTriggerNamespace.InsertCondition(trigCont.Trigger.ID, e, this.ParentTriggerNamespace.GetValues(), out newID); ef.AddExistingConditionToUI(e, this.mParentTriggerNamespace.GetValues()); mParentTriggerNamespace.ProcessVarMapping(); }
void SuperList_DragDrop(object sender, DragEventArgs e) { if (mControls.Count == 0) { if (e.Data.GetDataPresent(typeof(SuperListDragButton))) { object data = e.Data.GetData(typeof(SuperListDragButton)); SuperListDragButton otherButton = data as SuperListDragButton; if (otherButton != null) { SuperList senderParent = otherButton.GetParentList(); if (e.Effect == DragDropEffects.Move) { senderParent.OnTransferRequest(this, otherButton); } else if (e.Effect == DragDropEffects.Copy) { senderParent.OnCopyRequest(this, otherButton); } } } } }