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 *****
33 struct wmWindowManager;
35 /* exported types for WM */
37 #include "wm_cursors.h"
38 #include "wm_event_types.h"
40 /* ************** wmOperatorType ************************ */
43 #define OPTYPE_REGISTER 1
46 /* context to call operator in for WM_operator_name_call */
47 /* rna_ui.c contains EnumPropertyItem's of these, keep in sync */
49 /* if there's invoke, call it, otherwise exec */
51 WM_OP_INVOKE_REGION_WIN,
56 WM_OP_EXEC_REGION_WIN,
61 /* ************** wmEvent ************************ */
63 /* each event should have full modifier state */
64 /* event comes from eventmanager and from keymap */
65 typedef struct wmEvent {
66 struct wmEvent *next, *prev;
68 short type; /* event code itself (short, is also in keymap) */
69 short val; /* press, release, scrollvalue */
70 short x, y; /* mouse pointer position, screen coord */
71 short mval[2]; /* region mouse position, name convention pre 2.5 :) */
72 short prevx, prevy; /* previous mouse pointer position */
73 short unicode; /* future, ghost? */
74 char ascii; /* from ghost */
78 short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
79 short keymodifier; /* rawkey modifier */
81 /* keymap item, set by handler (weak?) */
82 const char *keymap_idname;
85 short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */
86 void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
92 /* ************** wmKeyMap ************************ */
99 /* means modifier should be pressed 2nd */
103 #define KM_OSKEY2 128
105 /* type: defined in wm_event_types.c */
106 #define KM_TEXTINPUT -2
115 /* ************** UI Handler ***************** */
117 #define WM_UI_HANDLER_CONTINUE 0
118 #define WM_UI_HANDLER_BREAK 1
120 typedef int (*wmUIHandlerFunc)(struct bContext *C, struct wmEvent *event, void *userdata);
121 typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
123 /* ************** Notifiers ****************** */
125 typedef struct wmNotifier {
126 struct wmNotifier *next, *prev;
128 struct wmWindowManager *wm;
129 struct wmWindow *window;
132 unsigned int category, data, subtype, action;
143 0x0000FF00; data subtype (unused?)
148 #define NOTE_CATEGORY 0xFF000000
149 #define NC_WM (1<<24)
150 #define NC_WINDOW (2<<24)
151 #define NC_SCREEN (3<<24)
152 #define NC_SCENE (4<<24)
153 #define NC_OBJECT (5<<24)
154 #define NC_MATERIAL (6<<24)
155 #define NC_TEXTURE (7<<24)
156 #define NC_LAMP (8<<24)
157 #define NC_GROUP (9<<24)
158 #define NC_IMAGE (10<<24)
159 #define NC_BRUSH (11<<24)
160 #define NC_TEXT (12<<24)
161 #define NC_WORLD (13<<24)
163 /* data type, 256 entries is enough, it can overlap */
164 #define NOTE_DATA 0x00FF0000
166 /* NC_WM windowmanager */
167 #define ND_FILEREAD (1<<16)
168 #define ND_FILESAVE (2<<16)
169 #define ND_DATACHANGED (3<<16)
171 /* NC_SCREEN screen */
172 #define ND_SCREENBROWSE (1<<16)
173 #define ND_SCREENCAST (2<<16)
174 #define ND_ANIMPLAY (3<<16)
177 #define ND_SCENEBROWSE (1<<16)
178 #define ND_MARKERS (2<<16)
179 #define ND_FRAME (3<<16)
180 #define ND_RENDER_OPTIONS (4<<16)
181 #define ND_NODES (5<<16)
182 #define ND_SEQUENCER (6<<16)
183 #define ND_OB_ACTIVE (7<<16)
184 #define ND_OB_SELECT (8<<16)
185 #define ND_MODE (9<<16)
186 #define ND_RENDER_RESULT (10<<16)
187 #define ND_COMPO_RESULT (11<<16)
188 #define ND_KEYINGSET (12<<16)
190 /* NC_OBJECT Object */
191 #define ND_TRANSFORM (16<<16)
192 #define ND_OB_SHADING (17<<16)
193 #define ND_POSE (18<<16)
194 #define ND_BONE_ACTIVE (19<<16)
195 #define ND_BONE_SELECT (20<<16)
196 #define ND_GEOM_SELECT (21<<16)
197 #define ND_DRAW (22<<16)
198 #define ND_MODIFIER (23<<16)
199 #define ND_KEYS (24<<16)
200 #define ND_GEOM_DATA (25<<16)
201 #define ND_CONSTRAINT (26<<16)
202 #define ND_PARTICLE (27<<16)
204 /* NC_MATERIAL Material */
205 #define ND_SHADING (30<<16)
206 #define ND_SHADING_DRAW (31<<16)
209 #define ND_LIGHTING (44<<16)
210 #define ND_LIGHTING_DRAW (45<<16)
211 #define ND_SKY (46<<16)
214 #define ND_CURSOR (50<<16)
215 #define ND_DISPLAY (51<<16)
217 /* subtype, 256 entries too */
218 #define NOTE_SUBTYPE 0x0000FF00
220 /* subtype scene mode */
221 #define NS_MODE_OBJECT (1<<8)
223 #define NS_EDITMODE_MESH (2<<8)
224 #define NS_EDITMODE_CURVE (3<<8)
225 #define NS_EDITMODE_SURFACE (4<<8)
226 #define NS_EDITMODE_TEXT (5<<8)
227 #define NS_EDITMODE_MBALL (6<<8)
228 #define NS_EDITMODE_LATTICE (7<<8)
229 #define NS_EDITMODE_ARMATURE (8<<8)
230 #define NS_MODE_POSE (9<<8)
231 #define NS_MODE_PARTICLE (10<<8)
234 /* action classification */
235 #define NOTE_ACTION (0x000000FF)
237 #define NA_EVALUATED 2
242 /* ************** Gesture Manager data ************** */
244 /* wmGesture->type */
245 #define WM_GESTURE_TWEAK 0
246 #define WM_GESTURE_LINES 1
247 #define WM_GESTURE_RECT 2
248 #define WM_GESTURE_CROSS_RECT 3
249 #define WM_GESTURE_LASSO 4
250 #define WM_GESTURE_CIRCLE 5
252 /* wmGesture is registered to window listbase, handled by operator callbacks */
253 /* tweak gesture is builtin feature */
254 typedef struct wmGesture {
255 struct wmGesture *next, *prev;
256 int event_type; /* event->type */
257 int mode; /* for modal callback */
258 int type; /* gesture type define */
259 int swinid; /* initial subwindow id where it started */
260 int points; /* optional, amount of points stored */
263 /* customdata for border is a recti */
264 /* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
265 /* customdata for lasso is short array */
268 /* ************** custom wmEvent data ************** */
273 typedef struct wmTabletData {
274 int Active; /* 0=None, 1=Stylus, 2=Eraser */
275 float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
276 float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
277 float Ytilt; /* as above */
280 typedef struct wmTimer {
281 struct wmTimer *next, *prev;
282 double timestep; /* set by timer user */
283 int event_type; /* set by timer user, goes to event system */
284 void *customdata; /* set by timer user, to allow custom values */
286 double duration; /* total running time in seconds */
287 double delta; /* time since previous step in seconds */
289 double ltime; /* internal, last time timer was activated */
290 int sleep; /* internal, put timers to sleep when needed */
294 /* ****************** Messages ********************* */
299 WM_LOG_WARNING = 2000,
300 WM_ERROR_UNDEFINED = 3000,
301 WM_ERROR_INVALID_INPUT = 3001,
302 WM_ERROR_INVALID_CONTEXT = 3002,
303 WM_ERROR_OUT_OF_MEMORY = 3003
306 typedef struct wmReport {
307 struct wmReport *next, *prev;
313 /* *************** migrated stuff, clean later? ******************************** */
315 typedef struct RecentFile {
316 struct RecentFile *next, *prev;
321 #endif /* WM_TYPES_H */