3 This file is part of libmspgltk
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 Root::Root(Resources &r, 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));
25 window.signal_key_release.connect(sigc::mem_fun(this, &Root::key_release));
28 void Root::button_press_event(int x, int y, unsigned btn, unsigned)
30 translate_coords(x, y);
31 button_press(x, y, btn);
34 void Root::button_release_event(int x, int y, unsigned btn, unsigned)
36 translate_coords(x, y);
37 button_release(x, y, btn);
40 void Root::pointer_motion_event(int x, int y)
42 translate_coords(x, y);
46 void Root::translate_coords(int &x, int &y)
48 x=x*geom.w/window.get_width();
49 y=geom.h-1-y*geom.h/window.get_height();