Blender  V2.59
GHOST_Types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: GHOST_Types.h 38908 2011-08-02 04:28:05Z merwin $
00003  * ***** BEGIN GPL LICENSE BLOCK *****
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software Foundation,
00017  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020  * All rights reserved.
00021  *
00022  * The Original Code is: all of this file.
00023  *
00024  * Contributor(s): none yet.
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 #ifndef _GHOST_TYPES_H_
00035 #define _GHOST_TYPES_H_
00036 
00037 #ifdef WITH_CXX_GUARDEDALLOC
00038 #include "MEM_guardedalloc.h"
00039 #endif
00040 
00041 #define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
00042 
00043 typedef char                            GHOST_TInt8;
00044 typedef unsigned char           GHOST_TUns8;
00045 typedef short                           GHOST_TInt16;
00046 typedef unsigned short          GHOST_TUns16;
00047 typedef int                                     GHOST_TInt32;
00048 typedef unsigned int            GHOST_TUns32;
00049 
00050 #if defined(WIN32) && !defined(FREE_WINDOWS)
00051 typedef __int64                         GHOST_TInt64;
00052 typedef unsigned __int64        GHOST_TUns64;
00053 #else
00054 typedef long long                       GHOST_TInt64;
00055 typedef unsigned long long      GHOST_TUns64;
00056 #endif
00057 
00058 typedef void*                           GHOST_TUserDataPtr;
00059 
00060 typedef enum
00061 {
00062         GHOST_kFailure = 0,
00063         GHOST_kSuccess
00064 } GHOST_TSuccess;
00065 
00066 /* Xtilt and Ytilt represent how much the pen is tilted away from 
00067  * vertically upright in either the X or Y direction, with X and Y the
00068  * axes of the tablet surface.
00069  * In other words, Xtilt and Ytilt are components of a vector created by projecting
00070  * the pen's angle in 3D space vertically downwards on to the XY plane
00071  * --Matt
00072  */
00073 typedef enum {
00074         GHOST_kTabletModeNone = 0,
00075         GHOST_kTabletModeStylus,
00076         GHOST_kTabletModeEraser
00077 } GHOST_TTabletMode;
00078 
00079 typedef struct GHOST_TabletData {
00080         GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */
00081         float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
00082         float Xtilt;    /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
00083         float Ytilt;    /* as above */
00084 } GHOST_TabletData;
00085 
00086 
00087 typedef enum {
00088         GHOST_kNotVisible = 0,
00089         GHOST_kPartiallyVisible,
00090         GHOST_kFullyVisible
00091 } GHOST_TVisibility;
00092 
00093 
00094 typedef enum {
00095         GHOST_kFireTimeNever = 0xFFFFFFFF
00096 } GHOST_TFireTimeConstant;
00097 
00098 typedef enum {
00099     GHOST_kModifierKeyLeftShift = 0,
00100     GHOST_kModifierKeyRightShift,
00101     GHOST_kModifierKeyLeftAlt,
00102     GHOST_kModifierKeyRightAlt,
00103     GHOST_kModifierKeyLeftControl,
00104     GHOST_kModifierKeyRightControl,
00105     GHOST_kModifierKeyOS,
00106     GHOST_kModifierKeyNumMasks
00107 } GHOST_TModifierKeyMask;
00108 
00109 
00110 typedef enum {
00111         GHOST_kWindowStateNormal = 0,
00112         GHOST_kWindowStateMaximized,
00113         GHOST_kWindowStateMinimized,
00114         GHOST_kWindowStateFullScreen,
00115         GHOST_kWindowStateEmbedded,
00116         GHOST_kWindowState8Normal = 8,
00117         GHOST_kWindowState8Maximized,
00118         GHOST_kWindowState8Minimized,
00119         GHOST_kWindowState8FullScreen,
00120         GHOST_kWindowStateModified,
00121         GHOST_kWindowStateUnModified
00122 } GHOST_TWindowState;
00123 
00124 
00126 typedef enum {
00127         GHOST_kExitCancel = 0,
00128         GHOST_kExitNow
00129 } GHOST_TExitRequestResponse;
00130 
00131 typedef enum {
00132         GHOST_kWindowOrderTop = 0,
00133         GHOST_kWindowOrderBottom
00134 } GHOST_TWindowOrder;
00135 
00136 
00137 typedef enum {
00138         GHOST_kDrawingContextTypeNone = 0,
00139         GHOST_kDrawingContextTypeOpenGL
00140 } GHOST_TDrawingContextType;
00141 
00142 
00143 typedef enum {
00144         GHOST_kButtonMaskLeft = 0,
00145         GHOST_kButtonMaskMiddle,
00146         GHOST_kButtonMaskRight,
00147         GHOST_kButtonMaskButton4,
00148         GHOST_kButtonMaskButton5,
00149         GHOST_kButtonNumMasks
00150 } GHOST_TButtonMask;
00151 
00152 
00153 typedef enum {
00154         GHOST_kEventUnknown = 0,
00155 
00156         GHOST_kEventCursorMove,         
00157         GHOST_kEventButtonDown,         
00158         GHOST_kEventButtonUp,           
00159         GHOST_kEventWheel,                      
00160         GHOST_kEventTrackpad,           
00161 
00162         GHOST_kEventNDOFMotion,         
00163         GHOST_kEventNDOFButton,         
00164 
00165         GHOST_kEventKeyDown,
00166         GHOST_kEventKeyUp,
00167 //      GHOST_kEventKeyAuto,
00168 
00169         GHOST_kEventQuit,
00170 
00171         GHOST_kEventWindowClose,
00172         GHOST_kEventWindowActivate,
00173         GHOST_kEventWindowDeactivate,
00174         GHOST_kEventWindowUpdate,
00175         GHOST_kEventWindowSize,
00176         GHOST_kEventWindowMove,
00177         
00178         GHOST_kEventDraggingEntered,
00179         GHOST_kEventDraggingUpdated,
00180         GHOST_kEventDraggingExited,
00181         GHOST_kEventDraggingDropDone,
00182         
00183         GHOST_kEventOpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup
00184 
00185         GHOST_kEventTimer,
00186 
00187         GHOST_kNumEventTypes
00188 } GHOST_TEventType;
00189 
00190 
00191 typedef enum {
00192         GHOST_kStandardCursorFirstCursor = 0,
00193         GHOST_kStandardCursorDefault = 0,
00194         GHOST_kStandardCursorRightArrow,
00195         GHOST_kStandardCursorLeftArrow,
00196         GHOST_kStandardCursorInfo, 
00197         GHOST_kStandardCursorDestroy,
00198         GHOST_kStandardCursorHelp,    
00199         GHOST_kStandardCursorCycle,
00200         GHOST_kStandardCursorSpray,
00201         GHOST_kStandardCursorWait,
00202         GHOST_kStandardCursorText,
00203         GHOST_kStandardCursorCrosshair,
00204         GHOST_kStandardCursorUpDown,
00205         GHOST_kStandardCursorLeftRight,
00206         GHOST_kStandardCursorTopSide,
00207         GHOST_kStandardCursorBottomSide,
00208         GHOST_kStandardCursorLeftSide,
00209         GHOST_kStandardCursorRightSide,
00210         GHOST_kStandardCursorTopLeftCorner,
00211         GHOST_kStandardCursorTopRightCorner,
00212         GHOST_kStandardCursorBottomRightCorner,
00213         GHOST_kStandardCursorBottomLeftCorner,
00214         GHOST_kStandardCursorCopy,
00215         GHOST_kStandardCursorCustom, 
00216         GHOST_kStandardCursorPencil,
00217 
00218         GHOST_kStandardCursorNumCursors
00219 } GHOST_TStandardCursor;
00220 
00221 
00222 typedef enum {
00223         GHOST_kKeyUnknown = -1,
00224         GHOST_kKeyBackSpace,
00225         GHOST_kKeyTab,
00226         GHOST_kKeyLinefeed,
00227         GHOST_kKeyClear,
00228         GHOST_kKeyEnter  = 0x0D,
00229         
00230         GHOST_kKeyEsc    = 0x1B,
00231         GHOST_kKeySpace  = ' ',
00232         GHOST_kKeyQuote  = 0x27,
00233         GHOST_kKeyComma  = ',',
00234         GHOST_kKeyMinus  = '-',
00235         GHOST_kKeyPeriod = '.',
00236         GHOST_kKeySlash  = '/',
00237 
00238         // Number keys
00239         GHOST_kKey0 = '0',
00240         GHOST_kKey1,
00241         GHOST_kKey2,
00242         GHOST_kKey3,
00243         GHOST_kKey4,
00244         GHOST_kKey5,
00245         GHOST_kKey6,
00246         GHOST_kKey7,
00247         GHOST_kKey8,
00248         GHOST_kKey9,
00249 
00250         GHOST_kKeySemicolon = ';',
00251         GHOST_kKeyEqual     = '=',
00252 
00253         // Character keys
00254         GHOST_kKeyA = 'A',
00255         GHOST_kKeyB,
00256         GHOST_kKeyC,
00257         GHOST_kKeyD,
00258         GHOST_kKeyE,
00259         GHOST_kKeyF,
00260         GHOST_kKeyG,
00261         GHOST_kKeyH,
00262         GHOST_kKeyI,
00263         GHOST_kKeyJ,
00264         GHOST_kKeyK,
00265         GHOST_kKeyL,
00266         GHOST_kKeyM,
00267         GHOST_kKeyN,
00268         GHOST_kKeyO,
00269         GHOST_kKeyP,
00270         GHOST_kKeyQ,
00271         GHOST_kKeyR,
00272         GHOST_kKeyS,
00273         GHOST_kKeyT,
00274         GHOST_kKeyU,
00275         GHOST_kKeyV,
00276         GHOST_kKeyW,
00277         GHOST_kKeyX,
00278         GHOST_kKeyY,
00279         GHOST_kKeyZ,
00280 
00281         GHOST_kKeyLeftBracket  = '[',
00282         GHOST_kKeyRightBracket = ']',
00283         GHOST_kKeyBackslash    = 0x5C,
00284         GHOST_kKeyAccentGrave  = '`',
00285 
00286         
00287         GHOST_kKeyLeftShift = 0x100,
00288         GHOST_kKeyRightShift,
00289         GHOST_kKeyLeftControl,
00290         GHOST_kKeyRightControl,
00291         GHOST_kKeyLeftAlt,
00292         GHOST_kKeyRightAlt,
00293         GHOST_kKeyOS,           // Command key on Apple, Windows key(s) on Windows
00294         GHOST_kKeyGrLess ,              // German PC only!
00295 
00296         GHOST_kKeyCapsLock,
00297         GHOST_kKeyNumLock,
00298         GHOST_kKeyScrollLock,
00299 
00300         GHOST_kKeyLeftArrow,
00301         GHOST_kKeyRightArrow,
00302         GHOST_kKeyUpArrow,
00303         GHOST_kKeyDownArrow,
00304 
00305         GHOST_kKeyPrintScreen,
00306         GHOST_kKeyPause,
00307 
00308         GHOST_kKeyInsert,
00309         GHOST_kKeyDelete,
00310         GHOST_kKeyHome,
00311         GHOST_kKeyEnd,
00312         GHOST_kKeyUpPage,
00313         GHOST_kKeyDownPage,
00314 
00315         // Numpad keys
00316         GHOST_kKeyNumpad0,
00317         GHOST_kKeyNumpad1,
00318         GHOST_kKeyNumpad2,
00319         GHOST_kKeyNumpad3,
00320         GHOST_kKeyNumpad4,
00321         GHOST_kKeyNumpad5,
00322         GHOST_kKeyNumpad6,
00323         GHOST_kKeyNumpad7,
00324         GHOST_kKeyNumpad8,
00325         GHOST_kKeyNumpad9,
00326         GHOST_kKeyNumpadPeriod,
00327         GHOST_kKeyNumpadEnter,
00328         GHOST_kKeyNumpadPlus,
00329         GHOST_kKeyNumpadMinus,
00330         GHOST_kKeyNumpadAsterisk,
00331         GHOST_kKeyNumpadSlash,
00332 
00333         // Function keys
00334         GHOST_kKeyF1,
00335         GHOST_kKeyF2,
00336         GHOST_kKeyF3,
00337         GHOST_kKeyF4,
00338         GHOST_kKeyF5,
00339         GHOST_kKeyF6,
00340         GHOST_kKeyF7,
00341         GHOST_kKeyF8,
00342         GHOST_kKeyF9,
00343         GHOST_kKeyF10,
00344         GHOST_kKeyF11,
00345         GHOST_kKeyF12,
00346         GHOST_kKeyF13,
00347         GHOST_kKeyF14,
00348         GHOST_kKeyF15,
00349         GHOST_kKeyF16,
00350         GHOST_kKeyF17,
00351         GHOST_kKeyF18,
00352         GHOST_kKeyF19,
00353         GHOST_kKeyF20,
00354         GHOST_kKeyF21,
00355         GHOST_kKeyF22,
00356         GHOST_kKeyF23,
00357         GHOST_kKeyF24,
00358         
00359         // Multimedia keypad buttons
00360         GHOST_kKeyMediaPlay,
00361         GHOST_kKeyMediaStop,
00362         GHOST_kKeyMediaFirst,
00363         GHOST_kKeyMediaLast
00364 } GHOST_TKey;
00365 
00366 typedef enum {
00367         GHOST_kGrabDisable = 0, /* grab not set */
00368         GHOST_kGrabNormal,      /* no cursor adjustments */
00369         GHOST_kGrabWrap,                /* wrap the mouse location to prevent limiting screen bounds */
00370         GHOST_kGrabHide,                /* hide the mouse while grabbing and restore the original location on release (numbuts) */
00371 } GHOST_TGrabCursorMode;
00372 
00373 typedef void* GHOST_TEventDataPtr;
00374 
00375 typedef struct {
00377         GHOST_TInt32 x;
00379         GHOST_TInt32 y;
00380 } GHOST_TEventCursorData;
00381 
00382 typedef struct {
00384         GHOST_TButtonMask button;
00385 } GHOST_TEventButtonData;
00386 
00387 typedef struct {
00389         GHOST_TInt32 z; 
00390 } GHOST_TEventWheelData;
00391 
00392 typedef enum {
00393         GHOST_kTrackpadEventUnknown =0,
00394         GHOST_kTrackpadEventScroll,
00395         GHOST_kTrackpadEventRotate,
00396         GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
00397         GHOST_kTrackpadEventMagnify
00398 } GHOST_TTrackpadEventSubTypes;
00399         
00400 
00401 typedef struct {
00403         GHOST_TTrackpadEventSubTypes subtype;
00405         GHOST_TInt32 x;
00407         GHOST_TInt32 y;
00409         GHOST_TInt32 deltaX;
00411         GHOST_TInt32 deltaY;
00412 } GHOST_TEventTrackpadData;
00413 
00414 
00415 typedef enum {
00416         GHOST_kDragnDropTypeUnknown =0,
00417         GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
00418         GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
00419         GHOST_kDragnDropTypeBitmap /*Bitmap image data */
00420 } GHOST_TDragnDropTypes;
00421 
00422 typedef struct {
00424         GHOST_TInt32 x;
00426         GHOST_TInt32 y;
00428         GHOST_TDragnDropTypes dataType;
00430         GHOST_TEventDataPtr data;
00431 } GHOST_TEventDragnDropData;
00432 
00433 typedef struct {
00434         int count;
00435         GHOST_TUns8 **strings;
00436 } GHOST_TStringArray;
00437 
00438 typedef enum {
00439         GHOST_kNotStarted,
00440         GHOST_kStarting,
00441         GHOST_kInProgress,
00442         GHOST_kFinishing,
00443         GHOST_kFinished
00444         } GHOST_TProgress;
00445 
00446 typedef struct {
00448         // Each component normally ranges from -1 to +1, but can exceed that.
00449         // These use blender standard view coordinates, with positive rotations being CCW about the axis.
00450         float tx, ty, tz; // translation
00451         float rx, ry, rz; // rotation:
00452                 // axis = (rx,ry,rz).normalized
00453                 // amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
00454         float dt; // time since previous NDOF Motion event
00455         GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers)
00456 } GHOST_TEventNDOFMotionData;
00457 
00458 typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction;
00459         // good for mouse or other buttons too, hmmm?
00460 
00461 typedef struct {
00462         GHOST_TButtonAction action;
00463         short button;
00464 } GHOST_TEventNDOFButtonData;
00465 
00466 typedef struct {
00468         GHOST_TKey              key;
00470         char                    ascii;
00471 } GHOST_TEventKeyData;
00472 
00473 typedef struct {
00475         GHOST_TUns32    xPixels;
00477         GHOST_TUns32    yPixels;
00479         GHOST_TUns32    bpp;
00481         GHOST_TUns32    frequency;
00482 } GHOST_DisplaySetting;
00483 
00484 
00485 #ifdef _WIN32
00486 typedef long GHOST_TEmbedderWindowID;
00487 #endif // _WIN32
00488 
00489 #ifndef _WIN32
00490 // I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h
00491 typedef int GHOST_TEmbedderWindowID;
00492 #endif // _WIN32
00493 
00499 #ifdef __cplusplus
00500 class GHOST_ITimerTask;
00501 typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask* task, GHOST_TUns64 time);
00502 #else
00503 struct GHOST_TimerTaskHandle__;
00504 typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__* task, GHOST_TUns64 time);
00505 #endif
00506 
00507 #endif // _GHOST_TYPES_H_
00508