PageRenderTime 969ms CodeModel.GetById 966ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 3Silex is Š 2010-2011 Silex Labs and is released under the GPL License:
 4
 5This 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. 
 6
 7This 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.
 8
 9To read the license please visit http://www.gnu.org/copyleft/gpl.html
10*/
11package cocktail.mouse;
12
13import cocktail.domElement.DOMElement;
14import cocktail.geom.GeomData;
15
16/**
17 * This file contains mouse related structures
18 * and enums
19 */
20
21/**
22 * Stored the data raised by a mouse event
23 */ 
24typedef MouseEventData = {
25	var mousePosition:MousePosition;
26	
27	/**
28	 * represents the keyboard state
29	 * when the mouse event occurs
30	 */
31	var ctrlKey:Bool;
32	var altKey:Bool;
33	var shiftKey:Bool;
34}
35
36/**
37 * Represents the position of the mouse, both
38 * global (relative to the browser window top left
39 * corner) and local (relative to the dom element
40 * which triggered the mouse event top left corner)
41 */
42typedef MousePosition = {
43	var localX:Float;
44	var localY:Float;
45	var globalX:Float;
46	var globalY:Float;
47}
48
49/**
50 * Lists the different cursors which can
51 * be set for the mouse pointer
52 */
53enum MouseCursorValue {
54	/**
55	 * uses a custom bitmap cursor set with
56	 * an image dom element. The hotSpot is the registration
57	 * point of the cursor.
58	 */
59	custom(imageDOMElement:DOMElement, hotSpot:Point);
60	
61	/**
62	 * Let the browser manage the mouse cursor
63	 */
64	auto;
65	
66	/**
67	 * Hides the mouse cursor
68	 */
69	none;
70	
71	/**
72	 * Use a native OS mouse cursor
73	 */
74	native(nativeOSMouseCursorValue:NativeOSMouseCursorValue);
75}
76
77/**
78 * Lists all the available native
79 * OS mouse cursor
80 */
81enum NativeOSMouseCursorValue {
82	
83	/**
84	 * represents a pointed hand
85	 */
86	pointer;
87	
88	/**
89	 * represents an i-beam
90	 */
91	text;
92}