]> git.tdb.fi Git - libs/gltk.git/commitdiff
Autosize all items in a List
authorMikko Rasa <tdb@tdb.fi>
Tue, 25 Jun 2013 18:45:00 +0000 (21:45 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 25 Jun 2013 18:45:00 +0000 (21:45 +0300)
source/list.cpp

index 0faf151456efd9703d605b8de5e9bb26c58c9c58..710d1fc6fa7cf7c05e2fe88e5c6349aa018cf298 100644 (file)
@@ -64,12 +64,13 @@ void List::autosize_rows(unsigned n)
 
                unsigned max_w = 0;
                unsigned total_h = 0;
-               for(unsigned i=0; (i<n && i<items.size()); ++i)
+               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);
-                       total_h += igeom.h;
+                       if(i<n)
+                               total_h += igeom.h;
                }
 
                if(!items.empty() && items.size()<n)