#region License /* Copyright (c) 2010-2014 Danko Kozar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endregion License using System; using eDriven.Core.Geom; namespace eDriven.Core.Events { /// /// The event that has both global and local position /// This event bubbles by default /// /// Coded by Danko Kozar public class MouseEvent : InputEvent { #region Constants // ReSharper disable InconsistentNaming /// /// Constant /// public const string MOUSE_MOVE = "mouseMove"; /// /// Constant /// public const string MOUSE_OVER = "mouseOver"; /// /// Constant /// public const string MOUSE_OUT = "mouseOut"; /// /// Constant /// public const string MOUSE_DRAG = "mouseDrag"; /// /// Constant /// public const string ROLL_OVER = "rollOver"; /// /// Constant /// public const string ROLL_OUT = "rollOut"; /// /// Constant /// public const string MOUSE_LEAVE = "mouseLeave"; // left button /// /// Constant /// public const string MOUSE_DOWN = "mouseDown"; /// /// Constant /// public const string MOUSE_UP = "mouseUp"; /// /// Constant /// public const string CLICK = "click"; /// /// Constant /// public const string DOUBLE_CLICK = "doubleClick"; // middle button /// /// Constant /// public const string MIDDLE_MOUSE_DOWN = "middleMouseDown"; /// /// Constant /// public const string MIDDLE_MOUSE_UP = "middleMouseUp"; /// /// Constant /// public const string MIDDLE_CLICK = "middleClick"; /// /// Constant /// public const string MIDDLE_DOUBLE_CLICK = "middleDoubleClick"; // right button /// /// Constant /// public const string RIGHT_MOUSE_DOWN = "rightMouseDown"; /// /// Constant /// public const string RIGHT_MOUSE_UP = "rightMouseUp"; /// /// Constant /// public const string RIGHT_CLICK = "rightClick"; /// /// Constant /// public const string RIGHT_DOUBLE_CLICK = "rightDoubleClick"; /// /// Constant /// public const string MOUSE_WHEEL = "mouseWheel"; /// /// Constant /// public const string MOUSE_DOWN_OUTSIDE = "mouseDownOutside"; /// /// Constant /// public const string MOUSE_WHEEL_OUTSIDE = "mouseWheelOutside"; // ReSharper restore InconsistentNaming #endregion #region Properties /// /// The local position (used by GUI) /// public Point LocalPosition; /// /// The global (screen) position /// public Point GlobalPosition; /// /// Related object /// public object RelatedObject; /// /// True if the mouse button is down /// public bool ButtonDown; /// /// True if the mouse button is down /// public bool MiddleButtonDown; /// /// True if the mouse button is down /// public bool RightButtonDown; #endregion #region Constructor /// /// Constructor /// public MouseEvent(string type) : base(type) { Bubbles = true; } /// /// Constructor /// public MouseEvent(string type, object target) : base(type, target) { Bubbles = true; } /// /// Constructor /// public MouseEvent(string type, bool bubbles) : base(type, bubbles) { } /// /// Constructor /// public MouseEvent(string type, bool bubbles, bool cancelable) : base(type, bubbles, cancelable) { } #endregion public override string ToString() { return string.Format("MouseEvent [{0}], GlobalPosition: {1}, LocalPosition: {2}", Type, GlobalPosition, LocalPosition); } } }