+ 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)
+ {
+ if(j->mesh && j->texture)
+ {
+ renderer.set_texture(j->texture);
+ j->mesh->draw(renderer);
+ }
+ else if(!i->get_name().empty())
+ render_special(*i, renderer);
+ }
+}
+
+void Widget::pointer_enter()
+{
+ set_state(HOVER);
+}
+
+void Widget::pointer_leave()
+{
+ clear_state(HOVER);
+}
+
+void Widget::focus_in()
+{
+ set_state(FOCUS);
+}
+
+void Widget::focus_out()
+{
+ clear_state(FOCUS);