1 ///@file Keyboard event
3 // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Library General Public
7 // License as published by the Free Software Foundation; either
8 // version 2 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
15 // You should have received a copy of the GNU Library General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef CANVAS_KEYBOARD_EVENT_HXX_
20 #define CANVAS_KEYBOARD_EVENT_HXX_
22 #include "DeviceEvent.hxx"
36 DOM_KEY_LOCATION_STANDARD = 0,
37 DOM_KEY_LOCATION_LEFT,
38 DOM_KEY_LOCATION_RIGHT,
39 DOM_KEY_LOCATION_NUMPAD
43 KeyboardEvent(const osgGA::GUIEventAdapter& ea);
45 void setKey(uint32_t key);
46 void setUnmodifiedKey(uint32_t key);
47 void setRepeat(bool repeat);
49 std::string key() const;
50 DOMKeyLocation location() const;
51 bool repeat() const { return _repeat; }
53 uint32_t charCode() const { return _key; }
54 uint32_t keyCode() const { return _unmodified_key; }
56 /// Whether the key which has triggered this event is a modifier
57 bool isModifier() const;
60 uint32_t _key, //<! Key identifier for this event
61 _unmodified_key; //<! Virtual key identifier without any
63 bool _repeat; //<! If key has been depressed long enough to
64 // generate key repetition
66 mutable std::string _name; //<! Printable representation/name
67 mutable uint8_t _location; //<! Location of the key on the keyboard
72 } // namespace simgear
74 #endif /* CANVAS_KEYBOARD_EVENT_HXX_ */