| 1 | /* | 
|---|
| 2 | The zlib/libpng License | 
|---|
| 3 |  | 
|---|
| 4 | Copyright (c) 2006 Chris Snyder | 
|---|
| 5 |  | 
|---|
| 6 | This software is provided 'as-is', without any express or implied warranty. In no event will | 
|---|
| 7 | the authors be held liable for any damages arising from the use of this software. | 
|---|
| 8 |  | 
|---|
| 9 | Permission is granted to anyone to use this software for any purpose, including commercial | 
|---|
| 10 | applications, and to alter it and redistribute it freely, subject to the following | 
|---|
| 11 | restrictions: | 
|---|
| 12 |  | 
|---|
| 13 | 1. The origin of this software must not be misrepresented; you must not claim that | 
|---|
| 14 | you wrote the original software. If you use this software in a product, | 
|---|
| 15 | an acknowledgment in the product documentation would be appreciated but is | 
|---|
| 16 | not required. | 
|---|
| 17 |  | 
|---|
| 18 | 2. Altered source versions must be plainly marked as such, and must not be | 
|---|
| 19 | misrepresented as being the original software. | 
|---|
| 20 |  | 
|---|
| 21 | 3. This notice may not be removed or altered from any source distribution. | 
|---|
| 22 | */ | 
|---|
| 23 | #ifndef OIS_MacInputManager_H | 
|---|
| 24 | #define OIS_MacInputManager_H | 
|---|
| 25 |  | 
|---|
| 26 | #include "OISInputManager.h" | 
|---|
| 27 | #include "OISFactoryCreator.h" | 
|---|
| 28 | #include "mac/MacPrereqs.h" | 
|---|
| 29 | #include <Carbon/Carbon.h> | 
|---|
| 30 |  | 
|---|
| 31 | namespace OIS | 
|---|
| 32 | { | 
|---|
| 33 |  | 
|---|
| 34 | class MacInputManager : public InputManager, public FactoryCreator | 
|---|
| 35 | { | 
|---|
| 36 | public: | 
|---|
| 37 | MacInputManager(); | 
|---|
| 38 | virtual ~MacInputManager(); | 
|---|
| 39 |  | 
|---|
| 40 | //InputManager Overrides | 
|---|
| 41 | /** @copydoc InputManager::_initialize */ | 
|---|
| 42 | void _initialize( ParamList ¶mList ); | 
|---|
| 43 |  | 
|---|
| 44 | //FactoryCreator Overrides | 
|---|
| 45 | /** @copydoc FactoryCreator::deviceList */ | 
|---|
| 46 | DeviceList freeDeviceList(); | 
|---|
| 47 |  | 
|---|
| 48 | /** @copydoc FactoryCreator::totalDevices */ | 
|---|
| 49 | int totalDevices(Type iType); | 
|---|
| 50 |  | 
|---|
| 51 | /** @copydoc FactoryCreator::freeDevices */ | 
|---|
| 52 | int freeDevices(Type iType); | 
|---|
| 53 |  | 
|---|
| 54 | /** @copydoc FactoryCreator::vendorExist */ | 
|---|
| 55 | bool vendorExist(Type iType, const std::string & vendor); | 
|---|
| 56 |  | 
|---|
| 57 | /** @copydoc FactoryCreator::createObject */ | 
|---|
| 58 | Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor = ""); | 
|---|
| 59 |  | 
|---|
| 60 | /** @copydoc FactoryCreator::destroyObject */ | 
|---|
| 61 | void destroyObject(Object* obj); | 
|---|
| 62 |  | 
|---|
| 63 | //Internal Items | 
|---|
| 64 | //! Internal method, used for flaggin keyboard as available/unavailable for creation | 
|---|
| 65 | void _setKeyboardUsed(bool used) {keyboardUsed = used; } | 
|---|
| 66 |  | 
|---|
| 67 | //! Internal method, used for flaggin mouse as available/unavailable for creation | 
|---|
| 68 | void _setMouseUsed(bool used) { mouseUsed = used; } | 
|---|
| 69 |  | 
|---|
| 70 | //! methodfor getting the event target | 
|---|
| 71 | EventTargetRef _getEventTarget() {return mEventTargetRef;} | 
|---|
| 72 |  | 
|---|
| 73 | //! method for getting window | 
|---|
| 74 | WindowRef _getWindow() {return mWindow;} | 
|---|
| 75 |  | 
|---|
| 76 | protected: | 
|---|
| 77 | void _parseConfigSettings( ParamList& paramList ); | 
|---|
| 78 |  | 
|---|
| 79 | void _enumerateDevices(); | 
|---|
| 80 |  | 
|---|
| 81 | static const std::string iName; | 
|---|
| 82 |  | 
|---|
| 83 | // Mac stuff | 
|---|
| 84 | EventTargetRef mEventTargetRef; | 
|---|
| 85 | WindowRef mWindow; | 
|---|
| 86 |  | 
|---|
| 87 | // settings | 
|---|
| 88 | bool mHideMouse; | 
|---|
| 89 | bool mUseRepeat; | 
|---|
| 90 |  | 
|---|
| 91 | //! Used to know if we used up keyboard | 
|---|
| 92 | bool keyboardUsed; | 
|---|
| 93 |  | 
|---|
| 94 | //! Used to know if we used up mouse | 
|---|
| 95 | bool mouseUsed; | 
|---|
| 96 |  | 
|---|
| 97 | //! HID Manager class handling devices other than keyboard/mouse | 
|---|
| 98 | MacHIDManager *mHIDManager; | 
|---|
| 99 | }; | 
|---|
| 100 | } | 
|---|
| 101 | #endif | 
|---|