]> git.tdb.fi Git - libs/gltk.git/blob - source/root.h
Add Text class with multiline support
[libs/gltk.git] / source / root.h
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2007, 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GLTK_ROOT_H_
9 #define MSP_GLTK_ROOT_H_
10
11 #include <sigc++/trackable.h>
12 #include <msp/gbase/window.h>
13 #include <msp/time/timestamp.h>
14 #include "panel.h"
15
16 namespace Msp {
17 namespace GLtk {
18
19 class Label;
20
21 /**
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.
26 */
27 class Root: public Panel, public sigc::trackable
28 {
29 private:
30         Graphics::Window &window;
31         Label *lbl_tooltip;
32         int pointer_x;
33         int pointer_y;
34         Msp::Time::TimeStamp tooltip_timeout;
35         Widget *tooltip_target;
36
37 public:
38         Root(const Resources &, Graphics::Window &);
39         void tick();
40 private:
41         virtual const char *get_class() const { return "root"; }
42         void button_press_event(int, int, unsigned, unsigned);
43         void button_release_event(int, int, unsigned, unsigned);
44         void pointer_motion_event(int, int);
45         void key_press_event(unsigned, unsigned, wchar_t);
46         void key_release_event(unsigned, unsigned);
47         void translate_coords(int &, int &);
48 };
49
50 } // namespace GLtk
51 } // namespace Msp
52
53 #endif