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));
26 void Root::button_press_event(int x, int y, unsigned btn, unsigned)
28 translate_coords(x, y);
29 button_press(x, y, btn);
32 void Root::button_release_event(int x, int y, unsigned btn, unsigned)
34 translate_coords(x, y);
35 button_release(x, y, btn);
38 void Root::pointer_motion_event(int x, int y)
40 translate_coords(x, y);
44 void Root::translate_coords(int &x, int &y)
46 x=x*geom.w/window.get_width();
47 y=geom.h-1-y*geom.h/window.get_height();