unsigned total_h = 0;
for(unsigned i=0; i<items.size(); ++i)
{
- items[i]->autosize();
const Geometry &igeom = items[i]->get_geometry();
max_w = max(max_w, igeom.w);
if(view_size==0 || i<view_size)
for(unsigned i=0; i<n_items; ++i)
{
Item *item = create_item(i);
- add(*item);
items.push_back(item);
}
List::Item *List::create_item(unsigned index)
{
+ Item *item = 0;
if(item_factory)
- return item_factory->create_item(index);
+ item = item_factory->create_item(index);
else
- return new BasicItem(data->get_string(index));
+ 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));
+ return item;
}
void List::set_view_size(unsigned s)
}
}
+void List::item_autosize_changed(Item *item)
+{
+ signal_autosize_changed.emit();
+ item->autosize();
+ reposition_items();
+}
+
void List::reposition_items()
{
if(!style)
++list.sel_index;
Item *item = list.create_item(i);
- list.add(*item);
list.items.insert(list.items.begin()+i, item);
list.items_changed();
}
virtual void on_style_change();
void reposition_slider();
+ void item_autosize_changed(Item *);
void reposition_items();
void check_view_range();
void slider_value_changed(double);