+ focusable = f;
+}
+
+void Widget::set_focus()
+{
+ if(!parent)
+ throw hierarchy_error("no parent");
+ if(!visible)
+ throw logic_error("!visible");
+
+ signal_request_focus.emit();
+}
+
+void Widget::set_state(State mask, State bits)
+{
+ state = (state&~mask)|bits;
+ rebuild();
+}
+
+void Widget::rebuild()
+{
+ if(!style)
+ return;
+
+ const Style::PartSeq &parts = style->get_parts();
+ list<CachedPart>::iterator j = cached_parts.begin();
+ for(Style::PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i, ++j)
+ {
+ if(j==cached_parts.end())
+ j = cached_parts.insert(j, CachedPart());
+ if(i->get_name().empty())
+ i->build(geom, state, *j);
+ else
+ rebuild_special(*i, *j);
+ }
+}
+
+void Widget::render(GL::Renderer &renderer) const
+{
+ if(!style)
+ throw logic_error(format("Attempt to render a widget with null style (class=\"%s\", style_name=\"%s\")", get_class(), style_name));
+
+ GL::MatrixStack::Push _pushm(renderer.matrix_stack());
+ renderer.matrix_stack() *= GL::Matrix::translation(geom.x, geom.y, 0);
+ const Style::PartSeq &parts = style->get_parts();
+ list<CachedPart>::const_iterator j = cached_parts.begin();
+ for(Style::PartSeq::const_iterator i=parts.begin(); (i!=parts.end() && j!=cached_parts.end()); ++i, ++j)