/src/cocktail/mouse/MouseData.hx

http://github.com/silexlabs/Cocktail · Haxe · 92 lines · 25 code · 12 blank · 55 comment · 0 complexity · 5bb7da4b8168c2b493405845f314f6e6 MD5 · raw file

  1. /*This file is part of Silex - see http://projects.silexlabs.org/?/silex
  2. Silex is Š 2010-2011 Silex Labs and is released under the GPL License:
  3. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  4. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  5. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  6. */
  7. package cocktail.mouse;
  8. import cocktail.domElement.DOMElement;
  9. import cocktail.geom.GeomData;
  10. /**
  11. * This file contains mouse related structures
  12. * and enums
  13. */
  14. /**
  15. * Stored the data raised by a mouse event
  16. */
  17. typedef MouseEventData = {
  18. var mousePosition:MousePosition;
  19. /**
  20. * represents the keyboard state
  21. * when the mouse event occurs
  22. */
  23. var ctrlKey:Bool;
  24. var altKey:Bool;
  25. var shiftKey:Bool;
  26. }
  27. /**
  28. * Represents the position of the mouse, both
  29. * global (relative to the browser window top left
  30. * corner) and local (relative to the dom element
  31. * which triggered the mouse event top left corner)
  32. */
  33. typedef MousePosition = {
  34. var localX:Float;
  35. var localY:Float;
  36. var globalX:Float;
  37. var globalY:Float;
  38. }
  39. /**
  40. * Lists the different cursors which can
  41. * be set for the mouse pointer
  42. */
  43. enum MouseCursorValue {
  44. /**
  45. * uses a custom bitmap cursor set with
  46. * an image dom element. The hotSpot is the registration
  47. * point of the cursor.
  48. */
  49. custom(imageDOMElement:DOMElement, hotSpot:Point);
  50. /**
  51. * Let the browser manage the mouse cursor
  52. */
  53. auto;
  54. /**
  55. * Hides the mouse cursor
  56. */
  57. none;
  58. /**
  59. * Use a native OS mouse cursor
  60. */
  61. native(nativeOSMouseCursorValue:NativeOSMouseCursorValue);
  62. }
  63. /**
  64. * Lists all the available native
  65. * OS mouse cursor
  66. */
  67. enum NativeOSMouseCursorValue {
  68. /**
  69. * represents a pointed hand
  70. */
  71. pointer;
  72. /**
  73. * represents an i-beam
  74. */
  75. text;
  76. }