]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/list.cpp
Return a reference from Style::get_font
[libs/gltk.git] / source / list.cpp
index e1f39b7dc8ecaa67db27c9212ada54ef24199593..a886118ed6c98b8341effd74de1d6fc4c6f61018 100644 (file)
@@ -40,12 +40,13 @@ void List::autosize_rows(unsigned n)
        if(items_part)
        {
                const Sides &margin = items_part->get_margin();
+               const GL::Font &font = style->get_font();
                float font_size = style->get_font_size();
 
                unsigned max_w = 0;
                for(vector<string>::iterator i=items.begin(); i!=items.end(); ++i)
                {
-                       unsigned w = static_cast<unsigned>(style->get_font()->get_string_width(*i)*font_size);
+                       unsigned w = static_cast<unsigned>(font.get_string_width(*i)*font_size);
                        max_w = max(max_w, w);
                }
 
@@ -222,7 +223,7 @@ void List::on_style_change()
 
        items_part = style->get_part("items");
 
-       const GL::Font &font = *style->get_font();
+       const GL::Font &font = style->get_font();
        row_height = static_cast<unsigned>((font.get_ascent()-font.get_descent())*style->get_font_size());
 
        check_view_range();