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