Exemple #1
0
        /// <summary>
        /// Call all of the Action event handlers.
        /// </summary>
        /// <param name="view">the <see cref="T:Northwoods.Go.GoView" /> that is handling input events for this <see cref="T:Northwoods.Go.IGoActionObject" /></param>
        /// <param name="e">assumed to be the same as the <paramref name="view" />'s <see cref="P:Northwoods.Go.GoView.LastInput" /></param>
        /// <remarks>
        /// This method is called when the user does a mouse press and release
        /// on this button.
        /// If the mouse point is no longer over this object, no Action
        /// event handlers are called, and <see cref="M:Northwoods.Go.GoButton.OnActionCancelled(Northwoods.Go.GoView)" />
        /// is called instead.
        /// </remarks>
        public virtual void OnAction(GoView view, GoInputEventArgs e)
        {
            if (view == null)
            {
                return;
            }
            GoToolAction    goToolAction   = view.Tool as GoToolAction;
            IGoActionObject goActionObject = this;

            if (goToolAction != null)
            {
                goActionObject = goToolAction.PickActionObject();
            }
            if (goActionObject == this)
            {
                if (myActionEvent != null)
                {
                    myActionEvent(this, e);
                }
            }
            else
            {
                OnActionCancelled(view);
            }
        }
Exemple #2
0
 /// <summary>
 /// Make sure any <see cref="T:Northwoods.Go.IGoActionObject" /> is deactivated
 /// and that any automatic adjustments calls are stopped.
 /// </summary>
 public override void Stop()
 {
     StopAutoAdjusting();
     if (ActionObject != null)
     {
         ActionObject.ActionActivated = false;
     }
     ActionObject       = null;
     base.CurrentObject = null;
 }
Exemple #3
0
 /// <summary>
 /// Get the <see cref="T:Northwoods.Go.IGoActionObject" /> that the mouse is over, and activate it
 /// by setting its <see cref="P:Northwoods.Go.IGoActionObject.ActionActivated" /> property to true
 /// and calling its <see cref="M:Northwoods.Go.IGoActionObject.OnActionActivated(Northwoods.Go.GoView,Northwoods.Go.GoInputEventArgs)" /> method.
 /// </summary>
 public override void Start()
 {
     ActionObject = PickActionObject();
     if (ActionObject == null)
     {
         StopTool();
         return;
     }
     ActionObject.ActionActivated = true;
     ActionObject.OnActionActivated(base.View, base.LastInput);
 }
Exemple #4
0
 /// <summary>
 /// Find an <see cref="T:Northwoods.Go.IGoActionObject" /> that the last input event is over.
 /// </summary>
 /// <returns>an <see cref="T:Northwoods.Go.IGoActionObject" />, or null if none</returns>
 /// <remarks>
 /// This proceeds up the chain of <see cref="P:Northwoods.Go.GoObject.Parent" />s to find an
 /// object that implements <see cref="T:Northwoods.Go.IGoActionObject" /> and whose
 /// <see cref="P:Northwoods.Go.IGoActionObject.ActionEnabled" /> property is true.
 /// The result is remembered as the value of the <see cref="P:Northwoods.Go.GoToolAction.ActionObject" /> property.
 /// </remarks>
 public virtual IGoActionObject PickActionObject()
 {
     for (GoObject goObject = base.View.PickObject(doc: true, view: false, base.LastInput.DocPoint, selectableOnly: false); goObject != null; goObject = goObject.Parent)
     {
         IGoActionObject goActionObject = goObject as IGoActionObject;
         if (goActionObject != null && goActionObject.ActionEnabled)
         {
             base.CurrentObject = goObject;
             return(goActionObject);
         }
     }
     return(null);
 }