== SCons ==
[blender.git] / intern / ghost / GHOST_Types.h
1 /**
2  * $Id$
3  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4  *
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. The Blender
9  * Foundation also sells licenses for use in proprietary software under
10  * the Blender License.  See http://www.blender.org/BL/ for information
11  * about this.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23  * All rights reserved.
24  *
25  * The Original Code is: all of this file.
26  *
27  * Contributor(s): none yet.
28  *
29  * ***** END GPL/BL DUAL LICENSE BLOCK *****
30  */
31
32 #ifndef _GHOST_TYPES_H_
33 #define _GHOST_TYPES_H_
34
35 typedef char                            GHOST_TInt8;
36 typedef unsigned char           GHOST_TUns8;
37 typedef short                           GHOST_TInt16;
38 typedef unsigned short          GHOST_TUns16;
39 typedef int                                     GHOST_TInt32;
40 typedef unsigned int            GHOST_TUns32;
41
42 #if defined(WIN32) && !defined(FREE_WINDOWS)
43 typedef __int64                         GHOST_TInt64;
44 typedef unsigned __int64        GHOST_TUns64;
45 #else
46 typedef long long                       GHOST_TInt64;
47 typedef unsigned long long      GHOST_TUns64;
48 #endif
49
50 typedef void*                           GHOST_TUserDataPtr;
51
52 typedef enum
53 {
54         GHOST_kFailure = 0,
55         GHOST_kSuccess
56 } GHOST_TSuccess;
57
58
59 typedef enum {
60         GHOST_kNotVisible = 0,
61         GHOST_kPartiallyVisible,
62         GHOST_kFullyVisible
63 } GHOST_TVisibility;
64
65
66 typedef enum {
67         GHOST_kFireTimeNever = 0xFFFFFFFF
68 } GHOST_TFireTimeConstant;
69
70 typedef enum {
71     GHOST_kModifierKeyLeftShift = 0,
72     GHOST_kModifierKeyRightShift,
73     GHOST_kModifierKeyLeftAlt,
74     GHOST_kModifierKeyRightAlt,
75     GHOST_kModifierKeyLeftControl,
76     GHOST_kModifierKeyRightControl,
77     GHOST_kModifierKeyCommand,          // APPLE only
78     GHOST_kModifierKeyNumMasks
79 } GHOST_TModifierKeyMask;
80
81
82 typedef enum {
83         GHOST_kWindowStateNormal = 0,
84         GHOST_kWindowStateMaximized,
85         GHOST_kWindowStateMinimized,
86         GHOST_kWindowStateFullScreen,
87         GHOST_kWindowState8Normal = 8,
88         GHOST_kWindowState8Maximized,
89         GHOST_kWindowState8Minimized,
90         GHOST_kWindowState8FullScreen
91 } GHOST_TWindowState;
92
93
94 typedef enum {
95         GHOST_kWindowOrderTop = 0,
96         GHOST_kWindowOrderBottom
97 } GHOST_TWindowOrder;
98
99
100 typedef enum {
101         GHOST_kDrawingContextTypeNone = 0,
102         GHOST_kDrawingContextTypeOpenGL
103 } GHOST_TDrawingContextType;
104
105
106 typedef enum {
107         GHOST_kButtonMaskLeft = 0,
108         GHOST_kButtonMaskMiddle,
109         GHOST_kButtonMaskRight,
110         GHOST_kButtonNumMasks
111 } GHOST_TButtonMask;
112
113
114 typedef enum {
115         GHOST_kEventUnknown = 0,
116
117         GHOST_kEventCursorMove,         /// Mouse move event
118         GHOST_kEventButtonDown,         /// Mouse button event
119         GHOST_kEventButtonUp,           /// Mouse button event
120         GHOST_kEventWheel,                      /// Mouse wheel event
121
122         GHOST_kEventKeyDown,
123         GHOST_kEventKeyUp,
124 //      GHOST_kEventKeyAuto,
125
126         GHOST_kEventQuit,
127
128         GHOST_kEventWindowClose,
129         GHOST_kEventWindowActivate,
130         GHOST_kEventWindowDeactivate,
131         GHOST_kEventWindowUpdate,
132         GHOST_kEventWindowSize,
133
134         GHOST_kNumEventTypes
135 } GHOST_TEventType;
136
137
138 typedef enum {
139         GHOST_kStandardCursorFirstCursor = 0,
140         GHOST_kStandardCursorDefault = 0,
141         GHOST_kStandardCursorRightArrow,
142         GHOST_kStandardCursorLeftArrow,
143         GHOST_kStandardCursorInfo, 
144         GHOST_kStandardCursorDestroy,
145         GHOST_kStandardCursorHelp,    
146         GHOST_kStandardCursorCycle,
147         GHOST_kStandardCursorSpray,
148         GHOST_kStandardCursorWait,
149         GHOST_kStandardCursorText,
150         GHOST_kStandardCursorCrosshair,
151         GHOST_kStandardCursorUpDown,
152         GHOST_kStandardCursorLeftRight,
153         GHOST_kStandardCursorTopSide,
154         GHOST_kStandardCursorBottomSide,
155         GHOST_kStandardCursorLeftSide,
156         GHOST_kStandardCursorRightSide,
157         GHOST_kStandardCursorTopLeftCorner,
158         GHOST_kStandardCursorTopRightCorner,
159         GHOST_kStandardCursorBottomRightCorner,
160         GHOST_kStandardCursorBottomLeftCorner,
161         GHOST_kStandardCursorCustom, 
162         GHOST_kStandardCursorNumCursors, 
163         GHOST_kStandardCursorPencil
164 } GHOST_TStandardCursor;
165
166
167 typedef enum {
168         GHOST_kKeyUnknown = -1,
169         GHOST_kKeyBackSpace,
170         GHOST_kKeyTab,
171         GHOST_kKeyLinefeed,
172         GHOST_kKeyClear,
173         GHOST_kKeyEnter  = 0x0D,
174         
175         GHOST_kKeyEsc    = 0x1B,
176         GHOST_kKeySpace  = ' ',
177         GHOST_kKeyQuote  = 0x27,
178         GHOST_kKeyComma  = ',',
179         GHOST_kKeyMinus  = '-',
180         GHOST_kKeyPeriod = '.',
181         GHOST_kKeySlash  = '/',
182
183         // Number keys
184         GHOST_kKey0 = '0',
185         GHOST_kKey1,
186         GHOST_kKey2,
187         GHOST_kKey3,
188         GHOST_kKey4,
189         GHOST_kKey5,
190         GHOST_kKey6,
191         GHOST_kKey7,
192         GHOST_kKey8,
193         GHOST_kKey9,
194
195         GHOST_kKeySemicolon = ';',
196         GHOST_kKeyEqual     = '=',
197
198         // Character keys
199         GHOST_kKeyA = 'A',
200         GHOST_kKeyB,
201         GHOST_kKeyC,
202         GHOST_kKeyD,
203         GHOST_kKeyE,
204         GHOST_kKeyF,
205         GHOST_kKeyG,
206         GHOST_kKeyH,
207         GHOST_kKeyI,
208         GHOST_kKeyJ,
209         GHOST_kKeyK,
210         GHOST_kKeyL,
211         GHOST_kKeyM,
212         GHOST_kKeyN,
213         GHOST_kKeyO,
214         GHOST_kKeyP,
215         GHOST_kKeyQ,
216         GHOST_kKeyR,
217         GHOST_kKeyS,
218         GHOST_kKeyT,
219         GHOST_kKeyU,
220         GHOST_kKeyV,
221         GHOST_kKeyW,
222         GHOST_kKeyX,
223         GHOST_kKeyY,
224         GHOST_kKeyZ,
225
226         GHOST_kKeyLeftBracket  = '[',
227         GHOST_kKeyRightBracket = ']',
228         GHOST_kKeyBackslash    = 0x5C,
229         GHOST_kKeyAccentGrave  = '`',
230
231         
232         GHOST_kKeyLeftShift = 0x100,
233         GHOST_kKeyRightShift,
234         GHOST_kKeyLeftControl,
235         GHOST_kKeyRightControl,
236         GHOST_kKeyLeftAlt,
237         GHOST_kKeyRightAlt,
238     GHOST_kKeyCommand,                          // APPLE only!
239     GHOST_kKeyGrLess ,          // German PC only!
240
241         GHOST_kKeyCapsLock,
242         GHOST_kKeyNumLock,
243         GHOST_kKeyScrollLock,
244
245         GHOST_kKeyLeftArrow,
246         GHOST_kKeyRightArrow,
247         GHOST_kKeyUpArrow,
248         GHOST_kKeyDownArrow,
249
250         GHOST_kKeyPrintScreen,
251         GHOST_kKeyPause,
252
253         GHOST_kKeyInsert,
254         GHOST_kKeyDelete,
255         GHOST_kKeyHome,
256         GHOST_kKeyEnd,
257         GHOST_kKeyUpPage,
258         GHOST_kKeyDownPage,
259
260         // Numpad keys
261         GHOST_kKeyNumpad0,
262         GHOST_kKeyNumpad1,
263         GHOST_kKeyNumpad2,
264         GHOST_kKeyNumpad3,
265         GHOST_kKeyNumpad4,
266         GHOST_kKeyNumpad5,
267         GHOST_kKeyNumpad6,
268         GHOST_kKeyNumpad7,
269         GHOST_kKeyNumpad8,
270         GHOST_kKeyNumpad9,
271         GHOST_kKeyNumpadPeriod,
272         GHOST_kKeyNumpadEnter,
273         GHOST_kKeyNumpadPlus,
274         GHOST_kKeyNumpadMinus,
275         GHOST_kKeyNumpadAsterisk,
276         GHOST_kKeyNumpadSlash,
277
278         // Function keys
279         GHOST_kKeyF1,
280         GHOST_kKeyF2,
281         GHOST_kKeyF3,
282         GHOST_kKeyF4,
283         GHOST_kKeyF5,
284         GHOST_kKeyF6,
285         GHOST_kKeyF7,
286         GHOST_kKeyF8,
287         GHOST_kKeyF9,
288         GHOST_kKeyF10,
289         GHOST_kKeyF11,
290         GHOST_kKeyF12,
291         GHOST_kKeyF13,
292         GHOST_kKeyF14,
293         GHOST_kKeyF15,
294         GHOST_kKeyF16,
295         GHOST_kKeyF17,
296         GHOST_kKeyF18,
297         GHOST_kKeyF19,
298         GHOST_kKeyF20,
299         GHOST_kKeyF21,
300         GHOST_kKeyF22,
301         GHOST_kKeyF23,
302         GHOST_kKeyF24
303 } GHOST_TKey;
304
305
306 typedef void* GHOST_TEventDataPtr;
307
308 typedef struct {
309         /** The x-coordinate of the cursor position. */
310         GHOST_TInt32 x;
311         /** The y-coordinate of the cursor position. */
312         GHOST_TInt32 y;
313 } GHOST_TEventCursorData;
314
315 typedef struct {
316         /** The mask of the mouse button. */
317         GHOST_TButtonMask button;
318 } GHOST_TEventButtonData;
319
320 typedef struct {
321         /** Displacement of a mouse wheel. */
322         GHOST_TInt32 z; 
323 } GHOST_TEventWheelData;
324
325 typedef struct {
326         /** The key code. */
327         GHOST_TKey              key;
328         /** The ascii code for the key event ('\0' if none). */
329         char                    ascii;
330 } GHOST_TEventKeyData;
331
332 typedef struct {
333         /** Number of pixels on a line. */
334         GHOST_TUns32    xPixels;
335         /** Number of lines. */
336         GHOST_TUns32    yPixels;
337         /** Numberof bits per pixel. */
338         GHOST_TUns32    bpp;
339         /** Refresh rate (in Hertz). */
340         GHOST_TUns32    frequency;
341 } GHOST_DisplaySetting;
342
343
344 /**
345  * A timer task callback routine.
346  * @param task The timer task object.
347  * @param time The current time.
348  */
349 #ifdef __cplusplus
350 class GHOST_ITimerTask;
351 typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask* task, GHOST_TUns64 time);
352 #else
353 struct GHOST_TimerTaskHandle__;
354 typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__* task, GHOST_TUns64 time);
355 #endif
356
357 #endif // _GHOST_TYPES_H_
358