#include <msp/gl/matrix.h>
#include <msp/gl/transform.h>
+#include "panel.h"
#include "resources.h"
#include "widget.h"
res(r),
style(0),
state(NORMAL),
- visible(true)
+ visible(true),
+ parent(0)
{ }
+Widget::~Widget()
+{
+ if(parent)
+ parent->remove(*this);
+}
+
void Widget::set_position(int x, int y)
{
geom.x=x;
style=res.get<Style>(sname);
}
+void Widget::set_parent(Panel *p)
+{
+ if(parent && p)
+ throw InvalidState("Widget is already in a Panel");
+ parent=p;
+}
+
+void Widget::set_parent(Widget &w, Panel *p)
+{
+ w.set_parent(p);
+}
+
Widget::Loader::Loader(Widget &w):
wdg(w)