3 This file is part of libmspgltk
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 Root::Root(Resources &r, Graphics::Window &w):
17 set_geometry(Geometry(0, 0, window.get_width(), window.get_height()));
21 window.signal_button_press.connect(sigc::mem_fun(this, &Root::button_press_event));
22 window.signal_button_release.connect(sigc::mem_fun(this, &Root::button_release_event));
23 window.signal_pointer_motion.connect(sigc::mem_fun(this, &Root::pointer_motion_event));
24 window.signal_key_press.connect(sigc::mem_fun(this, &Root::key_press_event));
25 window.signal_key_release.connect(sigc::mem_fun(this, &Root::key_release_event));
28 void Root::button_press_event(int x, int y, unsigned btn, unsigned)
32 translate_coords(x, y);
33 button_press(x, y, btn);
37 void Root::button_release_event(int x, int y, unsigned btn, unsigned)
41 translate_coords(x, y);
42 button_release(x, y, btn);
46 void Root::pointer_motion_event(int x, int y)
50 translate_coords(x, y);
55 void Root::key_press_event(unsigned key, unsigned mod, wchar_t ch)
58 key_press(key, mod, ch);
61 void Root::key_release_event(unsigned key, unsigned mod)
64 key_release(key, mod);
67 void Root::translate_coords(int &x, int &y)
69 x=x*geom.w/window.get_width();
70 y=geom.h-1-y*geom.h/window.get_height();