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