- add(list);
- list.signal_item_selected.connect(sigc::mem_fun(this, &Dropdown::list_item_selected));
- list.signal_autosize_changed.connect(sigc::mem_fun(this, &Dropdown::list_autosize_changed));
-}
-
-void Dropdown::autosize()
-{
- if(!style)
- return;
-
- Widget::autosize();
- geom.w = max(geom.w, list.get_geometry().w);
-
- if(const Part *text_part = style->get_part("text"))
- {
- const Sides &margin = text_part->get_margin();
- const GL::Font *font = style->get_font();
- float font_size = font->get_default_size();
- unsigned line_height = static_cast<unsigned>((font->get_ascent()-font->get_descent())*font_size);
- geom.h = max(geom.h, line_height+margin.top+margin.bottom);
- }