]> git.tdb.fi Git - libs/gltk.git/blob - source/panel.h
Rearrange members
[libs/gltk.git] / source / panel.h
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2007-2011  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GLTK_PANEL_H_
9 #define MSP_GLTK_PANEL_H_
10
11 #include "container.h"
12
13 namespace Msp {
14 namespace GLtk {
15
16 /**
17 Panels are containers for other widgets.  Panel styles should have a special
18 part "children" to render the child widgets.  All properties of this part are
19 ignored.
20 */
21 class Panel: public Container
22 {
23 public:
24         class Loader: public Widget::Loader
25         {
26         private:
27                 Panel &pnl;
28                 std::map<std::string, Widget *> &wdg_map;
29         
30         public:
31                 Loader(Panel &, std::map<std::string, Widget *> &);
32         private:
33                 template<typename T>
34                 void child(const std::string &);
35                 void panel(const std::string &);
36         };
37
38 protected:
39         struct Child: public Container::Child
40         {
41                 Child(Panel &, Widget *);
42                 virtual ~Child();
43
44                 void visibility_changed(bool);
45                 void request_focus();
46                 void grab_pointer();
47                 void ungrab_pointer();
48                 void raise();
49         };
50
51         Widget *pointer_focus;
52         bool pointer_grabbed;
53         Widget *input_focus;
54
55         Panel(const Panel &);
56         Panel &operator=(const Panel &);
57 public:
58         Panel();
59
60         virtual const char *get_class() const { return "panel"; }
61
62 protected:
63         virtual Child *create_child(Widget *);
64
65 public:
66         void raise(Widget &);
67         Widget *get_input_focus() const { return input_focus; }
68         Widget *get_final_input_focus() const;
69
70 protected:
71         virtual void render_special(const Part &) const;
72
73 public:
74         virtual void button_press(int, int, unsigned);
75         virtual void button_release(int, int, unsigned);
76         virtual void pointer_motion(int, int);
77         virtual void pointer_leave();
78         virtual void key_press(unsigned, unsigned, wchar_t);
79         virtual void key_release(unsigned, unsigned);
80         virtual void focus_out();
81
82 protected:
83         void set_pointer_focus(Widget *);
84         void set_input_focus(Widget *);
85 };
86
87 } // namespace GLtk
88 } // namespace Msp
89
90 #endif