1 /*
2  * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
3  * Copyright 2006 James Bursa <bursa@users.sourceforge.net>
4  * Copyright 2010 Michael Drake <tlsa@netsurf-browser.org>
5  *
6  * This file is part of NetSurf, http://www.netsurf-browser.org/
7  *
8  * NetSurf is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * NetSurf is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 /**
22  * \file
23  *
24  * Core mouse and pointer states.
25  */
26 
27 #ifndef _NETSURF_MOUSE_H_
28 #define _NETSURF_MOUSE_H_
29 
30 /**
31  * Mouse state.	1 is primary mouse button (e.g. Select on RISC OS).
32  *		2 is secondary mouse button (e.g. Adjust on RISC OS).
33  *
34  * \note click meaning is different for different front ends. On RISC
35  *       OS, it is standard to act on press, so a click is fired at
36  *       the same time as a mouse button is pressed. With GTK, it is
37  *       standard to act on release, so a click is fired when the
38  *       mouse button is released, if the operation wasn't a drag.
39  *
40  * \note double and triple clicks are fired alongside a
41  *       BROWSER_MOUSE_CLICK_[1|2] to indicate which button is used.
42  */
43 typedef enum browser_mouse_state {
44 	/** No mouse buttons pressed, May be used to indicate hover or
45 	 * end of drag.
46 	 */
47 	BROWSER_MOUSE_HOVER = 0,
48 
49 	/** button 1 pressed */
50 	BROWSER_MOUSE_PRESS_1 = (1 <<  0),
51 	/** button 2 pressed */
52 	BROWSER_MOUSE_PRESS_2 = (1 <<  1),
53 
54 	/** button 1 clicked. */
55 	BROWSER_MOUSE_CLICK_1 = (1 <<  2),
56 	/** button 2 clicked. */
57 	BROWSER_MOUSE_CLICK_2 = (1 <<  3),
58 
59 	/** button double clicked */
60 	BROWSER_MOUSE_DOUBLE_CLICK = (1 << 4),
61 	/** button triple clicked */
62 	BROWSER_MOUSE_TRIPLE_CLICK = (1 << 5),
63 
64 	/** start of button 1 drag */
65 	BROWSER_MOUSE_DRAG_1 = (1 << 6),
66 	/** start of button 2 drag */
67 	BROWSER_MOUSE_DRAG_2 = (1 << 7),
68 
69 	/** a drag operation was started and a mouse button is still pressed */
70 	BROWSER_MOUSE_DRAG_ON = (1 << 8),
71 
72 	/** during button 1 drag */
73 	BROWSER_MOUSE_HOLDING_1 = (1 << 9),
74 	/** during button 2 drag */
75 	BROWSER_MOUSE_HOLDING_2 = (1 << 10),
76 
77 	/** 1st modifier key pressed (eg. Shift) */
78 	BROWSER_MOUSE_MOD_1 = (1 << 11),
79 	/** 2nd modifier key pressed (eg. Ctrl) */
80 	BROWSER_MOUSE_MOD_2 = (1 << 12),
81 	/** 3rd modifier key pressed (eg. Alt) */
82 	BROWSER_MOUSE_MOD_3 = (1 << 13),
83 
84 	/** pointer leaving window */
85 	BROWSER_MOUSE_LEAVE = (1 << 14),
86 } browser_mouse_state;
87 
88 
89 typedef enum gui_pointer_shape {
90 	GUI_POINTER_DEFAULT,
91 	GUI_POINTER_POINT,
92 	GUI_POINTER_CARET,
93 	GUI_POINTER_MENU,
94 	GUI_POINTER_UP,
95 	GUI_POINTER_DOWN,
96 	GUI_POINTER_LEFT,
97 	GUI_POINTER_RIGHT,
98 	GUI_POINTER_RU,
99 	GUI_POINTER_LD,
100 	GUI_POINTER_LU,
101 	GUI_POINTER_RD,
102 	GUI_POINTER_CROSS,
103 	GUI_POINTER_MOVE,
104 	GUI_POINTER_WAIT,
105 	GUI_POINTER_HELP,
106 	GUI_POINTER_NO_DROP,
107 	GUI_POINTER_NOT_ALLOWED,
108 	GUI_POINTER_PROGRESS
109 } gui_pointer_shape;
110 
111 /** Mouse pointer type */
112 typedef enum {
113 	BROWSER_POINTER_DEFAULT		= GUI_POINTER_DEFAULT,
114 	BROWSER_POINTER_POINT		= GUI_POINTER_POINT,
115 	BROWSER_POINTER_CARET		= GUI_POINTER_CARET,
116 	BROWSER_POINTER_MENU		= GUI_POINTER_MENU,
117 	BROWSER_POINTER_UP		= GUI_POINTER_UP,
118 	BROWSER_POINTER_DOWN		= GUI_POINTER_DOWN,
119 	BROWSER_POINTER_LEFT		= GUI_POINTER_LEFT,
120 	BROWSER_POINTER_RIGHT		= GUI_POINTER_RIGHT,
121 	BROWSER_POINTER_RU		= GUI_POINTER_RU,
122 	BROWSER_POINTER_LD		= GUI_POINTER_LD,
123 	BROWSER_POINTER_LU		= GUI_POINTER_LU,
124 	BROWSER_POINTER_RD		= GUI_POINTER_RD,
125 	BROWSER_POINTER_CROSS		= GUI_POINTER_CROSS,
126 	BROWSER_POINTER_MOVE		= GUI_POINTER_MOVE,
127 	BROWSER_POINTER_WAIT		= GUI_POINTER_WAIT,
128 	BROWSER_POINTER_HELP		= GUI_POINTER_HELP,
129 	BROWSER_POINTER_NO_DROP		= GUI_POINTER_NO_DROP,
130 	BROWSER_POINTER_NOT_ALLOWED	= GUI_POINTER_NOT_ALLOWED,
131 	BROWSER_POINTER_PROGRESS	= GUI_POINTER_PROGRESS,
132 	BROWSER_POINTER_AUTO
133 } browser_pointer_shape;
134 
135 
136 void browser_mouse_state_dump(browser_mouse_state mouse);
137 
138 #endif
139