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
45 /* context to call operator in for WM_operator_name_call */
48 WM_OP_INVOKE_REGION_WIN,
52 WM_OP_EXEC_REGION_WIN,
57 /* ************** wmEvent ************************ */
59 /* each event should have full modifier state */
60 /* event comes from eventmanager and from keymap */
61 typedef struct wmEvent {
62 struct wmEvent *next, *prev;
64 short type; /* event code itself (short, is also in keymap) */
65 short val; /* press, release, scrollvalue */
66 short x, y; /* mouse pointer position */
67 short prevx, prevy; /* previous mouse pointer position */
68 short unicode; /* future, ghost? */
69 char ascii; /* from ghost */
73 short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
74 short keymodifier; /* rawkey modifier */
76 /* keymap item, set by handler (weak?) */
77 const char *keymap_idname;
80 short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */
81 void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
87 /* ************** wmKeyMap ************************ */
94 /* means modifier should be pressed 2nd */
106 /* ************** UI Handler ***************** */
108 #define WM_UI_HANDLER_CONTINUE 0
109 #define WM_UI_HANDLER_BREAK 1
111 typedef int (*wmUIHandlerFunc)(struct bContext *C, struct wmEvent *event, void *userdata);
112 typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
114 /* ************** Notifiers ****************** */
116 typedef struct wmNotifier {
117 struct wmNotifier *prev, *next;
119 struct wmWindowManager *wm;
120 struct wmWindow *window;
123 unsigned int category, data, subtype, action;
134 0x0000FF00; data subtype (unused?)
139 #define NOTE_CATEGORY 0xFF000000
140 #define NC_WINDOW (1<<24)
141 #define NC_SCREEN (2<<24)
142 #define NC_SCENE (3<<24)
143 #define NC_OBJECT (4<<24)
144 #define NC_MATERIAL (5<<24)
145 #define NC_TEXTURE (6<<24)
146 #define NC_LAMP (7<<24)
147 #define NC_GROUP (8<<24)
149 /* data type, 256 entries is enough, it can overlap */
150 #define NOTE_DATA 0x00FF0000
153 #define ND_MARKERS (2<<16)
154 #define ND_FRAME (3<<16)
155 #define ND_RENDER_OPTIONS (4<<16)
156 #define ND_NODES (5<<16)
157 #define ND_SEQUENCER (6<<16)
158 #define ND_OB_ACTIVE (7<<16)
159 #define ND_OB_SELECT (8<<16)
160 #define ND_MODE (9<<16)
163 #define ND_TRANSFORM (16<<16)
164 #define ND_OB_SHADING (17<<16)
165 #define ND_POSE (18<<16)
166 #define ND_BONE_ACTIVE (19<<16)
167 #define ND_BONE_SELECT (20<<16)
168 #define ND_GEOM_SELECT (21<<16)
169 #define ND_DRAW (22<<16)
170 #define ND_MODIFIER (23<<16)
173 #define ND_SHADING (30<<16)
174 #define ND_SHADING_DRAW (31<<16)
177 #define ND_LIGHTING (44<<16)
178 #define ND_LIGHTING_DRAW (45<<16)
179 #define ND_SKY (46<<16)
181 /* subtype, 256 entries too */
182 #define NOTE_SUBTYPE 0x0000FF00
184 /* subtype scene mode */
185 #define NS_MODE_OBJECT (1<<8)
187 #define NS_EDITMODE_MESH (2<<8)
188 #define NS_EDITMODE_CURVE (3<<8)
189 #define NS_EDITMODE_SURFACE (4<<8)
190 #define NS_EDITMODE_TEXT (5<<8)
191 #define NS_EDITMODE_MBALL (6<<8)
192 #define NS_EDITMODE_LATTICE (7<<8)
193 #define NS_EDITMODE_ARMATURE (8<<8)
196 /* action classification */
197 #define NOTE_ACTION (0x000000FF)
199 #define NA_EVALUATED 2
204 /* ************** Gesture Manager data ************** */
206 /* wmGesture->type */
207 #define WM_GESTURE_TWEAK 0
208 #define WM_GESTURE_LINE 1
209 #define WM_GESTURE_RECT 2
210 #define WM_GESTURE_CROSS_RECT 3
211 #define WM_GESTURE_LASSO 4
212 #define WM_GESTURE_CIRCLE 5
214 /* wmGesture is registered to window listbase, handled by operator callbacks */
215 typedef struct wmGesture {
216 struct wmGesture *next, *prev;
217 int event_type; /* event->type */
218 int mode; /* for modal callback */
219 int type; /* gesture type define */
220 int swinid; /* initial subwindow id where it started */
221 int points; /* optional, amount of points stored */
224 /* customdata for border is a recti */
225 /* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
226 /* customdata for lasso is short array */
230 /* ************** custom wmEvent data ************** */
235 typedef struct wmTabletData {
236 int Active; /* 0=None, 1=Stylus, 2=Eraser */
237 float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
238 float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
239 float Ytilt; /* as above */
242 typedef struct wmTimer {
243 struct wmTimer *next, *prev;
244 double timestep; /* set by timer user */
245 int event_type; /* set by timer user */
247 double duration; /* total running time in seconds */
248 double delta; /* time since previous step in seconds */
250 double ltime; /* internal, last time timer was activated */
251 int sleep; /* internal, put timers to sleep when needed */
255 /* ****************** Messages ********************* */
260 WM_LOG_WARNING = 2000,
261 WM_ERROR_UNDEFINED = 3000,
262 WM_ERROR_INVALID_INPUT = 3001,
263 WM_ERROR_INVALID_CONTEXT = 3002,
264 WM_ERROR_OUT_OF_MEMORY = 3003
267 typedef struct wmReport {
268 struct wmReport *next, *prev;
274 /* *************** migrated stuff, clean later? ******************************** */
276 typedef struct RecentFile {
277 struct RecentFile *next, *prev;
282 #endif /* WM_TYPES_H */