3 * ***** BEGIN GPL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20 * All rights reserved.
22 * The Original Code is: all of this file.
24 * Contributor(s): none yet.
26 * ***** END GPL LICENSE BLOCK *****
29 /** \file ghost/GHOST_Types.h
34 #ifndef _GHOST_TYPES_H_
35 #define _GHOST_TYPES_H_
37 #ifdef WITH_CXX_GUARDEDALLOC
38 #include "MEM_guardedalloc.h"
41 #define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
43 typedef char GHOST_TInt8;
44 typedef unsigned char GHOST_TUns8;
45 typedef short GHOST_TInt16;
46 typedef unsigned short GHOST_TUns16;
47 typedef int GHOST_TInt32;
48 typedef unsigned int GHOST_TUns32;
50 #if defined(WIN32) && !defined(FREE_WINDOWS)
51 typedef __int64 GHOST_TInt64;
52 typedef unsigned __int64 GHOST_TUns64;
54 typedef long long GHOST_TInt64;
55 typedef unsigned long long GHOST_TUns64;
58 typedef void* GHOST_TUserDataPtr;
66 /* Xtilt and Ytilt represent how much the pen is tilted away from
67 * vertically upright in either the X or Y direction, with X and Y the
68 * axes of the tablet surface.
69 * In other words, Xtilt and Ytilt are components of a vector created by projecting
70 * the pen's angle in 3D space vertically downwards on to the XY plane
74 GHOST_kTabletModeNone = 0,
75 GHOST_kTabletModeStylus,
76 GHOST_kTabletModeEraser
79 typedef struct GHOST_TabletData {
80 GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */
81 float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
82 float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
83 float Ytilt; /* as above */
88 GHOST_kNotVisible = 0,
89 GHOST_kPartiallyVisible,
95 GHOST_kFireTimeNever = 0xFFFFFFFF
96 } GHOST_TFireTimeConstant;
99 GHOST_kModifierKeyLeftShift = 0,
100 GHOST_kModifierKeyRightShift,
101 GHOST_kModifierKeyLeftAlt,
102 GHOST_kModifierKeyRightAlt,
103 GHOST_kModifierKeyLeftControl,
104 GHOST_kModifierKeyRightControl,
105 GHOST_kModifierKeyOS,
106 GHOST_kModifierKeyNumMasks
107 } GHOST_TModifierKeyMask;
111 GHOST_kWindowStateNormal = 0,
112 GHOST_kWindowStateMaximized,
113 GHOST_kWindowStateMinimized,
114 GHOST_kWindowStateFullScreen,
115 GHOST_kWindowStateEmbedded,
116 GHOST_kWindowState8Normal = 8,
117 GHOST_kWindowState8Maximized,
118 GHOST_kWindowState8Minimized,
119 GHOST_kWindowState8FullScreen,
120 GHOST_kWindowStateModified,
121 GHOST_kWindowStateUnModified
122 } GHOST_TWindowState;
125 /** Constants for the answer to the blender exit request */
127 GHOST_kExitCancel = 0,
129 } GHOST_TExitRequestResponse;
132 GHOST_kWindowOrderTop = 0,
133 GHOST_kWindowOrderBottom
134 } GHOST_TWindowOrder;
138 GHOST_kDrawingContextTypeNone = 0,
139 GHOST_kDrawingContextTypeOpenGL
140 } GHOST_TDrawingContextType;
144 GHOST_kButtonMaskLeft = 0,
145 GHOST_kButtonMaskMiddle,
146 GHOST_kButtonMaskRight,
147 GHOST_kButtonMaskButton4,
148 GHOST_kButtonMaskButton5,
149 GHOST_kButtonNumMasks
154 GHOST_kEventUnknown = 0,
156 GHOST_kEventCursorMove, /// Mouse move event
157 GHOST_kEventButtonDown, /// Mouse button event
158 GHOST_kEventButtonUp, /// Mouse button event
159 GHOST_kEventWheel, /// Mouse wheel event
160 GHOST_kEventTrackpad, /// Trackpad event
162 GHOST_kEventNDOFMotion, /// N degree of freedom device motion event
163 GHOST_kEventNDOFButton, /// N degree of freedom device button event
167 // GHOST_kEventKeyAuto,
171 GHOST_kEventWindowClose,
172 GHOST_kEventWindowActivate,
173 GHOST_kEventWindowDeactivate,
174 GHOST_kEventWindowUpdate,
175 GHOST_kEventWindowSize,
176 GHOST_kEventWindowMove,
178 GHOST_kEventDraggingEntered,
179 GHOST_kEventDraggingUpdated,
180 GHOST_kEventDraggingExited,
181 GHOST_kEventDraggingDropDone,
183 GHOST_kEventOpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup
192 GHOST_kStandardCursorFirstCursor = 0,
193 GHOST_kStandardCursorDefault = 0,
194 GHOST_kStandardCursorRightArrow,
195 GHOST_kStandardCursorLeftArrow,
196 GHOST_kStandardCursorInfo,
197 GHOST_kStandardCursorDestroy,
198 GHOST_kStandardCursorHelp,
199 GHOST_kStandardCursorCycle,
200 GHOST_kStandardCursorSpray,
201 GHOST_kStandardCursorWait,
202 GHOST_kStandardCursorText,
203 GHOST_kStandardCursorCrosshair,
204 GHOST_kStandardCursorUpDown,
205 GHOST_kStandardCursorLeftRight,
206 GHOST_kStandardCursorTopSide,
207 GHOST_kStandardCursorBottomSide,
208 GHOST_kStandardCursorLeftSide,
209 GHOST_kStandardCursorRightSide,
210 GHOST_kStandardCursorTopLeftCorner,
211 GHOST_kStandardCursorTopRightCorner,
212 GHOST_kStandardCursorBottomRightCorner,
213 GHOST_kStandardCursorBottomLeftCorner,
214 GHOST_kStandardCursorCopy,
215 GHOST_kStandardCursorCustom,
216 GHOST_kStandardCursorPencil,
218 GHOST_kStandardCursorNumCursors
219 } GHOST_TStandardCursor;
223 GHOST_kKeyUnknown = -1,
228 GHOST_kKeyEnter = 0x0D,
230 GHOST_kKeyEsc = 0x1B,
231 GHOST_kKeySpace = ' ',
232 GHOST_kKeyQuote = 0x27,
233 GHOST_kKeyComma = ',',
234 GHOST_kKeyMinus = '-',
235 GHOST_kKeyPeriod = '.',
236 GHOST_kKeySlash = '/',
250 GHOST_kKeySemicolon = ';',
251 GHOST_kKeyEqual = '=',
281 GHOST_kKeyLeftBracket = '[',
282 GHOST_kKeyRightBracket = ']',
283 GHOST_kKeyBackslash = 0x5C,
284 GHOST_kKeyAccentGrave = '`',
287 GHOST_kKeyLeftShift = 0x100,
288 GHOST_kKeyRightShift,
289 GHOST_kKeyLeftControl,
290 GHOST_kKeyRightControl,
293 GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
294 GHOST_kKeyGrLess , // German PC only!
298 GHOST_kKeyScrollLock,
301 GHOST_kKeyRightArrow,
305 GHOST_kKeyPrintScreen,
326 GHOST_kKeyNumpadPeriod,
327 GHOST_kKeyNumpadEnter,
328 GHOST_kKeyNumpadPlus,
329 GHOST_kKeyNumpadMinus,
330 GHOST_kKeyNumpadAsterisk,
331 GHOST_kKeyNumpadSlash,
359 // Multimedia keypad buttons
362 GHOST_kKeyMediaFirst,
367 GHOST_kGrabDisable = 0, /* grab not set */
368 GHOST_kGrabNormal, /* no cursor adjustments */
369 GHOST_kGrabWrap, /* wrap the mouse location to prevent limiting screen bounds */
370 GHOST_kGrabHide, /* hide the mouse while grabbing and restore the original location on release (numbuts) */
371 } GHOST_TGrabCursorMode;
373 typedef void* GHOST_TEventDataPtr;
376 /** The x-coordinate of the cursor position. */
378 /** The y-coordinate of the cursor position. */
380 } GHOST_TEventCursorData;
383 /** The mask of the mouse button. */
384 GHOST_TButtonMask button;
385 } GHOST_TEventButtonData;
388 /** Displacement of a mouse wheel. */
390 } GHOST_TEventWheelData;
393 GHOST_kTrackpadEventUnknown =0,
394 GHOST_kTrackpadEventScroll,
395 GHOST_kTrackpadEventRotate,
396 GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
397 GHOST_kTrackpadEventMagnify
398 } GHOST_TTrackpadEventSubTypes;
402 /** The event subtype */
403 GHOST_TTrackpadEventSubTypes subtype;
404 /** The x-location of the trackpad event */
406 /** The y-location of the trackpad event */
408 /** The x-delta or value of the trackpad event */
410 /** The y-delta (currently only for scroll subtype) of the trackpad event */
412 } GHOST_TEventTrackpadData;
416 GHOST_kDragnDropTypeUnknown =0,
417 GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
418 GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
419 GHOST_kDragnDropTypeBitmap /*Bitmap image data */
420 } GHOST_TDragnDropTypes;
423 /** The x-coordinate of the cursor position. */
425 /** The y-coordinate of the cursor position. */
427 /** The dropped item type */
428 GHOST_TDragnDropTypes dataType;
429 /** The "dropped content" */
430 GHOST_TEventDataPtr data;
431 } GHOST_TEventDragnDropData;
435 GHOST_TUns8 **strings;
436 } GHOST_TStringArray;
447 /** N-degree of freedom device data v3 [GSoC 2010] */
448 // Each component normally ranges from -1 to +1, but can exceed that.
449 // These use blender standard view coordinates, with positive rotations being CCW about the axis.
450 float tx, ty, tz; // translation
451 float rx, ry, rz; // rotation:
452 // axis = (rx,ry,rz).normalized
453 // amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
454 float dt; // time since previous NDOF Motion event
455 GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers)
456 } GHOST_TEventNDOFMotionData;
458 typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction;
459 // good for mouse or other buttons too, hmmm?
462 GHOST_TButtonAction action;
464 } GHOST_TEventNDOFButtonData;
469 /** The ascii code for the key event ('\0' if none). */
471 } GHOST_TEventKeyData;
474 /** Number of pixels on a line. */
475 GHOST_TUns32 xPixels;
476 /** Number of lines. */
477 GHOST_TUns32 yPixels;
478 /** Numberof bits per pixel. */
480 /** Refresh rate (in Hertz). */
481 GHOST_TUns32 frequency;
482 } GHOST_DisplaySetting;
486 typedef long GHOST_TEmbedderWindowID;
490 // I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h
491 typedef int GHOST_TEmbedderWindowID;
495 * A timer task callback routine.
496 * @param task The timer task object.
497 * @param time The current time.
500 class GHOST_ITimerTask;
501 typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask* task, GHOST_TUns64 time);
503 struct GHOST_TimerTaskHandle__;
504 typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__* task, GHOST_TUns64 time);
507 #endif // _GHOST_TYPES_H_