f14f120a386ca569ca0a8af46b2c741cff29bb7b
[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_TWindowState;
88
89
90 typedef enum {
91         GHOST_kWindowOrderTop = 0,
92         GHOST_kWindowOrderBottom
93 } GHOST_TWindowOrder;
94
95
96 typedef enum {
97         GHOST_kDrawingContextTypeNone = 0,
98         GHOST_kDrawingContextTypeOpenGL
99 } GHOST_TDrawingContextType;
100
101
102 typedef enum {
103         GHOST_kButtonMaskLeft = 0,
104         GHOST_kButtonMaskMiddle,
105         GHOST_kButtonMaskRight,
106         GHOST_kButtonNumMasks
107 } GHOST_TButtonMask;
108
109
110 typedef enum {
111         GHOST_kEventUnknown = 0,
112
113         GHOST_kEventCursorMove,         /// Mouse move event
114         GHOST_kEventButtonDown,         /// Mouse button event
115         GHOST_kEventButtonUp,           /// Mouse button event
116         GHOST_kEventWheel,                      /// Mouse wheel event
117
118         GHOST_kEventKeyDown,
119         GHOST_kEventKeyUp,
120 //      GHOST_kEventKeyAuto,
121
122         GHOST_kEventQuit,
123
124         GHOST_kEventWindowClose,
125         GHOST_kEventWindowActivate,
126         GHOST_kEventWindowDeactivate,
127         GHOST_kEventWindowUpdate,
128         GHOST_kEventWindowSize,
129
130         GHOST_kNumEventTypes
131 } GHOST_TEventType;
132
133
134 typedef enum {
135         GHOST_kStandardCursorFirstCursor = 0,
136         GHOST_kStandardCursorDefault = 0,
137         GHOST_kStandardCursorRightArrow,
138         GHOST_kStandardCursorLeftArrow,
139         GHOST_kStandardCursorInfo, 
140         GHOST_kStandardCursorDestroy,
141         GHOST_kStandardCursorHelp,    
142         GHOST_kStandardCursorCycle,
143         GHOST_kStandardCursorSpray,
144         GHOST_kStandardCursorWait,
145         GHOST_kStandardCursorText,
146         GHOST_kStandardCursorCrosshair,
147         GHOST_kStandardCursorUpDown,
148         GHOST_kStandardCursorLeftRight,
149         GHOST_kStandardCursorTopSide,
150         GHOST_kStandardCursorBottomSide,
151         GHOST_kStandardCursorLeftSide,
152         GHOST_kStandardCursorRightSide,
153         GHOST_kStandardCursorTopLeftCorner,
154         GHOST_kStandardCursorTopRightCorner,
155         GHOST_kStandardCursorBottomRightCorner,
156         GHOST_kStandardCursorBottomLeftCorner,
157         GHOST_kStandardCursorCustom, 
158         GHOST_kStandardCursorNumCursors, 
159         GHOST_kStandardCursorPencil
160 } GHOST_TStandardCursor;
161
162
163 typedef enum {
164         GHOST_kKeyUnknown = -1,
165         GHOST_kKeyBackSpace,
166         GHOST_kKeyTab,
167         GHOST_kKeyLinefeed,
168         GHOST_kKeyClear,
169         GHOST_kKeyEnter  = 0x0D,
170         
171         GHOST_kKeyEsc    = 0x1B,
172         GHOST_kKeySpace  = ' ',
173         GHOST_kKeyQuote  = 0x27,
174         GHOST_kKeyComma  = ',',
175         GHOST_kKeyMinus  = '-',
176         GHOST_kKeyPeriod = '.',
177         GHOST_kKeySlash  = '/',
178
179         // Number keys
180         GHOST_kKey0 = '0',
181         GHOST_kKey1,
182         GHOST_kKey2,
183         GHOST_kKey3,
184         GHOST_kKey4,
185         GHOST_kKey5,
186         GHOST_kKey6,
187         GHOST_kKey7,
188         GHOST_kKey8,
189         GHOST_kKey9,
190
191         GHOST_kKeySemicolon = ';',
192         GHOST_kKeyEqual     = '=',
193
194         // Character keys
195         GHOST_kKeyA = 'A',
196         GHOST_kKeyB,
197         GHOST_kKeyC,
198         GHOST_kKeyD,
199         GHOST_kKeyE,
200         GHOST_kKeyF,
201         GHOST_kKeyG,
202         GHOST_kKeyH,
203         GHOST_kKeyI,
204         GHOST_kKeyJ,
205         GHOST_kKeyK,
206         GHOST_kKeyL,
207         GHOST_kKeyM,
208         GHOST_kKeyN,
209         GHOST_kKeyO,
210         GHOST_kKeyP,
211         GHOST_kKeyQ,
212         GHOST_kKeyR,
213         GHOST_kKeyS,
214         GHOST_kKeyT,
215         GHOST_kKeyU,
216         GHOST_kKeyV,
217         GHOST_kKeyW,
218         GHOST_kKeyX,
219         GHOST_kKeyY,
220         GHOST_kKeyZ,
221
222         GHOST_kKeyLeftBracket  = '[',
223         GHOST_kKeyRightBracket = ']',
224         GHOST_kKeyBackslash    = 0x5C,
225         GHOST_kKeyAccentGrave  = '`',
226
227         
228         GHOST_kKeyLeftShift = 0x100,
229         GHOST_kKeyRightShift,
230         GHOST_kKeyLeftControl,
231         GHOST_kKeyRightControl,
232         GHOST_kKeyLeftAlt,
233         GHOST_kKeyRightAlt,
234     GHOST_kKeyCommand,                          // APPLE only!
235
236         GHOST_kKeyCapsLock,
237         GHOST_kKeyNumLock,
238         GHOST_kKeyScrollLock,
239
240         GHOST_kKeyLeftArrow,
241         GHOST_kKeyRightArrow,
242         GHOST_kKeyUpArrow,
243         GHOST_kKeyDownArrow,
244
245         GHOST_kKeyPrintScreen,
246         GHOST_kKeyPause,
247
248         GHOST_kKeyInsert,
249         GHOST_kKeyDelete,
250         GHOST_kKeyHome,
251         GHOST_kKeyEnd,
252         GHOST_kKeyUpPage,
253         GHOST_kKeyDownPage,
254
255         // Numpad keys
256         GHOST_kKeyNumpad0,
257         GHOST_kKeyNumpad1,
258         GHOST_kKeyNumpad2,
259         GHOST_kKeyNumpad3,
260         GHOST_kKeyNumpad4,
261         GHOST_kKeyNumpad5,
262         GHOST_kKeyNumpad6,
263         GHOST_kKeyNumpad7,
264         GHOST_kKeyNumpad8,
265         GHOST_kKeyNumpad9,
266         GHOST_kKeyNumpadPeriod,
267         GHOST_kKeyNumpadEnter,
268         GHOST_kKeyNumpadPlus,
269         GHOST_kKeyNumpadMinus,
270         GHOST_kKeyNumpadAsterisk,
271         GHOST_kKeyNumpadSlash,
272
273         // Function keys
274         GHOST_kKeyF1,
275         GHOST_kKeyF2,
276         GHOST_kKeyF3,
277         GHOST_kKeyF4,
278         GHOST_kKeyF5,
279         GHOST_kKeyF6,
280         GHOST_kKeyF7,
281         GHOST_kKeyF8,
282         GHOST_kKeyF9,
283         GHOST_kKeyF10,
284         GHOST_kKeyF11,
285         GHOST_kKeyF12,
286         GHOST_kKeyF13,
287         GHOST_kKeyF14,
288         GHOST_kKeyF15,
289         GHOST_kKeyF16,
290         GHOST_kKeyF17,
291         GHOST_kKeyF18,
292         GHOST_kKeyF19,
293         GHOST_kKeyF20,
294         GHOST_kKeyF21,
295         GHOST_kKeyF22,
296         GHOST_kKeyF23,
297         GHOST_kKeyF24
298 } GHOST_TKey;
299
300
301 typedef void* GHOST_TEventDataPtr;
302
303 typedef struct {
304         /** The x-coordinate of the cursor position. */
305         GHOST_TInt32 x;
306         /** The y-coordinate of the cursor position. */
307         GHOST_TInt32 y;
308 } GHOST_TEventCursorData;
309
310 typedef struct {
311         /** The mask of the mouse button. */
312         GHOST_TButtonMask button;
313 } GHOST_TEventButtonData;
314
315 typedef struct {
316         /** Displacement of a mouse wheel. */
317         GHOST_TInt32 z; 
318 } GHOST_TEventWheelData;
319
320 typedef struct {
321         /** The key code. */
322         GHOST_TKey              key;
323         /** The ascii code for the key event ('\0' if none). */
324         char                    ascii;
325 } GHOST_TEventKeyData;
326
327 typedef struct {
328         /** Number of pixels on a line. */
329         GHOST_TUns32    xPixels;
330         /** Number of lines. */
331         GHOST_TUns32    yPixels;
332         /** Numberof bits per pixel. */
333         GHOST_TUns32    bpp;
334         /** Refresh rate (in Hertz). */
335         GHOST_TUns32    frequency;
336 } GHOST_DisplaySetting;
337
338
339 /**
340  * A timer task callback routine.
341  * @param task The timer task object.
342  * @param time The current time.
343  */
344 #ifdef __cplusplus
345 class GHOST_ITimerTask;
346 typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask* task, GHOST_TUns64 time);
347 #else
348 struct GHOST_TimerTaskHandle__;
349 typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__* task, GHOST_TUns64 time);
350 #endif
351
352 #endif // _GHOST_TYPES_H_
353