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