+Widget *Panel::get_child_at(int x, int y)
+{
+ for(list<Widget *>::reverse_iterator i=children.rbegin(); i!=children.rend(); ++i)
+ if((*i)->is_visible() && (*i)->get_geometry().is_inside(x, y))
+ return *i;
+
+ return 0;
+}
+
+
+Panel::Loader::Loader(Panel &p, map<string, Widget *> &m):
+ Widget::Loader(p),
+ pnl(p),
+ wdg_map(m)
+{
+ add("button", &Loader::child<Button>);
+ add("dropdown", &Loader::child<Dropdown>);
+ add("entry", &Loader::child<Entry>);
+ add("hslider", &Loader::child<HSlider>);
+ add("indicator", &Loader::child<Indicator>);
+ add("label", &Loader::child<Label>);
+ add("list", &Loader::child<List>);
+ add("panel", &Loader::panel);
+ add("table", &Loader::child<Table>);
+ add("toggle", &Loader::child<Toggle>);
+ add("vslider", &Loader::child<VSlider>);
+}
+
+template<typename T>
+void Panel::Loader::child(const string &n)
+{
+ RefPtr<T> chl=new T(pnl.res);
+ load_sub(*chl);
+ pnl.add(*chl.get());
+ wdg_map[n]=chl.release();
+}
+
+void Panel::Loader::panel(const string &n)
+{
+ RefPtr<Panel> p=new Panel(pnl.res);
+ load_sub(*p, wdg_map);
+ pnl.add(*p.get());
+ wdg_map[n]=p.release();
+}
+