Blender  V2.59
wm_event_types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: wm_event_types.h 38908 2011-08-02 04:28:05Z merwin $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version. 
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * Contributor(s): Blender Foundation
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 /*
00034  *  These define have its origin at sgi, where all device defines were written down in device.h.
00035  *  Blender copied the conventions quite some, and expanded it with internal new defines (ton)
00036  *
00037  */ 
00038 
00039 
00040 #ifndef WM_EVENT_TYPES_H
00041 #define WM_EVENT_TYPES_H
00042 
00043 /* customdata type */
00044 #define EVT_DATA_TABLET         1
00045 #define EVT_DATA_GESTURE        2
00046 #define EVT_DATA_TIMER          3
00047 #define EVT_DATA_LISTBASE       4
00048 #define EVT_DATA_NDOF_MOTION 5
00049 
00050 /* tablet active, matches GHOST_TTabletMode */
00051 #define EVT_TABLET_NONE         0
00052 #define EVT_TABLET_STYLUS       1
00053 #define EVT_TABLET_ERASER       2
00054 
00055 #define MOUSEX          4
00056 #define MOUSEY          5
00057 
00058 /* MOUSE : 0x00x */
00059 #define LEFTMOUSE               1
00060 #define MIDDLEMOUSE             2
00061 #define RIGHTMOUSE              3
00062 #define MOUSEMOVE               4
00063                 /* only use if you want user option switch possible */
00064 #define ACTIONMOUSE             5
00065 #define SELECTMOUSE             6
00066                 /* Extra mouse buttons */
00067 #define BUTTON4MOUSE    7
00068 #define BUTTON5MOUSE    8
00069                 /* Extra trackpad gestures */
00070 #define MOUSEPAN                14
00071 #define MOUSEZOOM               15
00072 #define MOUSEROTATE             16
00073                 /* defaults from ghost */
00074 #define WHEELUPMOUSE    10
00075 #define WHEELDOWNMOUSE  11
00076                 /* mapped with userdef */
00077 #define WHEELINMOUSE    12
00078 #define WHEELOUTMOUSE   13
00079 #define INBETWEEN_MOUSEMOVE     17
00080 
00081 
00082 /* NDOF (from SpaceNavigator & friends)
00083    These should be kept in sync with GHOST_NDOFManager.h
00084    Ordering matters, exact values do not. */
00085 
00086 #define NDOF_MOTION 400
00087 
00088 enum {
00089         // used internally, never sent
00090         NDOF_BUTTON_NONE = NDOF_MOTION,
00091         // these two are available from any 3Dconnexion device
00092         NDOF_BUTTON_MENU,
00093         NDOF_BUTTON_FIT,
00094         // standard views
00095         NDOF_BUTTON_TOP,
00096         NDOF_BUTTON_BOTTOM,
00097         NDOF_BUTTON_LEFT,
00098         NDOF_BUTTON_RIGHT,
00099         NDOF_BUTTON_FRONT,
00100         NDOF_BUTTON_BACK,
00101         // more views
00102         NDOF_BUTTON_ISO1,
00103         NDOF_BUTTON_ISO2,
00104         // 90 degree rotations
00105         NDOF_BUTTON_ROLL_CW,
00106         NDOF_BUTTON_ROLL_CCW,
00107         NDOF_BUTTON_SPIN_CW,
00108         NDOF_BUTTON_SPIN_CCW,
00109         NDOF_BUTTON_TILT_CW,
00110         NDOF_BUTTON_TILT_CCW,
00111         // device control
00112         NDOF_BUTTON_ROTATE,
00113         NDOF_BUTTON_PANZOOM,
00114         NDOF_BUTTON_DOMINANT,
00115         NDOF_BUTTON_PLUS,
00116         NDOF_BUTTON_MINUS,
00117         // general-purpose buttons
00118         NDOF_BUTTON_1,
00119         NDOF_BUTTON_2,
00120         NDOF_BUTTON_3,
00121         NDOF_BUTTON_4,
00122         NDOF_BUTTON_5,
00123         NDOF_BUTTON_6,
00124         NDOF_BUTTON_7,
00125         NDOF_BUTTON_8,
00126         NDOF_BUTTON_9,
00127         NDOF_BUTTON_10,
00128         NDOF_LAST
00129         };
00130 
00131 
00132 /* SYSTEM : 0x01xx */
00133 #define INPUTCHANGE             0x0103  /* input connected or disconnected */
00134 #define WINDEACTIVATE   0x0104  /* window is deactivated, focus lost */
00135 
00136 #define TIMER                   0x0110  /* timer event, passed on to all queues */
00137 #define TIMER0                  0x0111  /* timer event, slot for internal use */
00138 #define TIMER1                  0x0112  /* timer event, slot for internal use */
00139 #define TIMER2                  0x0113  /* timer event, slot for internal use */
00140 #define TIMERJOBS               0x0114  /* timer event, jobs system */
00141 #define TIMERAUTOSAVE   0x0115  /* timer event, autosave */
00142 #define TIMERREPORT             0x0116  /* timer event, reports */
00143 #define TIMERF                  0x011F  /* last timer */
00144 
00145 /* test whether the event is timer event */
00146 #define ISTIMER(event)  (event >= TIMER && event <= TIMERF)
00147 
00148 
00149 /* standard keyboard */
00150 #define AKEY            'a'
00151 #define BKEY            'b'
00152 #define CKEY            'c'
00153 #define DKEY            'd'
00154 #define EKEY            'e'
00155 #define FKEY            'f'
00156 #define GKEY            'g'
00157 #define HKEY            'h'
00158 #define IKEY            'i'
00159 #define JKEY            'j'
00160 #define KKEY            'k'
00161 #define LKEY            'l'
00162 #define MKEY            'm'
00163 #define NKEY            'n'
00164 #define OKEY            'o'
00165 #define PKEY            'p'
00166 #define QKEY            'q'
00167 #define RKEY            'r'
00168 #define SKEY            's'
00169 #define TKEY            't'
00170 #define UKEY            'u'
00171 #define VKEY            'v'
00172 #define WKEY            'w'
00173 #define XKEY            'x'
00174 #define YKEY            'y'
00175 #define ZKEY            'z'
00176 
00177 #define ZEROKEY         '0'
00178 #define ONEKEY          '1'
00179 #define TWOKEY          '2'
00180 #define THREEKEY        '3'
00181 #define FOURKEY         '4'
00182 #define FIVEKEY         '5'
00183 #define SIXKEY          '6'
00184 #define SEVENKEY        '7'
00185 #define EIGHTKEY        '8'
00186 #define NINEKEY         '9'
00187 
00188 #define CAPSLOCKKEY             211
00189 
00190 #define LEFTCTRLKEY             212
00191 #define LEFTALTKEY              213
00192 #define RIGHTALTKEY     214
00193 #define RIGHTCTRLKEY    215
00194 #define RIGHTSHIFTKEY   216
00195 #define LEFTSHIFTKEY    217
00196 
00197 #define ESCKEY                  218
00198 #define TABKEY                  219
00199 #define RETKEY                  220
00200 #define SPACEKEY                221
00201 #define LINEFEEDKEY             222
00202 #define BACKSPACEKEY    223
00203 #define DELKEY                  224
00204 #define SEMICOLONKEY    225
00205 #define PERIODKEY               226
00206 #define COMMAKEY                227
00207 #define QUOTEKEY                228
00208 #define ACCENTGRAVEKEY  229
00209 #define MINUSKEY                230
00210 #define SLASHKEY                232
00211 #define BACKSLASHKEY    233
00212 #define EQUALKEY                234
00213 #define LEFTBRACKETKEY  235
00214 #define RIGHTBRACKETKEY 236
00215 
00216 #define LEFTARROWKEY    137
00217 #define DOWNARROWKEY    138
00218 #define RIGHTARROWKEY   139
00219 #define UPARROWKEY              140
00220 
00221 #define PAD0                    150
00222 #define PAD1                    151
00223 #define PAD2                    152
00224 #define PAD3                    153
00225 #define PAD4                    154
00226 #define PAD5                    155
00227 #define PAD6                    156
00228 #define PAD7                    157
00229 #define PAD8                    158
00230 #define PAD9                    159
00231 
00232 
00233 #define PADPERIOD               199
00234 #define PADSLASHKEY     161
00235 #define PADASTERKEY     160
00236 
00237 #define PADMINUS                162
00238 #define PADENTER                163
00239 #define PADPLUSKEY              164
00240 
00241 #define F1KEY           300
00242 #define F2KEY           301
00243 #define F3KEY           302
00244 #define F4KEY           303
00245 #define F5KEY           304
00246 #define F6KEY           305
00247 #define F7KEY           306
00248 #define F8KEY           307
00249 #define F9KEY           308
00250 #define F10KEY          309
00251 #define F11KEY          310
00252 #define F12KEY          311
00253 #define F13KEY          312
00254 #define F14KEY          313
00255 #define F15KEY          314
00256 #define F16KEY          315
00257 #define F17KEY          316
00258 #define F18KEY          317
00259 #define F19KEY          318
00260 
00261 #define PAUSEKEY        165
00262 #define INSERTKEY       166
00263 #define HOMEKEY         167
00264 #define PAGEUPKEY       168
00265 #define PAGEDOWNKEY     169
00266 #define ENDKEY          170
00267 
00268 #define UNKNOWNKEY      171
00269 #define OSKEY           172
00270 #define GRLESSKEY       173
00271 
00272 // XXX: are these codes ok?
00273 #define MEDIAPLAY       174
00274 #define MEDIASTOP       175
00275 #define MEDIAFIRST      176
00276 #define MEDIALAST       177
00277 
00278 /* for event checks */
00279         /* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
00280 #define ISTEXTINPUT(event)      (event >=' ' && event <=255)
00281 
00282         /* test whether the event is a key on the keyboard */
00283 #define ISKEYBOARD(event)       (event >=' ' && event <=320)
00284 
00285         /* test whether the event is a modifier key */
00286 #define ISKEYMODIFIER(event)    ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY)
00287 
00288         /* test whether the event is a mouse button */
00289 #define ISMOUSE(event)  (event >= LEFTMOUSE && event <= MOUSEROTATE)
00290 
00291         /* test whether the event is tweak event */
00292 #define ISTWEAK(event)  (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
00293 
00294         /* test whether the event is a NDOF event */
00295 #define ISNDOF(event)   (event >= NDOF_MOTION && event < NDOF_LAST)
00296 
00297 /* test whether event type is acceptable as hotkey, excluding modifiers */
00298 #define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event) || ISNDOF(event)) && event!=ESCKEY && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
00299 
00300 /* **************** BLENDER GESTURE EVENTS (0x5000) **************** */
00301 
00302 #define EVT_ACTIONZONE_AREA             20480
00303 #define EVT_ACTIONZONE_REGION   20481
00304 
00305                 /* tweak events, for L M R mousebuttons */
00306 #define EVT_TWEAK_L             20482
00307 #define EVT_TWEAK_M             20483
00308 #define EVT_TWEAK_R             20484
00309                 /* tweak events for action or select mousebutton */
00310 #define EVT_TWEAK_A             20485
00311 #define EVT_TWEAK_S             20486
00312 
00313 #define EVT_GESTURE             20496
00314 
00315 /* value of tweaks and line gestures, note, KM_ANY (-1) works for this case too */
00316 #define EVT_GESTURE_N           1
00317 #define EVT_GESTURE_NE          2
00318 #define EVT_GESTURE_E           3
00319 #define EVT_GESTURE_SE          4
00320 #define EVT_GESTURE_S           5
00321 #define EVT_GESTURE_SW          6
00322 #define EVT_GESTURE_W           7
00323 #define EVT_GESTURE_NW          8
00324 /* value of corner gestures */
00325 #define EVT_GESTURE_N_E         9
00326 #define EVT_GESTURE_N_W         10
00327 #define EVT_GESTURE_E_N         11
00328 #define EVT_GESTURE_E_S         12
00329 #define EVT_GESTURE_S_E         13
00330 #define EVT_GESTURE_S_W         14
00331 #define EVT_GESTURE_W_S         15
00332 #define EVT_GESTURE_W_N         16
00333 
00334 /* **************** OTHER BLENDER EVENTS ********************* */
00335 
00336 /* event->type */
00337 #define EVT_FILESELECT  0x5020
00338 
00339 /* event->val */
00340 #define EVT_FILESELECT_OPEN                                     1
00341 #define EVT_FILESELECT_FULL_OPEN                        2
00342 #define EVT_FILESELECT_EXEC                                     3
00343 #define EVT_FILESELECT_CANCEL                           4
00344 #define EVT_FILESELECT_EXTERNAL_CANCEL          5
00345 
00346 /* event->type */
00347 #define EVT_BUT_OPEN    0x5021
00348 #define EVT_MODAL_MAP   0x5022
00349 #define EVT_DROP                0x5023
00350 #define EVT_BUT_CANCEL  0x5024
00351 
00352 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
00353 #define GESTURE_MODAL_CANCEL            1
00354 #define GESTURE_MODAL_CONFIRM           2
00355 
00356 #define GESTURE_MODAL_SELECT            3
00357 #define GESTURE_MODAL_DESELECT          4
00358 
00359 #define GESTURE_MODAL_NOP                       5 /* circle select when no mouse button is pressed */
00360 
00361 #define GESTURE_MODAL_CIRCLE_ADD        6 /* circle sel: larger brush */
00362 #define GESTURE_MODAL_CIRCLE_SUB        7 /* circle sel: smaller brush */
00363 
00364 #define GESTURE_MODAL_BEGIN                     8 /* border select/straight line, activate, use release to detect which button */
00365 
00366 #define GESTURE_MODAL_IN                        9
00367 #define GESTURE_MODAL_OUT                       10
00368 
00369 
00370 #endif  /* WM_EVENT_TYPES_H */
00371