Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/18/11 01:38:23 (13 years ago)
Author:
swagner
Message:

Implemented dragging of multiple items in all collection views and refactored drag & drop code (#1112)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableValueView.cs

    r5445 r5744  
    8888    protected virtual void VariableValueView_DragEnterOver(object sender, DragEventArgs e) {
    8989      e.Effect = DragDropEffects.None;
    90       Type type = e.Data.GetData("Type") as Type;
    91       if (!ReadOnly && (type != null) && (typeof(IItem).IsAssignableFrom(type))) {
     90      if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IItem)) {
    9291        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    9392        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
    94         else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
    95         else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
    96         else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
     93        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     94        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     95        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
    9796      }
    9897    }
    9998    protected virtual void VariableValueView_DragDrop(object sender, DragEventArgs e) {
    10099      if (e.Effect != DragDropEffects.None) {
    101         IItem item = e.Data.GetData("Value") as IItem;
    102         if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) item = (IItem)item.Clone();
     100        IItem item = e.Data.GetData("HeuristicLab") as IItem;
     101        if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone();
    103102        Content.Value = item;
    104103      }
Note: See TracChangeset for help on using the changeset viewer.