2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * Contributor(s): Blender Foundation
23 * ***** END GPL LICENSE BLOCK *****
26 /** \file blender/windowmanager/wm_event_types.h
32 * These define have its origin at sgi, where all device defines were written down in device.h.
33 * Blender copied the conventions quite some, and expanded it with internal new defines (ton)
38 #ifndef __WM_EVENT_TYPES_H__
39 #define __WM_EVENT_TYPES_H__
42 #define EVT_DATA_TABLET 1
43 #define EVT_DATA_GESTURE 2
44 #define EVT_DATA_TIMER 3
45 #define EVT_DATA_LISTBASE 4
46 #define EVT_DATA_NDOF_MOTION 5
48 /* tablet active, matches GHOST_TTabletMode */
49 #define EVT_TABLET_NONE 0
50 #define EVT_TABLET_STYLUS 1
51 #define EVT_TABLET_ERASER 2
61 /* only use if you want user option switch possible */
64 /* Extra mouse buttons */
65 #define BUTTON4MOUSE 7
66 #define BUTTON5MOUSE 8
67 /* Extra trackpad gestures */
70 #define MOUSEROTATE 16
71 /* defaults from ghost */
72 #define WHEELUPMOUSE 10
73 #define WHEELDOWNMOUSE 11
74 /* mapped with userdef */
75 #define WHEELINMOUSE 12
76 #define WHEELOUTMOUSE 13
77 #define INBETWEEN_MOUSEMOVE 17
80 /* NDOF (from SpaceNavigator & friends)
81 These should be kept in sync with GHOST_NDOFManager.h
82 Ordering matters, exact values do not. */
84 #define NDOF_MOTION 400
87 // used internally, never sent
88 NDOF_BUTTON_NONE = NDOF_MOTION,
89 // these two are available from any 3Dconnexion device
102 // 90 degree rotations
104 NDOF_BUTTON_ROLL_CCW,
106 NDOF_BUTTON_SPIN_CCW,
108 NDOF_BUTTON_TILT_CCW,
112 NDOF_BUTTON_DOMINANT,
115 // general-purpose buttons
130 /* SYSTEM : 0x01xx */
131 #define INPUTCHANGE 0x0103 /* input connected or disconnected */
132 #define WINDEACTIVATE 0x0104 /* window is deactivated, focus lost */
134 #define TIMER 0x0110 /* timer event, passed on to all queues */
135 #define TIMER0 0x0111 /* timer event, slot for internal use */
136 #define TIMER1 0x0112 /* timer event, slot for internal use */
137 #define TIMER2 0x0113 /* timer event, slot for internal use */
138 #define TIMERJOBS 0x0114 /* timer event, jobs system */
139 #define TIMERAUTOSAVE 0x0115 /* timer event, autosave */
140 #define TIMERREPORT 0x0116 /* timer event, reports */
141 #define TIMERF 0x011F /* last timer */
143 /* test whether the event is timer event */
144 #define ISTIMER(event) (event >= TIMER && event <= TIMERF)
147 /* standard keyboard */
186 #define CAPSLOCKKEY 211
188 #define LEFTCTRLKEY 212
189 #define LEFTALTKEY 213
190 #define RIGHTALTKEY 214
191 #define RIGHTCTRLKEY 215
192 #define RIGHTSHIFTKEY 216
193 #define LEFTSHIFTKEY 217
199 #define LINEFEEDKEY 222
200 #define BACKSPACEKEY 223
202 #define SEMICOLONKEY 225
203 #define PERIODKEY 226
206 #define ACCENTGRAVEKEY 229
209 #define BACKSLASHKEY 233
211 #define LEFTBRACKETKEY 235
212 #define RIGHTBRACKETKEY 236
214 #define LEFTARROWKEY 137
215 #define DOWNARROWKEY 138
216 #define RIGHTARROWKEY 139
217 #define UPARROWKEY 140
231 #define PADPERIOD 199
232 #define PADSLASHKEY 161
233 #define PADASTERKEY 160
237 #define PADPLUSKEY 164
260 #define INSERTKEY 166
262 #define PAGEUPKEY 168
263 #define PAGEDOWNKEY 169
266 #define UNKNOWNKEY 171
268 #define GRLESSKEY 173
270 // XXX: are these codes ok?
271 #define MEDIAPLAY 174
272 #define MEDIASTOP 175
273 #define MEDIAFIRST 176
274 #define MEDIALAST 177
276 /* for event checks */
277 /* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
278 #define ISTEXTINPUT(event) (event >=' ' && event <=255)
280 /* test whether the event is a key on the keyboard */
281 #define ISKEYBOARD(event) (event >=' ' && event <=320)
283 /* test whether the event is a modifier key */
284 #define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY)
286 /* test whether the event is a mouse button */
287 #define ISMOUSE(event) (event >= LEFTMOUSE && event <= MOUSEROTATE)
289 /* test whether the event is tweak event */
290 #define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
292 /* test whether the event is a NDOF event */
293 #define ISNDOF(event) (event >= NDOF_MOTION && event < NDOF_LAST)
295 /* test whether event type is acceptable as hotkey, excluding modifiers */
296 #define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event) || ISNDOF(event)) && event!=ESCKEY && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
298 /* **************** BLENDER GESTURE EVENTS (0x5000) **************** */
300 #define EVT_ACTIONZONE_AREA 20480
301 #define EVT_ACTIONZONE_REGION 20481
303 /* tweak events, for L M R mousebuttons */
304 #define EVT_TWEAK_L 20482
305 #define EVT_TWEAK_M 20483
306 #define EVT_TWEAK_R 20484
307 /* tweak events for action or select mousebutton */
308 #define EVT_TWEAK_A 20485
309 #define EVT_TWEAK_S 20486
311 #define EVT_GESTURE 20496
313 /* value of tweaks and line gestures, note, KM_ANY (-1) works for this case too */
314 #define EVT_GESTURE_N 1
315 #define EVT_GESTURE_NE 2
316 #define EVT_GESTURE_E 3
317 #define EVT_GESTURE_SE 4
318 #define EVT_GESTURE_S 5
319 #define EVT_GESTURE_SW 6
320 #define EVT_GESTURE_W 7
321 #define EVT_GESTURE_NW 8
322 /* value of corner gestures */
323 #define EVT_GESTURE_N_E 9
324 #define EVT_GESTURE_N_W 10
325 #define EVT_GESTURE_E_N 11
326 #define EVT_GESTURE_E_S 12
327 #define EVT_GESTURE_S_E 13
328 #define EVT_GESTURE_S_W 14
329 #define EVT_GESTURE_W_S 15
330 #define EVT_GESTURE_W_N 16
332 /* **************** OTHER BLENDER EVENTS ********************* */
335 #define EVT_FILESELECT 0x5020
338 #define EVT_FILESELECT_OPEN 1
339 #define EVT_FILESELECT_FULL_OPEN 2
340 #define EVT_FILESELECT_EXEC 3
341 #define EVT_FILESELECT_CANCEL 4
342 #define EVT_FILESELECT_EXTERNAL_CANCEL 5
345 #define EVT_BUT_OPEN 0x5021
346 #define EVT_MODAL_MAP 0x5022
347 #define EVT_DROP 0x5023
348 #define EVT_BUT_CANCEL 0x5024
350 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
351 #define GESTURE_MODAL_CANCEL 1
352 #define GESTURE_MODAL_CONFIRM 2
354 #define GESTURE_MODAL_SELECT 3
355 #define GESTURE_MODAL_DESELECT 4
357 #define GESTURE_MODAL_NOP 5 /* circle select when no mouse button is pressed */
359 #define GESTURE_MODAL_CIRCLE_ADD 6 /* circle sel: larger brush */
360 #define GESTURE_MODAL_CIRCLE_SUB 7 /* circle sel: smaller brush */
362 #define GESTURE_MODAL_BEGIN 8 /* border select/straight line, activate, use release to detect which button */
364 #define GESTURE_MODAL_IN 9
365 #define GESTURE_MODAL_OUT 10
368 #endif /* __WM_EVENT_TYPES_H__ */