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)
148 /* data type, 256 entries is enough, it can overlap */
149 #define NOTE_DATA 0x00FF0000
152 #define ND_MARKERS (2<<16)
153 #define ND_FRAME (3<<16)
154 #define ND_RENDER_OPTIONS (4<<16)
155 #define ND_NODES (5<<16)
156 #define ND_SEQUENCER (6<<16)
157 #define ND_OB_ACTIVE (7<<16)
158 #define ND_OB_SELECT (8<<16)
159 #define ND_MODE (9<<16)
162 #define ND_TRANSFORM (16<<16)
163 #define ND_OB_SHADING (17<<16)
164 #define ND_POSE (18<<16)
165 #define ND_BONE_ACTIVE (19<<16)
166 #define ND_BONE_SELECT (20<<16)
167 #define ND_GEOM_SELECT (21<<16)
168 #define ND_DRAW (22<<16)
171 #define ND_SHADING (30<<16)
172 #define ND_SHADING_DRAW (31<<16)
175 #define ND_LIGHTING (44<<16)
176 #define ND_LIGHTING_DRAW (45<<16)
177 #define ND_SKY (46<<16)
179 /* subtype, 256 entries too */
180 #define NOTE_SUBTYPE 0x0000FF00
182 /* subtype scene mode */
183 #define NS_MODE_OBJECT (1<<8)
185 #define NS_EDITMODE_MESH (2<<8)
186 #define NS_EDITMODE_CURVE (3<<8)
187 #define NS_EDITMODE_SURFACE (4<<8)
188 #define NS_EDITMODE_TEXT (5<<8)
189 #define NS_EDITMODE_MBALL (6<<8)
190 #define NS_EDITMODE_LATTICE (7<<8)
191 #define NS_EDITMODE_ARMATURE (8<<8)
194 /* action classification */
195 #define NOTE_ACTION (0x000000FF)
197 #define NA_EVALUATED 2
202 /* ************** Gesture Manager data ************** */
204 /* wmGesture->type */
205 #define WM_GESTURE_TWEAK 0
206 #define WM_GESTURE_LINE 1
207 #define WM_GESTURE_RECT 2
208 #define WM_GESTURE_CROSS_RECT 3
209 #define WM_GESTURE_LASSO 4
210 #define WM_GESTURE_CIRCLE 5
212 /* wmGesture is registered to window listbase, handled by operator callbacks */
213 typedef struct wmGesture {
214 struct wmGesture *next, *prev;
215 int event_type; /* event->type */
216 int mode; /* for modal callback */
217 int type; /* gesture type define */
218 int swinid; /* initial subwindow id where it started */
219 int points; /* optional, amount of points stored */
222 /* customdata for border is a recti */
223 /* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
224 /* customdata for lasso is short array */
228 /* ************** custom wmEvent data ************** */
233 typedef struct wmTabletData {
234 int Active; /* 0=None, 1=Stylus, 2=Eraser */
235 float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
236 float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
237 float Ytilt; /* as above */
240 typedef struct wmTimer {
241 struct wmTimer *next, *prev;
242 double timestep; /* set by timer user */
243 int event_type; /* set by timer user */
245 double duration; /* total running time in seconds */
246 double delta; /* time since previous step in seconds */
248 double ltime; /* internal, last time timer was activated */
249 int sleep; /* internal, put timers to sleep when needed */
253 /* ****************** Messages ********************* */
258 WM_LOG_WARNING = 2000,
259 WM_ERROR_UNDEFINED = 3000,
260 WM_ERROR_INVALID_INPUT = 3001,
261 WM_ERROR_INVALID_CONTEXT = 3002,
262 WM_ERROR_OUT_OF_MEMORY = 3003
265 typedef struct wmReport {
266 struct wmReport *next, *prev;
272 /* *************** migrated stuff, clean later? ******************************** */
274 typedef struct RecentFile {
275 struct RecentFile *next, *prev;
280 #endif /* WM_TYPES_H */