1 #ifndef MSP_GLTK_ROOT_H_
2 #define MSP_GLTK_ROOT_H_
4 #include <sigc++/trackable.h>
5 #include <msp/gl/camera.h>
6 #include <msp/gl/program.h>
7 #include <msp/graphics/window.h>
8 #include <msp/input/keyboard.h>
9 #include <msp/input/mouse.h>
10 #include <msp/time/timestamp.h>
19 A Root is a special type of Panel that covers the entire viewport and receives
20 input from keyboard and mouse.
22 class Root: public Panel, public sigc::trackable
25 sigc::signal<std::string, int, int> signal_tooltip;
28 const Resources &resources;
29 Input::Keyboard *keyboard;
35 Time::TimeStamp tooltip_timeout;
36 Widget *tooltip_target;
37 Msp::GL::Camera camera;
38 Msp::GL::Program *shprog;
41 /** Creates a Root widget for a window. The geometry is set to match the
42 window's size, and input devices are created automatically. */
43 Root(const Resources &, Graphics::Window &);
45 /** Creates a Root widget with custom input devices. If window is not null,
46 it is used to set the widget's initial geometry. */
47 Root(const Resources &, Graphics::Window *, Input::Keyboard *, Input::Mouse *);
49 void init(Graphics::Window *);
53 virtual const char *get_class() const { return "root"; }
55 const Resources &get_resources() const { return resources; }
56 virtual unsigned get_width() const { return geom.w; }
57 virtual unsigned get_height() const { return geom.h; }
63 bool button_press_event(unsigned);
64 bool button_release_event(unsigned);
65 bool axis_motion_event(unsigned, float, float);
66 bool key_press_event(unsigned);
67 bool key_release_event(unsigned);
68 bool character_event(StringCodec::unichar);
70 void get_pointer(int &, int &);
73 virtual void on_geometry_change();
74 virtual void on_child_added(Widget &);