X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmouse.cpp;h=931b204f8a2655805f18509259ffc5c3781587ea;hb=77d8b98374ab07be0d14c9c88502c6a803041040;hp=dc361252bc988150c97c7aed5c1b8fb71699d70e;hpb=61eeb96535d1575ca0cf698d833c0ddfc7ae0f50;p=libs%2Fgui.git diff --git a/source/mouse.cpp b/source/mouse.cpp index dc36125..931b204 100644 --- a/source/mouse.cpp +++ b/source/mouse.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include "mouse.h" namespace Msp { @@ -14,6 +15,8 @@ Mouse::Mouse(Graphics::Window &w): window(w), axis_scale(0.01) { + name="Mouse"; + buttons.resize(3); axes.resize(2); @@ -22,6 +25,25 @@ Mouse::Mouse(Graphics::Window &w): window.signal_pointer_motion.connect(sigc::mem_fun(this, &Mouse::pointer_motion)); } +std::string Mouse::get_button_name(unsigned btn) const +{ + switch(btn) + { + case 1: + return "Left"; + case 2: + return "Middle"; + case 3: + return "Right"; + case 4: + return "Wheel Up"; + case 5: + return "Wheel Down"; + default: + return format("Button %d", btn); + } +} + void Mouse::button_press(int, int, unsigned btn, unsigned) { set_button_state(btn, true, true);