]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/cocoa/cocoaevent.h
Basic OS X support
[libs/gui.git] / source / graphics / cocoa / cocoaevent.h
1 #ifndef MSP_GRAPHICS_COCOAEVENT_H_
2 #define MSP_GRAPHICS_COCOAEVENT_H_
3
4 #include "cocoawindow.h"
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 typedef enum
11 {
12         LEFT_MOUSE_DOWN = 1,
13         LEFT_MOUSE_UP = 2,
14         RIGHT_MOUSE_DOWN = 3,
15         RIGHT_MOUSE_UP = 4,
16         MOUSE_MOVED = 5,
17         KEY_DOWN = 10,
18         KEY_UP = 11,
19         SCROLL_WHEEL = 22,
20         OTHER_MOUSE_DOWN = 25,
21         OTHER_MOUSE_UP = 26,
22         WINDOW_CLOSED = 1000
23 } CocoaEventType;
24
25 typedef struct
26 {
27         CocoaEventType type;
28         CocoaWindow *window;
29 } CocoaAnyEvent;
30
31 typedef struct
32 {
33         CocoaEventType type;
34         CocoaWindow *window;
35         unsigned button;
36         bool state;
37 } CocoaButtonEvent;
38
39 typedef struct
40 {
41         CocoaEventType type;
42         CocoaWindow *window;
43         float x;
44         float y;
45 } CocoaMotionEvent;
46
47 typedef struct
48 {
49         CocoaEventType type;
50         CocoaWindow *window;
51         unsigned key;
52         bool state;
53         int character;
54 } CocoaKeyEvent;
55
56 typedef union
57 {
58         CocoaEventType type;
59         CocoaAnyEvent any;
60         CocoaButtonEvent button;
61         CocoaMotionEvent motion;
62         CocoaKeyEvent key;
63 } CocoaEvent;
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif