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/VariableView.cs

    r5445 r5744  
    135135    protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) {
    136136      e.Effect = DragDropEffects.None;
    137       Type type = e.Data.GetData("Type") as Type;
    138       if (!ReadOnly && (type != null) && (typeof(IItem).IsAssignableFrom(type))) {
     137      if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IItem)) {
    139138        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    140139        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
    141         else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
    142         else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
    143         else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
     140        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     141        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     142        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
    144143      }
    145144    }
    146145    protected virtual void valuePanel_DragDrop(object sender, DragEventArgs e) {
    147146      if (e.Effect != DragDropEffects.None) {
    148         IItem item = e.Data.GetData("Value") as IItem;
    149         if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) item = (IItem)item.Clone();
     147        IItem item = e.Data.GetData("HeuristicLab") as IItem;
     148        if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone();
    150149        Content.Value = item;
    151150      }
Note: See TracChangeset for help on using the changeset viewer.