| 1 | /* |
| 2 | The zlib/libpng License |
| 3 | |
| 4 | Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com) |
| 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 | |
| 24 | #ifndef OIS_CocoaInputManager_H |
| 25 | #define OIS_CocoaInputManager_H |
| 26 | |
| 27 | #include "OISInputManager.h" |
| 28 | #include "OISFactoryCreator.h" |
| 29 | #include <Cocoa/Cocoa.h> |
| 30 | |
| 31 | namespace OIS |
| 32 | { |
| 33 | class MacHIDManager; |
| 34 | |
| 35 | class CocoaInputManager : public InputManager, public FactoryCreator |
| 36 | { |
| 37 | public: |
| 38 | CocoaInputManager(); |
| 39 | virtual ~CocoaInputManager(); |
| 40 | |
| 41 | //InputManager Overrides |
| 42 | /** @copydoc InputManager::_initialize */ |
| 43 | void _initialize( ParamList ¶mList ); |
| 44 | |
| 45 | //FactoryCreator Overrides |
| 46 | /** @copydoc FactoryCreator::deviceList */ |
| 47 | DeviceList freeDeviceList(); |
| 48 | |
| 49 | /** @copydoc FactoryCreator::totalDevices */ |
| 50 | int totalDevices(Type iType); |
| 51 | |
| 52 | /** @copydoc FactoryCreator::freeDevices */ |
| 53 | int freeDevices(Type iType); |
| 54 | |
| 55 | /** @copydoc FactoryCreator::vendorExist */ |
| 56 | bool vendorExist(Type iType, const std::string & vendor); |
| 57 | |
| 58 | /** @copydoc FactoryCreator::createObject */ |
| 59 | Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor = ""); |
| 60 | |
| 61 | /** @copydoc FactoryCreator::destroyObject */ |
| 62 | void destroyObject(Object* obj); |
| 63 | |
| 64 | //Internal Items |
| 65 | //! Internal method, used for flaggin keyboard as available/unavailable for creation |
| 66 | void _setKeyboardUsed(bool used) {keyboardUsed = used; } |
| 67 | |
| 68 | //! Internal method, used for flaggin mouse as available/unavailable for creation |
| 69 | void _setMouseUsed(bool used) { mouseUsed = used; } |
| 70 | |
| 71 | //! method for getting window |
| 72 | NSWindow * _getWindow() {return mWindow;} |
| 73 | |
| 74 | protected: |
| 75 | void _parseConfigSettings( ParamList& paramList ); |
| 76 | |
| 77 | void _enumerateDevices(); |
| 78 | |
| 79 | static const std::string iName; |
| 80 | |
| 81 | // Mac stuff |
| 82 | NSWindow *mWindow; |
| 83 | |
| 84 | // settings |
| 85 | bool mHideMouse; |
| 86 | bool mUseRepeat; |
| 87 | |
| 88 | //! Used to know if we used up keyboard |
| 89 | bool keyboardUsed; |
| 90 | |
| 91 | //! Used to know if we used up mouse |
| 92 | bool mouseUsed; |
| 93 | |
| 94 | //! HID Manager class handling devices other than keyboard/mouse |
| 95 | MacHIDManager *mHIDManager; |
| 96 | }; |
| 97 | } |
| 98 | #endif |