- // XXX This is a hack.
- unsigned n_items = list.get_n_items();
- const Style &stl = list.get_style();
- const GL::Font &font = *stl.get_font();
- unsigned h = min(max(n_items, 1U), 10U)*static_cast<unsigned>((font.get_ascent()-font.get_descent())*font.get_default_size());
- for(std::list<Part>::const_iterator i=stl.get_parts().begin(); i!=stl.get_parts().end(); ++i)
- if(i->get_name()=="items")
+ Geometry lgeom;
+ list.autosize(lgeom);
+ lgeom.x = 0;
+ lgeom.y = -lgeom.h;
+ lgeom.w = max(geom.w, lgeom.w);
+ int root_x = geom.x;
+ int root_y = geom.y;
+ for(Widget *p=parent; p; p=p->get_parent())
+ {
+ root_x += p->get_geometry().x;
+ root_y += p->get_geometry().y;
+ if(Root *root = dynamic_cast<Root *>(p))