00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "mac/MacHelpers.h"
00025 #include "mac/MacKeyboard.h"
00026 #include "mac/MacMouse.h"
00027 #include "OISException.h"
00028
00029 #include <Carbon/Carbon.h>
00030
00031 using namespace OIS;
00032
00033
00034 OSStatus KeyDownWrapper( EventHandlerCallRef nextHandler,
00035 EventRef theEvent,
00036 void* callClass )
00037 {
00038
00039 if (callClass != NULL) {
00040 ((MacKeyboard*)callClass)->_keyDownCallback( theEvent );
00041
00042
00043 return CallNextEventHandler( nextHandler, theEvent );
00044 }
00045 else {
00046 OIS_EXCEPT(E_General, "KeyDownWrapper >> Being called by something other than our event handler!");
00047 return noErr;
00048 }
00049 }
00050
00051
00052
00053 OSStatus KeyUpWrapper( EventHandlerCallRef nextHandler,
00054 EventRef theEvent,
00055 void* callClass )
00056 {
00057 if (callClass != NULL) {
00058 ((MacKeyboard*)callClass)->_keyUpCallback( theEvent );
00059
00060
00061 return CallNextEventHandler( nextHandler, theEvent );
00062 }
00063 else {
00064 OIS_EXCEPT(E_General, "KeyUpWrapper >> Being called by something other than our event handler!");
00065 return noErr;
00066 }
00067 }
00068
00069
00070
00071 OSStatus KeyModWrapper( EventHandlerCallRef nextHandler,
00072 EventRef theEvent,
00073 void* callClass )
00074 {
00075 if (callClass != NULL) {
00076 ((MacKeyboard*)callClass)->_modChangeCallback( theEvent );
00077
00078
00079 return CallNextEventHandler( nextHandler, theEvent );
00080
00081 }
00082 else {
00083 OIS_EXCEPT(E_General, "KeyModWrapper >> Being called by something other than our event handler!");
00084 return noErr;
00085 }
00086 }
00087
00088
00089
00090 OSStatus MouseMoveWrapper( EventHandlerCallRef nextHandler,
00091 EventRef theEvent,
00092 void* callClass )
00093 {
00094 if (callClass != NULL) {
00095 ((MacMouse*)callClass)->_mouseMoveCallback( theEvent );
00096
00097
00098 return CallNextEventHandler( nextHandler, theEvent );
00099
00100 }
00101 else {
00102 OIS_EXCEPT(E_General, "MouseMoveWrapper >> Being called by something other than our event handler!");
00103 return noErr;
00104 }
00105 }
00106
00107
00108
00109 OSStatus MouseScrollWrapper( EventHandlerCallRef nextHandler,
00110 EventRef theEvent,
00111 void* callClass )
00112 {
00113 if (callClass != NULL) {
00114 ((MacMouse*)callClass)->_mouseScrollCallback( theEvent );
00115
00116
00117 return CallNextEventHandler( nextHandler, theEvent );
00118
00119 }
00120 else {
00121 OIS_EXCEPT(E_General, "MouseScrollWrapper >> Being called by something other than our event handler!");
00122 return noErr;
00123 }
00124 }
00125
00126
00127
00128 OSStatus MouseButtonWrapper( EventHandlerCallRef nextHandler,
00129 EventRef theEvent,
00130 void* callClass )
00131 {
00132 if (callClass != NULL) {
00133 ((MacMouse*)callClass)->_mouseButtonCallback( theEvent );
00134
00135
00136 return CallNextEventHandler( nextHandler, theEvent );
00137
00138 }
00139 else {
00140 OIS_EXCEPT(E_General, "MouseButtonWrapper >> Being called by something other than our event handler!");
00141 return noErr;
00142 }
00143 }
00144