コード例 #1
0
ファイル: Tab.cs プロジェクト: shankithegreat/commanderdotnet
        internal void InvokeDragEvent(DragEventType eventType, DragEventArgs dragEvent)
        {
            switch (eventType)
            {
                case DragEventType.Enter:
                    this.OnDragEnter(dragEvent);
                    break;

                case DragEventType.Leave:
                    this.OnDragLeave(EventArgs.Empty);
                    break;

                case DragEventType.Drop:
                    this.OnDragDrop(dragEvent);
                    break;

                case DragEventType.Over:
                    this.OnDragOver(dragEvent);
                    break;

                case DragEventType.Hover:
                    this.OnDragHover(dragEvent);
                    break;
            }
        }
コード例 #2
0
ファイル: BranchPartition.cs プロジェクト: ozialien/NORMA
            void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
            {
                BranchPartitionSection section;

                row = TranslateRow(row, out section);
                if (row == -1)
                {
                    args.Effect = DragDropEffects.None;
                }
                myInnerBranch.OnDragEvent(sender, row, column, eventType, args);
            }
コード例 #3
0
        /// <summary>
        /// Implements <see cref="ISurveyNodeDropTarget.OnDragEvent"/>
        /// </summary>
        void OnDragEvent(object contextElement, DragEventType eventType, DragEventArgs args)
        {
            LinkedElementCollection <ElementGroupingType> types = null;

            switch (eventType)
            {
            case DragEventType.Enter:
                foreach (ModelElement element in ExtractElements(args.Data))
                {
                    ModelElement normalizedElement = EditorUtility.ResolveContextInstance(element, false) as ModelElement;
                    // UNDONE: NestedGrouping
                    if (null == normalizedElement && !(normalizedElement is ElementGrouping) && !(normalizedElement is ElementGroupingType))
                    {
                        continue;
                    }
                    if (GroupingMembershipInclusion.AddAllowed == GetElementInclusion(normalizedElement, types ?? (types = GroupingTypeCollection)))
                    {
                        args.Effect = DragDropEffects.Copy;
                        return;
                    }
                }
                break;

            case DragEventType.Drop:
                using (Transaction t = Store.TransactionManager.BeginTransaction(ResourceStrings.ElementGroupingAddElementTransactionName))
                {
                    foreach (ModelElement element in ExtractElements(args.Data))
                    {
                        ModelElement normalizedElement = EditorUtility.ResolveContextInstance(element, false) as ModelElement;
                        // UNDONE: NestedGrouping
                        if (null != normalizedElement && !(normalizedElement is ElementGrouping) && !(normalizedElement is ElementGroupingType))
                        {
                            if (GroupingMembershipInclusion.AddAllowed == GetElementInclusion(normalizedElement, types ?? (types = GroupingTypeCollection)))
                            {
                                GroupingElementExclusion exclusion = GroupingElementExclusion.GetLink(this, normalizedElement);
                                if (exclusion != null)
                                {
                                    // Delete the exclusion. A rule will automatically determine
                                    // if this turns into a new inclusion or a contradiction.
                                    exclusion.Delete();
                                }
                                else
                                {
                                    new GroupingElementInclusion(this, normalizedElement);
                                }
                            }
                        }
                    }
                    t.Commit();
                }
                break;
            }
        }
コード例 #4
0
 public override Draggable OnDragEvent(DragEventType type, int id, Draggable current, DraggableType target)
 {
     if (type == DragEventType.Over)
     {
         this.mouseOver = id;
     }
     else
     {
         if (type == DragEventType.Down)
         {
             if (this.contents[id].type != PType.Empty)
             {
                 GameObject        obj = new GameObject("Draggable");
                 Draggable_Nucleon dr  = (Draggable_Nucleon)obj.AddComponent(typeof(Draggable_Nucleon));
                 dr.type = this.contents[id].type;
                 this.contents[id].type = PType.Empty;
                 this.mouseDown         = id;
                 return(dr);
             }
         }
         else
         {
             if (type == DragEventType.Up)
             {
                 if (target && target.CanDrop(current))
                 {
                     target.Drop(current);
                     current.Die();
                 }
                 else
                 {
                     if (current)
                     {
                         current.FailDrag();
                         this.Drop(current);
                     }
                 }
                 this.mouseDown = -1;
                 return(null);
             }
             else
             {
                 if (type == DragEventType.Exit)
                 {
                     this.mouseOver = -1;
                 }
             }
         }
     }
     return(current);
 }
 public override Draggable OnDragEvent(DragEventType type, int id, Draggable current, DraggableType target)
 {
     if (type == DragEventType.Over)
     {
         this.mouseOver = id;
     }
     else
     {
         if (type == DragEventType.Exit)
         {
             this.mouseOver = -1;
         }
     }
     return(current);
 }
コード例 #6
0
 /// <summary>
 ///     IBranch interface implementation.
 /// </summary>
 public virtual void /* IBranch */ OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
 }
コード例 #7
0
        void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
        {
            var branch = FindBranchForRow(ref row);

            branch.OnDragEvent(sender, row, column, eventType, args);
        }
コード例 #8
0
 public void OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
 }
コード例 #9
0
 private void ForwardDragEvent(DragEventType dragType, DragEventArgs args)
 {
     var info = myTree.GetItemInfo(myDropRow, myDropColumn, false);
     info.Branch.OnDragEvent(this, info.Row, info.Column, dragType, args);
 }
コード例 #10
0
 void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, System.Windows.Forms.DragEventArgs args)
 {
 }
コード例 #11
0
 void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
 }
コード例 #12
0
 void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
     var branch = FindBranchForRow(ref row);
     branch.OnDragEvent(sender, row, column, eventType, args);
 }
コード例 #13
0
ファイル: SimpleListShifter.cs プロジェクト: ozialien/NORMA
 public void OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
     myBaseBranch.OnDragEvent(sender, row + myFirstItem, column, eventType, args);
 }
コード例 #14
0
 void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
     switch (eventType)
     {
     case DragEventType.Drop:
     case DragEventType.Enter:
         IDataObject data = args.Data;
         if (data.GetDataPresent(typeof(Diagram)))
         {
             // A single diagram
             Diagram rowDiagram    = myDiagrams[row];
             Diagram sourceDiagram = (Diagram)data.GetData(typeof(Diagram));
             if (null != sourceDiagram &&
                 rowDiagram != sourceDiagram &&
                 rowDiagram.Partition == sourceDiagram.Partition)
             {
                 if (eventType == DragEventType.Drop)
                 {
                     MoveDiagramTo(sourceDiagram, row);
                 }
                 else
                 {
                     args.Effect = DragDropEffects.Move;
                 }
             }
         }
         else if (data.GetDataPresent(typeof(VirtualTreeStartDragData[])))
         {
             Diagram   rowDiagram      = myDiagrams[row];
             Partition verifyPartition = rowDiagram.Partition;
             VirtualTreeStartDragData[] sourceDragDataItems = (VirtualTreeStartDragData[])data.GetData(typeof(VirtualTreeStartDragData[]));
             Diagram[] dropDiagrams = null;
             bool      doDrop       = eventType == DragEventType.Drop;
             for (int i = 0; i < sourceDragDataItems.Length; ++i)
             {
                 IDataObject sourceData;
                 Diagram     sourceDiagram;
                 if (null == (sourceData = sourceDragDataItems[i].Data as IDataObject) ||
                     !sourceData.GetDataPresent(typeof(Diagram)) ||
                     null == (sourceDiagram = (Diagram)sourceData.GetData(typeof(Diagram))) ||
                     rowDiagram == sourceDiagram ||
                     verifyPartition != sourceDiagram.Partition)
                 {
                     args.Effect = DragDropEffects.None;
                     return;
                 }
                 else if (doDrop)
                 {
                     (dropDiagrams ?? (dropDiagrams = new Diagram[sourceDragDataItems.Length]))[i] = sourceDiagram;
                 }
             }
             if (doDrop)
             {
                 MoveDiagramsTo(dropDiagrams, row);
             }
             else
             {
                 args.Effect = DragDropEffects.Move;
             }
         }
         break;
     }
 }
コード例 #15
0
			void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, System.Windows.Forms.DragEventArgs args)
			{
			}
コード例 #16
0
 void ISurveyNodeDropTarget.OnDragEvent(object contextElement, DragEventType eventType, DragEventArgs args)
 {
     OnDragEvent(contextElement, eventType, args);
 }
コード例 #17
0
 /// <summary>
 ///     IBranch interface implementation.
 /// </summary>
 public virtual void /* IBranch */ OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
 }
コード例 #18
0
ファイル: DiagramOrderDialog.cs プロジェクト: cjheath/NORMA
			void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
			{
				switch (eventType)
				{
					case DragEventType.Drop:
					case DragEventType.Enter:
						IDataObject data = args.Data;
						if (data.GetDataPresent(typeof(Diagram)))
						{
							// A single diagram
							Diagram rowDiagram = myDiagrams[row];
							Diagram sourceDiagram = (Diagram)data.GetData(typeof(Diagram));
							if (null != sourceDiagram &&
								rowDiagram != sourceDiagram &&
								rowDiagram.Partition == sourceDiagram.Partition)
							{
								if (eventType == DragEventType.Drop)
								{
									MoveDiagramTo(sourceDiagram, row);
								}
								else
								{
									args.Effect = DragDropEffects.Move;
								}
							}
						}
						else if (data.GetDataPresent(typeof(VirtualTreeStartDragData[])))
						{
							Diagram rowDiagram = myDiagrams[row];
							Partition verifyPartition = rowDiagram.Partition;
							VirtualTreeStartDragData[] sourceDragDataItems = (VirtualTreeStartDragData[])data.GetData(typeof(VirtualTreeStartDragData[]));
							Diagram[] dropDiagrams = null;
							bool doDrop = eventType == DragEventType.Drop;
							for (int i = 0; i < sourceDragDataItems.Length; ++i)
							{
								IDataObject sourceData;
								Diagram sourceDiagram;
								if (null == (sourceData = sourceDragDataItems[i].Data as IDataObject) ||
									!sourceData.GetDataPresent(typeof(Diagram)) ||
									null == (sourceDiagram = (Diagram)sourceData.GetData(typeof(Diagram))) ||
									rowDiagram == sourceDiagram ||
									verifyPartition != sourceDiagram.Partition)
								{
									args.Effect = DragDropEffects.None;
									return;
								}
								else if (doDrop)
								{
									(dropDiagrams ?? (dropDiagrams = new Diagram[sourceDragDataItems.Length]))[i] = sourceDiagram;
								}
							}
							if (doDrop)
							{
								MoveDiagramsTo(dropDiagrams, row);
							}
							else
							{
								args.Effect = DragDropEffects.Move;
							}
						}
						break;
				}
			}
コード例 #19
0
 /// <summary>
 ///     IBranch interface implementation.
 /// </summary>
 public void OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
 {
 }
コード例 #20
0
    public override Draggable OnDragEvent(DragEventType type, int id, Draggable current, DraggableType target)
    {
        if (type == DragEventType.Over)
        {
            this.mouseOver = id;
            this.Rebuild();
        }
        else
        {
            if (type == DragEventType.Down)
            {
                int newp = this.p;
                int newn = this.n;
                if (this.points[id].state == PType.P)
                {
                    newp--;
                }
                else
                {
                    newn--;
                }

                if (newp > 0 && AtomChart.elements[newp - 1].nuclides[newn] != null)
                {
                    this.p = newp;
                    this.n = newn;
                    GameObject        obj = new GameObject("Draggable");
                    Draggable_Nucleon dr  = (Draggable_Nucleon)obj.AddComponent(typeof(Draggable_Nucleon));
                    dr.type             = this.points[id].state;
                    this.randomizeOrder = Random.value;
                    this.mouseDown      = id;
                    this.Rebuild();
                    return(dr);
                }
            }
            else
            {
                if (type == DragEventType.Up)
                {
                    if (target && target.CanDrop(current))
                    {
                        target.Drop(current);
                        if ((target != this) && ((UserAtom.p + 1) <= UserAtom.e))
                        {
                            Draggable_Nucleon nuc = current as Draggable_Nucleon;
                            if (nuc.type == PType.P)
                            {
                                this.orbitals.RemoveElectron(false);
                                if ((target as Orbitals) || ((target as CreatorBackground) && (this.background.mouseOver == 0)))
                                {
                                    this.StartCoroutine(this.ElectronToProton());
                                }
                                else
                                {
                                    if (target as TrayGUI)
                                    {
                                        this.StartCoroutine(this.ElectronToTray());
                                    }
                                }
                            }
                        }
                        current.Die();
                    }
                    else
                    {
                        if (current)
                        {
                            current.FailDrag();
                            this.Drop(current);
                        }
                    }
                    this.randomizeOrder = Random.value;
                    this.mouseDown      = -1;
                    this.Rebuild();
                    return(null);
                }
                else
                {
                    if (type == DragEventType.Exit)
                    {
                        this.mouseOver = -1;
                        this.Rebuild();
                    }
                }
            }
        }
        return(current);
    }
コード例 #21
0
ファイル: BranchPartition.cs プロジェクト: cjheath/NORMA
			void IBranch.OnDragEvent(object sender, int row, int column, DragEventType eventType, DragEventArgs args)
			{
				BranchPartitionSection section;
				row = TranslateRow(row, out section);
				if (row == -1)
				{
					args.Effect = DragDropEffects.None;
				}
				myInnerBranch.OnDragEvent(sender, row, column, eventType, args);
			}