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 // keyboard emulation
120 // general-purpose buttons
131 // more general-purpose buttons
140 /* SYSTEM : 0x01xx */
141 #define INPUTCHANGE 0x0103 /* input connected or disconnected */
142 #define WINDEACTIVATE 0x0104 /* window is deactivated, focus lost */
144 #define TIMER 0x0110 /* timer event, passed on to all queues */
145 #define TIMER0 0x0111 /* timer event, slot for internal use */
146 #define TIMER1 0x0112 /* timer event, slot for internal use */
147 #define TIMER2 0x0113 /* timer event, slot for internal use */
148 #define TIMERJOBS 0x0114 /* timer event, jobs system */
149 #define TIMERAUTOSAVE 0x0115 /* timer event, autosave */
150 #define TIMERREPORT 0x0116 /* timer event, reports */
151 #define TIMERF 0x011F /* last timer */
153 /* test whether the event is timer event */
154 #define ISTIMER(event) (event >= TIMER && event <= TIMERF)
157 /* standard keyboard */
196 #define CAPSLOCKKEY 211
198 #define LEFTCTRLKEY 212
199 #define LEFTALTKEY 213
200 #define RIGHTALTKEY 214
201 #define RIGHTCTRLKEY 215
202 #define RIGHTSHIFTKEY 216
203 #define LEFTSHIFTKEY 217
209 #define LINEFEEDKEY 222
210 #define BACKSPACEKEY 223
212 #define SEMICOLONKEY 225
213 #define PERIODKEY 226
216 #define ACCENTGRAVEKEY 229
219 #define BACKSLASHKEY 233
221 #define LEFTBRACKETKEY 235
222 #define RIGHTBRACKETKEY 236
224 #define LEFTARROWKEY 137
225 #define DOWNARROWKEY 138
226 #define RIGHTARROWKEY 139
227 #define UPARROWKEY 140
241 #define PADPERIOD 199
242 #define PADSLASHKEY 161
243 #define PADASTERKEY 160
247 #define PADPLUSKEY 164
270 #define INSERTKEY 166
272 #define PAGEUPKEY 168
273 #define PAGEDOWNKEY 169
276 #define UNKNOWNKEY 171
278 #define GRLESSKEY 173
280 // XXX: are these codes ok?
281 #define MEDIAPLAY 174
282 #define MEDIASTOP 175
283 #define MEDIAFIRST 176
284 #define MEDIALAST 177
286 /* for event checks */
287 /* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
288 #define ISTEXTINPUT(event) (event >=' ' && event <=255)
290 /* test whether the event is a key on the keyboard */
291 #define ISKEYBOARD(event) (event >=' ' && event <=320)
293 /* test whether the event is a modifier key */
294 #define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY)
296 /* test whether the event is a mouse button */
297 #define ISMOUSE(event) (event >= LEFTMOUSE && event <= MOUSEROTATE)
299 /* test whether the event is tweak event */
300 #define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
302 /* test whether the event is a NDOF event */
303 #define ISNDOF(event) (event >= NDOF_MOTION && event < NDOF_LAST)
305 /* test whether event type is acceptable as hotkey, excluding modifiers */
306 #define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event) || ISNDOF(event)) && event!=ESCKEY && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
308 /* **************** BLENDER GESTURE EVENTS (0x5000) **************** */
310 #define EVT_ACTIONZONE_AREA 20480
311 #define EVT_ACTIONZONE_REGION 20481
313 /* tweak events, for L M R mousebuttons */
314 #define EVT_TWEAK_L 20482
315 #define EVT_TWEAK_M 20483
316 #define EVT_TWEAK_R 20484
317 /* tweak events for action or select mousebutton */
318 #define EVT_TWEAK_A 20485
319 #define EVT_TWEAK_S 20486
321 #define EVT_GESTURE 20496
323 /* value of tweaks and line gestures, note, KM_ANY (-1) works for this case too */
324 #define EVT_GESTURE_N 1
325 #define EVT_GESTURE_NE 2
326 #define EVT_GESTURE_E 3
327 #define EVT_GESTURE_SE 4
328 #define EVT_GESTURE_S 5
329 #define EVT_GESTURE_SW 6
330 #define EVT_GESTURE_W 7
331 #define EVT_GESTURE_NW 8
332 /* value of corner gestures */
333 #define EVT_GESTURE_N_E 9
334 #define EVT_GESTURE_N_W 10
335 #define EVT_GESTURE_E_N 11
336 #define EVT_GESTURE_E_S 12
337 #define EVT_GESTURE_S_E 13
338 #define EVT_GESTURE_S_W 14
339 #define EVT_GESTURE_W_S 15
340 #define EVT_GESTURE_W_N 16
342 /* **************** OTHER BLENDER EVENTS ********************* */
345 #define EVT_FILESELECT 0x5020
348 #define EVT_FILESELECT_OPEN 1
349 #define EVT_FILESELECT_FULL_OPEN 2
350 #define EVT_FILESELECT_EXEC 3
351 #define EVT_FILESELECT_CANCEL 4
352 #define EVT_FILESELECT_EXTERNAL_CANCEL 5
355 #define EVT_BUT_OPEN 0x5021
356 #define EVT_MODAL_MAP 0x5022
357 #define EVT_DROP 0x5023
358 #define EVT_BUT_CANCEL 0x5024
360 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
361 #define GESTURE_MODAL_CANCEL 1
362 #define GESTURE_MODAL_CONFIRM 2
364 #define GESTURE_MODAL_SELECT 3
365 #define GESTURE_MODAL_DESELECT 4
367 #define GESTURE_MODAL_NOP 5 /* circle select when no mouse button is pressed */
369 #define GESTURE_MODAL_CIRCLE_ADD 6 /* circle sel: larger brush */
370 #define GESTURE_MODAL_CIRCLE_SUB 7 /* circle sel: smaller brush */
372 #define GESTURE_MODAL_BEGIN 8 /* border select/straight line, activate, use release to detect which button */
374 #define GESTURE_MODAL_IN 9
375 #define GESTURE_MODAL_OUT 10
378 #endif /* __WM_EVENT_TYPES_H__ */