1 ///@file 2 /// Input device event 3 // 4 // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> 5 // 6 // This library is free software; you can redistribute it and/or 7 // modify it under the terms of the GNU Library General Public 8 // License as published by the Free Software Foundation; either 9 // version 2 of the License, or (at your option) any later version. 10 // 11 // This library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 // Library General Public License for more details. 15 // 16 // You should have received a copy of the GNU Library General Public 17 // License along with this library; if not, write to the Free Software 18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 20 #include <simgear_config.h> 21 22 #include "DeviceEvent.hxx" 23 #include <osgGA/GUIEventAdapter> 24 25 namespace simgear 26 { 27 namespace canvas 28 { 29 30 //---------------------------------------------------------------------------- DeviceEvent()31 DeviceEvent::DeviceEvent(): 32 modifiers(0) 33 { 34 35 } 36 37 //---------------------------------------------------------------------------- DeviceEvent(const osgGA::GUIEventAdapter & ea)38 DeviceEvent::DeviceEvent(const osgGA::GUIEventAdapter& ea): 39 modifiers(ea.getModKeyMask()) 40 { 41 time = ea.getTime(); 42 } 43 44 //---------------------------------------------------------------------------- ctrlKey() const45 bool DeviceEvent::ctrlKey() const 46 { 47 return (modifiers & osgGA::GUIEventAdapter::MODKEY_CTRL) != 0; 48 } 49 50 //---------------------------------------------------------------------------- shiftKey() const51 bool DeviceEvent::shiftKey() const 52 { 53 return (modifiers & osgGA::GUIEventAdapter::MODKEY_SHIFT) != 0; 54 } 55 56 //---------------------------------------------------------------------------- altKey() const57 bool DeviceEvent::altKey() const 58 { 59 return (modifiers & osgGA::GUIEventAdapter::MODKEY_ALT) != 0; 60 } 61 62 //---------------------------------------------------------------------------- metaKey() const63 bool DeviceEvent::metaKey() const 64 { 65 return (modifiers & osgGA::GUIEventAdapter::MODKEY_META) != 0; 66 } 67 68 } // namespace canvas 69 } // namespace simgear 70