]> git.tdb.fi Git - libs/gui.git/blob - source/input/mouse.cpp
Add a type enumeration for devices
[libs/gui.git] / source / input / mouse.cpp
1 #include <msp/graphics/window.h>
2 #include "mouse.h"
3
4 namespace Msp {
5 namespace Input {
6
7 Mouse::Mouse(Graphics::Window &w):
8         Device(MOUSE),
9         window(w)
10 {
11         name = "Mouse";
12
13         buttons.resize(3);
14         axes.resize(2);
15
16         window.signal_input_event.connect(sigc::mem_fun(this, &Mouse::input_event));
17 }
18
19 std::string Mouse::get_button_name(unsigned btn) const
20 {
21         switch(btn)
22         {
23         case 1:
24                 return "Left";
25         case 2:
26                 return "Middle";
27         case 3:
28                 return "Right";
29         case 4:
30                 return "Wheel Up";
31         case 5:
32                 return "Wheel Down";
33         default:
34                 return Device::get_button_name(btn);
35         }
36 }
37
38 std::string Mouse::get_axis_name(unsigned axis) const
39 {
40         switch(axis)
41         {
42         case 0:
43                 return "X axis";
44         case 1:
45                 return "Y axis";
46         default:
47                 return Device::get_axis_name(axis);
48         };
49 }
50
51 } // namespace Input
52 } // namespace Msp