3 This file is part of libmspgltk
4 Copyright © 2007, 2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GLTK_ROOT_H_
9 #define MSP_GLTK_ROOT_H_
11 #include <sigc++/trackable.h>
12 #include <msp/gbase/window.h>
13 #include <msp/time/timestamp.h>
22 A Root is a special type of Panel that covers and entire Window and accepts
23 input from it. When created, a Root widget will take its size from the window
24 it is created for. The size can be changed, but a Root should always be
25 rendered to fill the window in order to get coordinates mapped correctly.
27 class Root: public Panel, public Graphics::EventSource, public sigc::trackable
30 sigc::signal<std::string, int, int> signal_tooltip;
33 const Resources &resources;
34 Graphics::Window &window;
38 Time::TimeStamp tooltip_timeout;
39 Widget *tooltip_target;
42 Root(const Resources &, Graphics::Window &);
45 const Resources &get_resources() const { return resources; }
46 virtual unsigned get_width() const { return geom.w; }
47 virtual unsigned get_height() const { return geom.h; }
50 virtual const char *get_class() const { return "root"; }
51 void button_press_event(int, int, unsigned, unsigned);
52 void button_release_event(int, int, unsigned, unsigned);
53 void pointer_motion_event(int, int);
54 void key_press_event(unsigned, unsigned, wchar_t);
55 void key_release_event(unsigned, unsigned);
56 void translate_coords(int &, int &);