X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flist.cpp;h=2c13ccca8e2d403a8911c8061e0f502a60a60901;hb=ec63df81f6c3f77454b0fe3bdae24876c84616b1;hp=c74af90d4541cb2185f2afc1f0d7a1bff8f6c172;hpb=c8291177b545ec81930603a5915234a60296db51;p=libs%2Fgltk.git diff --git a/source/list.cpp b/source/list.cpp index c74af90..2c13ccc 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -47,16 +47,11 @@ List::~List() delete data; } -void List::autosize() +void List::autosize_special(const Part &part, Geometry &ageom) { - if(!style) - return; - - Widget::autosize(); - - if(const Part *items_part = style->get_part("items")) + if(part.get_name()=="items") { - const Sides &margin = items_part->get_margin(); + const Sides &margin = part.get_margin(); unsigned max_w = 0; unsigned total_h = 0; @@ -72,12 +67,9 @@ void List::autosize() if(!items.empty() && items.size()set_active(false); if(i<0) sel_index = -1; - else + else if(i!=sel_index) { sel_index = i; items[sel_index]->set_active(true); @@ -313,18 +305,16 @@ void List::DataObserver::refresh_strings() } -void List::Item::autosize() +void List::Item::autosize_special(const Part &part, Geometry &ageom) { - Widget::autosize(); - - if(const Part *part = style->get_part("children")) + if(part.get_name()=="children") { - const Sides &margin = part->get_margin(); + const Sides &margin = part.get_margin(); for(list::const_iterator i=children.begin(); i!=children.end(); ++i) { const Geometry &cgeom = (*i)->widget->get_geometry(); - geom.w = max(geom.w, cgeom.x+cgeom.w+margin.right); - geom.h = max(geom.h, cgeom.y+cgeom.h+margin.top); + ageom.w = max(ageom.w, cgeom.x+cgeom.w+margin.right); + ageom.h = max(ageom.h, cgeom.y+cgeom.h+margin.top); } } } @@ -368,6 +358,7 @@ List::Loader::Loader(List &l): DataFile::DerivedObjectLoader(l) { add("item", &Loader::item); + add("view_size", &List::view_size); } void List::Loader::item(const string &v)