]> git.tdb.fi Git - libs/gui.git/blob - source/input/keyboard.h
Inherit input devices using Window::signal_input_event from sigc::trackable
[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         virtual ~Keyboard();
27
28         virtual std::string get_button_name(unsigned) const;
29 private:
30         void input_event(const Graphics::Window::Event &);
31 };
32
33 } // namespace Input
34 } // namespace Msp
35
36 #endif