+void Widget::pointer_enter()
+{
+ state|=HOVER;
+}
+
+void Widget::pointer_leave()
+{
+ state&=~HOVER;
+}
+
+void Widget::focus_in()
+{
+ state|=FOCUS;
+}
+
+void Widget::focus_out()
+{
+ state&=~FOCUS;
+}
+
+void Widget::update_style()
+{
+ string sname=get_class();
+ if(!style_name.empty())
+ {
+ sname+='-';
+ sname+=style_name;
+ }
+ style=res.get<Style>(sname);
+ on_style_change();
+}
+
+void Widget::set_parent(Panel *p)
+{
+ if(parent && p)
+ throw InvalidState("Widget is already in a Panel");
+ parent=p;
+
+ on_reparent();
+}
+
+void Widget::set_parent(Widget &w, Panel *p)
+{
+ w.set_parent(p);
+}
+
+
+Widget::Loader::Loader(Widget &w):
+ wdg(w)
+{
+ add("position", &Loader::position);
+ add("size", &Loader::size);
+ add("style", &Loader::style);
+ add("visible", &Widget::visible);
+}
+
+void Widget::Loader::position(int x, int y)
+{
+ wdg.set_position(x, y);
+}
+
+void Widget::Loader::size(unsigned w, unsigned h)
+{
+ wdg.set_size(w, h);
+}
+
+void Widget::Loader::style(const string &s)
+{
+ wdg.set_style(s);
+}
+