MacMouse.h 1.17 KB
Newer Older
Phillip Castaneda's avatar
Phillip Castaneda committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef OIS_MacMouse_H
#define OIS_MacMouse_H

#include "OISMouse.h"
#include "mac/MacHelpers.h"
#include "mac/MacPrereqs.h"

#include <Carbon/Carbon.h>

namespace OIS
{
	class MacMouse : public Mouse
    {
	public:
		MacMouse( InputManager* creator, bool buffered );
		virtual ~MacMouse();
		
		/** @copydoc Object::setBuffered */
		virtual void setBuffered(bool buffered);

		/** @copydoc Object::capture */
		virtual void capture();

		/** @copydoc Object::queryInterface */
		virtual Interface* queryInterface(Interface::IType type) {return 0;}

		/** @copydoc Object::_initialize */
		virtual void _initialize();
        
	public:
        void _mouseCallback( EventRef theEvent );

	protected:
		static OSStatus WindowFocusChanged(EventHandlerCallRef nextHandler, EventRef event, void* macMouse);
        
        // "universal procedure pointers" - required reference for callbacks
		EventHandlerUPP mouseUPP;
		EventHandlerRef mouseEventRef;
		
		EventHandlerUPP mWindowFocusListener;
		EventHandlerRef mWindowFocusHandler;
		
		bool mNeedsToRegainFocus;
		bool mMouseWarped;
		
		MouseState mTempState;
	};
}


#endif // OIS_MacMouse_H