]> git.tdb.fi Git - libs/gltk.git/blob - source/panel.cpp
Initial revision
[libs/gltk.git] / source / panel.cpp
1 #include "panel.h"
2 #include "part.h"
3
4 namespace Msp {
5 namespace GLtk {
6
7 Panel::Panel(const Resources &r):
8         Widget(r)
9 {
10         update_style();
11 }
12
13 Panel::~Panel()
14 {
15         for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
16                 delete *i;
17 }
18
19 void Panel::add(Widget &wdg)
20 {
21         children.push_back(&wdg);
22 }
23
24 void Panel::render_part(const Part &part) const
25 {
26         if(part.get_name()=="children")
27         {
28                 for(ChildSeq::const_iterator i=children.begin(); i!=children.end(); ++i)
29                         (*i)->render();
30         }
31         else
32                 Widget::render_part(part);
33 }
34
35 void Panel::on_button_press(int x, int y, unsigned btn)
36 {
37         for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
38                 (*i)->button_press(x-geom.x, y-geom.y, btn);
39 }
40
41 void Panel::on_button_release(int x, int y, unsigned btn)
42 {
43         for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
44                 (*i)->button_release(x-geom.x, y-geom.y, btn);
45 }
46
47 } // namespace GLtk
48 } // namespace Msp