OSDN Git Service

first
[psychlops/cpp.git] / psychlops / platform / osx / psychlops_io_API_OSX.h
1 /*
2  *  psychlops_io_API_OSX.h
3  *  Psychlops Standard Library (MacOSX)
4  *
5  *  Last Modified 2006/01/04 by Kenchi HOSOKAWA
6  *  (C) 2006 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO
7  */
8
9 #ifndef HEADER_PSYCHLOPS_IO_API_OSX
10 #define HEADER_PSYCHLOPS_IO_API_OSX
11
12 #include <Carbon/Carbon.h>
13 #include <ApplicationServices/ApplicationServices.h>
14 #include <CoreServices/CoreServices.h>
15
16 #include "psychlops_io_clock_OSX.h"
17 #include "../../core/devices/psychlops_io_hid.h"
18
19 #if !defined(PANTHER)
20 #define PSYCHLOPS_SNOW_LEOPARD_PATCH
21 #endif
22
23 namespace Psychlops {
24
25         class APIHIDProperties {
26                 friend class Mouse;
27                 friend class Keyboard;
28                 friend class HumanInterfaceDevice;
29                 
30                 private:
31                 static MPTaskID inputListnerTask, inputListnerTask2;
32                 static bool refresh_needed;
33                 
34                 public:
35                 static void initialize();
36                 static void finalize();
37
38                 static void startListener();
39                 static void stopListener();
40                 static void bindKeyCode();
41
42                 static void refresh();
43
44                 static bool get(Keyboard::Key code, Keyboard::KeyState state);
45                 static bool get(Mouse::Button button, Mouse::ButtonState state);
46                 static void setPointerPosition(int x, int y);
47                 static void update();
48
49 #if (defined(PANTHER) && ( PANTHER==1 )) || defined(PSYCHLOPS_SNOW_LEOPARD_PATCH)
50                 static void lisnerProcedure();
51                 static void updateKeyboard();
52                 static void updateMouse();
53                 static UInt32 key[4][4];
54                 static unsigned long keybinder[128][2];
55                 enum KeyCodeBinder_OSX{
56                         BIG=0, SMALL=1
57                 };
58 #endif
59 #if !defined(PANTHER)
60                 static void loopListener();
61                 static CGEventRef listenToKeyboard(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon);
62                 static CGEventRef listenToMouse   (CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon);
63                 static CFRunLoopSourceRef listenerKey, listenerMouse;
64 #if !defined(PSYCHLOPS_SNOW_LEOPARD_PATCH)
65                 static int keybinder[128];
66 #endif
67 #endif
68         };
69
70 /*
71         class APIMouseProperties {
72                 friend class APIHIDProperties;
73                 private:
74                 static ::Point position_;
75
76                 public:
77                 static void initialize();
78
79                 static void update();
80
81                 static bool get(Mouse::Button button, HumanInterfaceDevice::ButtonState state);
82                 static void getPosition(int &x, int &y);
83                 static void setPosition(int x, int y);
84         };
85 */
86
87
88 }       /*      <- namespace Psycholops         */
89
90
91 #endif