4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2007 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
34 /* exported types for WM */
36 #include "wm_cursors.h"
37 #include "wm_event_types.h"
39 /* ************** wmOperatorType ************************ */
42 #define OPTYPE_REGISTER 1
44 /* context to call operator in for WM_operator_name_call */
47 WM_OP_INVOKE_REGION_WIN,
51 WM_OP_EXEC_REGION_WIN,
56 /* ************** wmEvent ************************ */
58 /* each event should have full modifier state */
59 /* event comes from eventmanager and from keymap */
60 typedef struct wmEvent {
61 struct wmEvent *next, *prev;
63 short type; /* event code itself (short, is also in keymap) */
64 short val; /* press, release, scrollvalue */
65 short x, y; /* mouse pointer position */
66 short prevx, prevy; /* previous mouse pointer position */
67 short unicode; /* future, ghost? */
68 char ascii; /* from ghost */
72 short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
73 short keymodifier; /* rawkey modifier */
75 /* keymap item, set by handler (weak?) */
76 const char *keymap_idname;
79 short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */
80 void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
86 /* ************** wmKeyMap ************************ */
93 /* means modifier should be pressed 2nd */
104 /* ************** UI Handler ***************** */
106 #define WM_UI_HANDLER_CONTINUE 0
107 #define WM_UI_HANDLER_BREAK 1
109 typedef int (*wmUIHandlerFunc)(struct bContext *C, struct wmEvent *event, void *userdata);
110 typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
112 /* ************** Notifiers ****************** */
114 typedef struct wmNotifier {
115 struct wmNotifier *prev, *next;
117 struct wmWindow *window;
120 unsigned int category, data, subtype, action;
131 0x0000FF00; data subtype (unused?)
136 #define NOTE_CATEGORY 0xFF000000
137 #define NC_WINDOW (1<<24)
138 #define NC_SCREEN (2<<24)
139 #define NC_SCENE (3<<24)
140 #define NC_OBJECT (4<<24)
141 #define NC_MATERIAL (5<<24)
142 #define NC_TEXTURE (6<<24)
144 /* data type, 256 entries is enough, it can overlap */
145 #define NOTE_DATA 0x00FF0000
147 /* Scene, node users level */
148 #define ND_MARKERS (2<<16)
149 #define ND_FRAME (3<<16)
150 #define ND_RENDER_OPTIONS (4<<16)
151 #define ND_NODES (5<<16)
152 #define ND_SEQUENCER (6<<16)
154 #define ND_TRANSFORM (16<<16)
155 #define ND_SHADING (17<<16)
157 /* subtype, 256 entries too */
158 #define NOTE_SUBTYPE 0x0000FF00
160 /* action classification */
161 #define NOTE_ACTION (0x000000FF)
163 #define NA_EVALUATED 2
168 /* ************** Gesture Manager data ************** */
170 /* wmGesture->type */
171 #define WM_GESTURE_TWEAK 0
172 #define WM_GESTURE_LINE 1
173 #define WM_GESTURE_RECT 2
174 #define WM_GESTURE_CROSS_RECT 3
175 #define WM_GESTURE_LASSO 4
176 #define WM_GESTURE_CIRCLE 5
178 /* wmGesture is registered to window listbase, handled by operator callbacks */
179 typedef struct wmGesture {
180 struct wmGesture *next, *prev;
181 int event_type; /* event->type */
182 int mode; /* for modal callback */
183 int type; /* gesture type define */
184 int swinid; /* initial subwindow id where it started */
187 /* customdata for border is a recti */
188 /* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
193 /* ************** custom wmEvent data ************** */
198 typedef struct wmTabletData {
199 int Active; /* 0=None, 1=Stylus, 2=Eraser */
200 float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
201 float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
202 float Ytilt; /* as above */
205 typedef struct wmTimer {
206 struct wmTimer *next, *prev;
207 double timestep; /* set by timer user */
208 int event_type; /* set by timer user */
210 double duration; /* total running time in seconds */
211 double delta; /* time since previous step in seconds */
213 double ltime; /* internal, last time timer was activated */
214 int sleep; /* internal, put timers to sleep when needed */
218 /* ****************** Messages ********************* */
223 WM_LOG_WARNING = 2000,
224 WM_ERROR_UNDEFINED = 3000,
225 WM_ERROR_INVALID_INPUT = 3001,
226 WM_ERROR_INVALID_CONTEXT = 3002,
227 WM_ERROR_OUT_OF_MEMORY = 3003
230 typedef struct wmReport {
231 struct wmReport *next, *prev;
237 /* *************** migrated stuff, clean later? ******************************** */
239 typedef struct RecentFile {
240 struct RecentFile *next, *prev;
245 #endif /* WM_TYPES_H */