first = 0;
max_scroll = 0;
view_size = 5;
+ items_part = 0;
ignore_slider_change = false;
dragging = false;
drag_start_x = 0;
return true;
}
+void List::on_style_change()
+{
+ items_part = (style ? style->get_part("items") : 0);
+}
+
void List::move_focus(Navigation nav, bool select)
{
if(nav==NAV_UP)
unsigned List::last_to_first(unsigned last) const
{
- if(!style)
+ if(!items_part)
return last;
- unsigned view_h = geom.h;
- if(const Part *items_part = style->get_part("items"))
- {
- const Sides &margin = items_part->get_margin();
- view_h -= margin.top+margin.bottom;
- }
+ const Sides &margin = items_part->get_margin();
+ unsigned view_h = geom.h-min(geom.h, margin.top+margin.bottom);
unsigned items_h = 0;
for(unsigned i=last; i<items.size(); --i)
}
+void List::SimpleItem::on_style_change()
+{
+ if(!style || children.empty())
+ return;
+
+ Widget *child = children.front()->widget;
+ child->autosize();
+ if(const Part *part = style->get_part("children"))
+ {
+ const Sides &margin = part->get_margin();
+ child->set_position(margin.left, margin.bottom);
+ }
+}
+
+
void List::MultiColumnItem::check_widths(vector<unsigned> &widths) const
{
if(widths.size()<children.size())
add(label);
}
-void List::BasicItem::on_style_change()
-{
- if(!style)
- return;
-
- label.autosize();
- if(const Part *part = style->get_part("children"))
- {
- const Sides &margin = part->get_margin();
- label.set_position(margin.left, margin.bottom);
- }
-}
-
List::Loader::Loader(List &l):
DataFile::DerivedObjectLoader<List, Widget::Loader>(l)