예제 #1
0
 /// <summary>
 /// Translate OnSubFieldMouseMove events into OnSubFieldMouseEnter and OnSubFieldMouseMove
 /// events
 /// </summary>
 public virtual void OnSubFieldMouseMove(ShapeField field, ShapeSubField subField, DiagramMouseEventArgs e)
 {
     if (HasSubFieldMouseEnterLeaveHover)
     {
         ShapeSubField oldSubField = ActiveShapeSubField;
         if (oldSubField != null)
         {
             if (PendingShapeSubField.Token.SubFieldEquals(oldSubField))
             {
                 ActiveShapeSubField = subField;
                 ActiveShapeField    = field;
                 base.OnMouseLeave(e);
                 OnSubFieldMouseEnter(field, subField, e);
             }
             else if (!oldSubField.SubFieldEquals(subField))
             {
                 OnSubFieldMouseLeave(ActiveShapeField, oldSubField, e);
                 ActiveShapeSubField = subField;
                 ActiveShapeField    = field;
                 OnSubFieldMouseEnter(field, subField, e);
             }
         }
         else
         {
             ActiveShapeSubField = subField;
             ActiveShapeField    = field;
             OnSubFieldMouseEnter(field, subField, e);
         }
         e.Handled = true;                 // Must mark as handled, or the framework will forward this OnMouseMove
     }
 }
예제 #2
0
 /// <summary>
 /// Fired when the mouse leaves a subfield. This is called directly
 /// by OnMouseLeave.
 ///
 /// If HasSubFieldHighlighting is set, the default implementation automatically
 /// removes the DiagramItem representing this subfield from the HighlightedShapes
 ///  of the active view. The subfield item will be invalidated and repainted. It is
 /// up to shapefield to check the HighlightedShapes collection and draw the subfield
 /// highlighting explicitly.
 ///
 /// Note that introducing a new ShapeSubField-derived base class would allow this
 /// to be called as the default implementation of an OnMouseLeave event on that class.
 /// However, this would need to be done at the framework level because ShapeSubField
 /// is already inherited from. Another alternative is to introduce an interface for
 /// the Enter/Leave/Hover events along with a stock implementation to help implement it.
 /// </summary>
 /// <param name="field">The parent ShapeField</param>
 /// <param name="subField">The subfield being left</param>
 /// <param name="e">Forwarded from the OnMouseLeave event</param>
 public virtual void OnSubFieldMouseLeave(ShapeField field, ShapeSubField subField, DiagramPointEventArgs e)
 {
     if (this.HasSubFieldHighlighting)
     {
         e.DiagramClientView.HighlightedShapes.Remove(new DiagramItem(this, field, subField));
     }
 }
예제 #3
0
 /// <summary>
 /// Fired when the mouse enters a subfield. This is called directly
 /// by OnMouseEnter.
 ///
 /// If HasSubFieldHighlighting is set, the default implementation automatically
 /// sets the HighlightedShapes of the active view to the DiagramItem representing
 /// this subfield. The subfield item will be invalidated and repainted. It is
 /// up to shapefield to check the HighlightedShapes collection and draw the subfield
 /// highlighting explicitly.
 ///
 /// Note that introducing a new ShapeSubField-derived base class would allow this
 /// to be called as the default implementation of an OnMouseEnter event on that class.
 /// However, this would need to be done at the framework level because ShapeSubField
 /// is already inherited from. Another alternative is to introduce an interface for
 /// the Enter/Leave/Hover events along with a stock implementation to help implement it.
 /// </summary>
 /// <param name="field">The parent ShapeField</param>
 /// <param name="subField">The subfield being entered</param>
 /// <param name="e">Forwarded from the OnMouseEnter event</param>
 public virtual void OnSubFieldMouseEnter(ShapeField field, ShapeSubField subField, DiagramPointEventArgs e)
 {
     if (this.HasSubFieldHighlighting)
     {
         DiagramClientView view = e.DiagramClientView;
         if (view != null)
         {
             view.HighlightedShapes.Set(new DiagramItem(this, field, subField));
         }
     }
 }
예제 #4
0
 /// <summary>
 /// Translate mouse event into OnSubFieldMouseHover events
 /// </summary>
 /// <param name="e">DiagramPointEventArgs</param>
 public override void OnMouseHover(DiagramPointEventArgs e)
 {
     base.OnMouseHover(e);
     if (HasSubFieldMouseEnterLeaveHover)
     {
         ShapeSubField subField = ActiveShapeSubField;
         if (subField != null && !PendingShapeSubField.Token.SubFieldEquals(subField))
         {
             Debug.Assert(ActiveShapeField != null);                     // Should be able to set sub field without shape field
             OnSubFieldMouseHover(ActiveShapeField, subField, e);
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Translate mouse events into OnSubFieldMouseEnter/OnSubFieldMouseLeave events
 /// </summary>
 /// <param name="e">DiagramPointEventArgs</param>
 public override void OnMouseLeave(DiagramPointEventArgs e)
 {
     base.OnMouseLeave(e);
     if (HasSubFieldMouseEnterLeaveHover)
     {
         ShapeSubField subField = ActiveShapeSubField;
         ActiveShapeSubField = null;
         if (subField != null && !PendingShapeSubField.Token.SubFieldEquals(subField))
         {
             ShapeField shapeField = ActiveShapeField;
             ActiveShapeField = null;
             OnSubFieldMouseLeave(shapeField, subField, e);
         }
     }
 }
예제 #6
0
 /// <summary>
 /// Translate mouse events into OnSubFieldMouseEnter/OnSubFieldMouseLeave events
 /// </summary>
 /// <param name="e">DiagramMouseEventArgs</param>
 public override void OnMouseMove(DiagramMouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (HasSubFieldMouseEnterLeaveHover)
     {
         Debug.Assert(e.DiagramHitTestInfo.HitDiagramItem.SubField == null);                 // Should be in OnSubFieldMouseMove, not here
         ShapeSubField oldSubField = ActiveShapeSubField;
         if (oldSubField != null && !PendingShapeSubField.Token.SubFieldEquals(oldSubField))
         {
             ShapeField oldShapeField = ActiveShapeField;
             ActiveShapeField    = null;
             ActiveShapeSubField = PendingShapeSubField.Token;
             OnSubFieldMouseLeave(oldShapeField, oldSubField, e);
             base.OnMouseEnter(e);
         }
     }
 }
예제 #7
0
 /// <summary>
 /// Translate mouse events into OnSubFieldMouseEnter/OnSubFieldMouseLeave events
 /// </summary>
 /// <param name="e">DiagramPointEventArgs</param>
 public override void OnMouseEnter(DiagramPointEventArgs e)
 {
     base.OnMouseEnter(e);
     if (HasSubFieldMouseEnterLeaveHover)
     {
         DiagramItem   item       = e.DiagramHitTestInfo.HitDiagramItem;
         ShapeSubField subField   = item.SubField;
         ShapeField    shapeField = item.Field;
         // Note that we ignore any existing cached fields here. They
         // should be null at this point, but ignoring them guards against
         // the possibility that a leave event did not fire.
         if (subField == null || shapeField == null)
         {
             ActiveShapeSubField = PendingShapeSubField.Token;
             ActiveShapeField    = null;
         }
         else
         {
             ActiveShapeSubField = subField;
             ActiveShapeField    = shapeField;
             OnSubFieldMouseEnter(shapeField, subField, e);
         }
     }
 }
		/// <summary>
		/// Translate mouse events into OnSubFieldMouseEnter/OnSubFieldMouseLeave events
		/// </summary>
		/// <param name="e">DiagramPointEventArgs</param>
		public override void OnMouseLeave(DiagramPointEventArgs e)
		{
			base.OnMouseLeave(e);
			if (HasSubFieldMouseEnterLeaveHover)
			{
				ShapeSubField subField = ActiveShapeSubField;
				ActiveShapeSubField = null;
				if (subField != null && !PendingShapeSubField.Token.SubFieldEquals(subField))
				{
					ShapeField shapeField = ActiveShapeField;
					ActiveShapeField = null;
					OnSubFieldMouseLeave(shapeField, subField, e);
				}
			}
		}
		/// <summary>
		/// Translate mouse events into OnSubFieldMouseEnter/OnSubFieldMouseLeave events
		/// </summary>
		/// <param name="e">DiagramPointEventArgs</param>
		public override void OnMouseEnter(DiagramPointEventArgs e)
		{
			base.OnMouseEnter(e);
			if (HasSubFieldMouseEnterLeaveHover)
			{
				DiagramItem item = e.DiagramHitTestInfo.HitDiagramItem;
				ShapeSubField subField = item.SubField;
				ShapeField shapeField = item.Field;
				// Note that we ignore any existing cached fields here. They
				// should be null at this point, but ignoring them guards against
				// the possibility that a leave event did not fire.
				if (subField == null || shapeField == null)
				{
					ActiveShapeSubField = PendingShapeSubField.Token;
					ActiveShapeField = null;
				}
				else
				{
					ActiveShapeSubField = subField;
					ActiveShapeField = shapeField;
					OnSubFieldMouseEnter(shapeField, subField, e);
				}
			}
		}
		/// <summary>
		/// Translate mouse events into OnSubFieldMouseEnter/OnSubFieldMouseLeave events
		/// </summary>
		/// <param name="e">DiagramMouseEventArgs</param>
		public override void OnMouseMove(DiagramMouseEventArgs e)
		{
			base.OnMouseMove(e);
			if (HasSubFieldMouseEnterLeaveHover)
			{
				Debug.Assert(e.DiagramHitTestInfo.HitDiagramItem.SubField == null); // Should be in OnSubFieldMouseMove, not here
				ShapeSubField oldSubField = ActiveShapeSubField;
				if (oldSubField != null && !PendingShapeSubField.Token.SubFieldEquals(oldSubField))
				{
					ShapeField oldShapeField = ActiveShapeField;
					ActiveShapeField = null;
					ActiveShapeSubField = PendingShapeSubField.Token;
					OnSubFieldMouseLeave(oldShapeField, oldSubField, e);
					base.OnMouseEnter(e);
				}
			}
		}
		/// <summary>
		/// Translate OnSubFieldMouseMove events into OnSubFieldMouseEnter and OnSubFieldMouseMove
		/// events
		/// </summary>
		public virtual void OnSubFieldMouseMove(ShapeField field, ShapeSubField subField, DiagramMouseEventArgs e)
		{
			if (HasSubFieldMouseEnterLeaveHover)
			{
				ShapeSubField oldSubField = ActiveShapeSubField;
				if (oldSubField != null)
				{
					if (PendingShapeSubField.Token.SubFieldEquals(oldSubField))
					{
						ActiveShapeSubField = subField;
						ActiveShapeField = field;
						base.OnMouseLeave(e);
						OnSubFieldMouseEnter(field, subField, e);
					}
					else if (!oldSubField.SubFieldEquals(subField))
					{
						OnSubFieldMouseLeave(ActiveShapeField, oldSubField, e);
						ActiveShapeSubField = subField;
						ActiveShapeField = field;
						OnSubFieldMouseEnter(field, subField, e);
					}
				}
				else
				{
					ActiveShapeSubField = subField;
					ActiveShapeField = field;
					OnSubFieldMouseEnter(field, subField, e);
				}
				e.Handled = true; // Must mark as handled, or the framework will forward this OnMouseMove
			}
		}
		/// <summary>
		/// Fired when the mouse hovers over a subfield. This is called directly
		/// by OnMouseHover.
		/// 
		/// The default implementation is empty.
		/// 
		/// Note that introducing a new ShapeSubField-derived base class would allow this
		/// to be called as the default implementation of an OnMouseHover event on that class.
		/// However, this would need to be done at the framework level because ShapeSubField
		/// is already inherited from. Another alternative is to introduce an interface for
		/// the Enter/Leave/Hover events along with a stock implementation to help implement it.
		/// </summary>
		/// <param name="field">The parent ShapeField</param>
		/// <param name="subField">The subfield being hovered over</param>
		/// <param name="e">Forwarded from the OnMouseHover event</param>
		public virtual void OnSubFieldMouseHover(ShapeField field, ShapeSubField subField, DiagramPointEventArgs e)
		{
		}
		/// <summary>
		/// Fired when the mouse leaves a subfield. This is called directly
		/// by OnMouseLeave.
		/// 
		/// If HasSubFieldHighlighting is set, the default implementation automatically
		/// removes the DiagramItem representing this subfield from the HighlightedShapes
		///  of the active view. The subfield item will be invalidated and repainted. It is
		/// up to shapefield to check the HighlightedShapes collection and draw the subfield
		/// highlighting explicitly.
		///
		/// Note that introducing a new ShapeSubField-derived base class would allow this
		/// to be called as the default implementation of an OnMouseLeave event on that class.
		/// However, this would need to be done at the framework level because ShapeSubField
		/// is already inherited from. Another alternative is to introduce an interface for
		/// the Enter/Leave/Hover events along with a stock implementation to help implement it.
		/// </summary>
		/// <param name="field">The parent ShapeField</param>
		/// <param name="subField">The subfield being left</param>
		/// <param name="e">Forwarded from the OnMouseLeave event</param>
		public virtual void OnSubFieldMouseLeave(ShapeField field, ShapeSubField subField, DiagramPointEventArgs e)
		{
			if (this.HasSubFieldHighlighting)
			{
				e.DiagramClientView.HighlightedShapes.Remove(new DiagramItem(this, field, subField));
			}
		}
		/// <summary>
		/// Fired when the mouse enters a subfield. This is called directly
		/// by OnMouseEnter.
		/// 
		/// If HasSubFieldHighlighting is set, the default implementation automatically
		/// sets the HighlightedShapes of the active view to the DiagramItem representing
		/// this subfield. The subfield item will be invalidated and repainted. It is
		/// up to shapefield to check the HighlightedShapes collection and draw the subfield
		/// highlighting explicitly.
		/// 
		/// Note that introducing a new ShapeSubField-derived base class would allow this
		/// to be called as the default implementation of an OnMouseEnter event on that class.
		/// However, this would need to be done at the framework level because ShapeSubField
		/// is already inherited from. Another alternative is to introduce an interface for
		/// the Enter/Leave/Hover events along with a stock implementation to help implement it.
		/// </summary>
		/// <param name="field">The parent ShapeField</param>
		/// <param name="subField">The subfield being entered</param>
		/// <param name="e">Forwarded from the OnMouseEnter event</param>
		public virtual void OnSubFieldMouseEnter(ShapeField field, ShapeSubField subField, DiagramPointEventArgs e)
		{
			if (this.HasSubFieldHighlighting)
			{
				DiagramClientView view = e.DiagramClientView;
				if (view != null)
				{
					view.HighlightedShapes.Set(new DiagramItem(this, field, subField));
				}
			}
		}
예제 #15
0
 /// <summary>
 /// Fired when the mouse hovers over a subfield. This is called directly
 /// by OnMouseHover.
 ///
 /// The default implementation is empty.
 ///
 /// Note that introducing a new ShapeSubField-derived base class would allow this
 /// to be called as the default implementation of an OnMouseHover event on that class.
 /// However, this would need to be done at the framework level because ShapeSubField
 /// is already inherited from. Another alternative is to introduce an interface for
 /// the Enter/Leave/Hover events along with a stock implementation to help implement it.
 /// </summary>
 /// <param name="field">The parent ShapeField</param>
 /// <param name="subField">The subfield being hovered over</param>
 /// <param name="e">Forwarded from the OnMouseHover event</param>
 public virtual void OnSubFieldMouseHover(ShapeField field, ShapeSubField subField, DiagramPointEventArgs e)
 {
 }