]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dropdown.cpp
Make autosize_special const and add a const autosize overload
[libs/gltk.git] / source / dropdown.cpp
index 50aced9fe9fcaafd4317884ea4b370caa2395b03..013e1d9168721d794bcd4069f7d596fe2fb7ee36 100644 (file)
@@ -33,11 +33,12 @@ void Dropdown::init()
        list.signal_autosize_changed.connect(sigc::mem_fun(this, &Dropdown::list_autosize_changed));
 }
 
-void Dropdown::autosize_special(const Part &part, Geometry &ageom)
+void Dropdown::autosize_special(const Part &part, Geometry &ageom) const
 {
        if(part.get_name()=="list")
        {
-               list.autosize();
+               Geometry lgeom;
+               list.autosize(lgeom);
                ageom.w = max(ageom.w, list.get_geometry().w);
        }
        else if(part.get_name()=="text")
@@ -58,8 +59,6 @@ void Dropdown::autosize_special(const Part &part, Geometry &ageom)
                unsigned line_height = static_cast<unsigned>((font.get_ascent()-font.get_descent())*font_size);
                ageom.h = max(ageom.h, line_height+margin.top+margin.bottom);
        }
-
-       rebuild();
 }
 
 void Dropdown::set_selected_index(int index)