2 #include <msp/core/refptr.h>
32 void Panel::set_layout(Layout *l)
34 l->set_container(*this);
39 void Panel::autosize()
45 void Panel::render_special(const Part &part, GL::Renderer &renderer) const
47 if(part.get_name()=="children")
49 for(list<Container::Child *>::const_iterator i=children.begin(); i!=children.end(); ++i)
50 if((*i)->widget->is_visible())
51 (*i)->widget->render(renderer);
55 void Panel::on_geometry_change()
61 void Panel::on_child_added(Widget &wdg)
65 layout->add_widget(wdg);
66 signal_autosize_changed.emit();
70 void Panel::on_child_removed(Widget &wdg)
74 layout->remove_widget(wdg);
75 signal_autosize_changed.emit();
80 Panel::Loader::Loader(Panel &p, map<string, Widget *> &m):
85 add("button", &Loader::child<Button>);
86 add("dropdown", &Loader::child<Dropdown>);
87 add("entry", &Loader::child<Entry>);
88 add("hslider", &Loader::child<HSlider>);
89 add("indicator", &Loader::child<Indicator>);
90 add("label", &Loader::child<Label>);
91 add("list", &Loader::child<List>);
92 add("panel", &Loader::panel);
93 add("table", &Loader::child<Table>);
94 add("toggle", &Loader::child<Toggle>);
95 add("vslider", &Loader::child<VSlider>);
99 void Panel::Loader::child(const string &n)
101 RefPtr<T> chl = new T();
104 wdg_map[n] = chl.release();
107 void Panel::Loader::panel(const string &n)
109 RefPtr<Panel> p = new Panel();
110 load_sub(*p, wdg_map);
112 wdg_map[n] = p.release();