]> git.tdb.fi Git - libs/gui.git/blob - source/input/keyboard.h
30ec39c139b74d0b8f32a98cedf5dd765510c406
[libs/gui.git] / source / input / keyboard.h
1 #ifndef MSP_INPUT_KEYBOARD_H_
2 #define MSP_INPUT_KEYBOARD_H_
3
4 #include <sigc++/trackable.h>
5 #include <msp/graphics/window.h>
6 #include <msp/stringcodec/ustring.h>
7 #include "device.h"
8
9 namespace Msp {
10 namespace Input {
11
12 /**
13 Adapts key events from a window to the abstracted input framework.  Key codes
14 are translated to platform-independent values.  See keys.h for a list.
15 */
16 class Keyboard: public Device, public sigc::trackable
17 {
18 public:
19         sigc::signal<bool, StringCodec::unichar>::accumulated<EventAccumulator> signal_character;
20
21 private:
22         Graphics::Window &window;
23
24 public:
25         Keyboard(Graphics::Window &);
26         ~Keyboard();
27
28         std::string get_button_name(unsigned) const override;
29 private:
30         void input_event(const Graphics::Window::Event &);
31 };
32
33 } // namespace Input
34 } // namespace Msp
35
36 #endif