unsigned total_h = 0;
for(unsigned i=0; i<items.size(); ++i)
{
- const Geometry &igeom = items[i]->get_geometry();
+ Geometry igeom;
+ items[i]->autosize(igeom);
max_w = max(max_w, igeom.w);
if(view_size==0 || i<view_size)
total_h += igeom.h;
item = new BasicItem(data->get_string(index));
add(*item);
item->autosize();
- item->signal_autosize_changed.connect(sigc::bind(sigc::mem_fun(this, &List::item_autosize_changed), item));
+ item->signal_autosize_changed.connect(sigc::mem_fun(this, &List::item_autosize_changed));
return item;
}
}
}
-void List::item_autosize_changed(Item *item)
+void List::item_autosize_changed()
{
signal_autosize_changed.emit();
- item->autosize();
reposition_items();
}
if(const Part *items_part = style->get_part("items"))
{
const Sides &margin = items_part->get_margin();
- unsigned w = geom.w-margin.left-margin.right;
- unsigned y = geom.h-margin.top;
+ unsigned w = geom.w-min(geom.w, margin.left+margin.right);
+ unsigned y = geom.h-min(geom.h, margin.top);
for(unsigned i=0; i<items.size(); ++i)
{
if(i<first || !y)
items[i]->set_visible(false);
else
{
- Geometry igeom = items[i]->get_geometry();
+ Geometry igeom;
+ items[i]->autosize(igeom);
if(igeom.h+margin.bottom<=y)
{
items[i]->set_visible(true);
virtual void on_style_change();
void reposition_slider();
- void item_autosize_changed(Item *);
+ void item_autosize_changed();
void reposition_items();
void check_view_range();
void slider_value_changed(double);