Blender V2.61 - r43446

GHOST_Types.h

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