- const float font_size=font->get_default_size();
- unsigned text_w=static_cast<unsigned>(font->get_string_width(text)*font_size);
+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);
+ }
+}