public bool Start(IMouseInformation mouseInformation)
            {
                bool result = false;

                if (_capturedHandler != null)
                {
                    result = _capturedHandler.Start(mouseInformation);
                    if (result)
                    {
                        return(true);
                    }
                }

                _capturedHandler = null;
                foreach (IGraphic graphic in EnumerateChildGraphics(true))
                {
                    if (!graphic.Visible)
                    {
                        continue;
                    }

                    IMouseButtonHandler handler = graphic as IMouseButtonHandler;
                    if (handler != null)
                    {
                        result = handler.Start(mouseInformation);
                        if (result)
                        {
                            _capturedHandler = handler;
                            break;
                        }
                    }
                }

                return(result);
            }
Exemple #2
0
        /// <summary>
        /// Called by the framework each time a mouse button is pressed.
        /// </summary>
        /// <remarks>
        /// <para>
        /// As a general rule, if the <see cref="IMouseButtonHandler"/> object did anything as a result of this call, it must
        /// return true.  If false is returned, <see cref="IMouseButtonHandler.Start"/> is called on other <see cref="IMouseButtonHandler"/>s
        /// until one returns true.
        /// </para>
        /// <para>
        /// The <see cref="ControlGraphic"/> implementation finds a handler by trying <see cref="Start"/>,
        /// and any child graphics implementing <see cref="IMouseButtonHandler"/>, in decreasing order of priority.
        /// </para>
        /// </remarks>
        /// <param name="mouseInformation">The mouse input information.</param>
        /// <returns>True if the <see cref="ControlGraphic"/> did something as a result of the call and hence would like to receive capture; False otherwise.</returns>
        bool IMouseButtonHandler.Start(IMouseInformation mouseInformation)
        {
            bool result = false;

            if (_capturedHandler != null)
            {
                result = _capturedHandler.Start(mouseInformation);
                if (result)
                {
                    return(true);
                }
            }

            if (Enabled)
            {
                CoordinateSystem = CoordinateSystem.Destination;
                try
                {
                    if (HitTest(mouseInformation.Location))
                    {
                        _lastTrackedPosition = mouseInformation.Location;
                        _isTracking          = true;
                    }
                    result      = Start(mouseInformation);
                    _isTracking = _isTracking && result;
                }
                finally
                {
                    ResetCoordinateSystem();
                }
            }

            _capturedHandler = null;
            if (!result)
            {
                foreach (IGraphic graphic in EnumerateChildGraphics(true))
                {
                    if (!graphic.Visible)
                    {
                        continue;
                    }

                    IMouseButtonHandler handler = graphic as IMouseButtonHandler;
                    if (handler != null)
                    {
                        result = handler.Start(mouseInformation);
                        if (result)
                        {
                            _capturedHandler = handler;
                            break;
                        }
                    }
                }
            }

            return(result);
        }
        private bool StartHandler(IMouseButtonHandler handler)
        {
            if (_selectedOnThisClick && SuppressOnTileActivate(handler))
            {
                return(false);
            }

            if (_clickCount > 1 && IgnoreDoubleClicks(handler))
            {
                return(false);
            }

            bool start = handler.Start(this);

            if (start)
            {
                ++_startCount;
            }

            return(start);
        }
Exemple #4
0
		private bool StartHandler(IMouseButtonHandler handler)
		{
			if (_selectedOnThisClick && SuppressOnTileActivate(handler))
				return false;

			if (_clickCount > 1 && IgnoreDoubleClicks(handler))
				return false;

			bool start = handler.Start(this);
			if (start)
				++_startCount;

			return start;
		}