]> git.tdb.fi Git - libs/gltk.git/commitdiff
Fix some more inefficient autosizes
authorMikko Rasa <tdb@tdb.fi>
Thu, 7 Nov 2013 12:33:01 +0000 (14:33 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 7 Nov 2013 12:33:01 +0000 (14:33 +0200)
source/dropdown.cpp
source/entry.cpp
source/layout.cpp
source/list.cpp

index 013e1d9168721d794bcd4069f7d596fe2fb7ee36..84f6af30422203d8ff26ecd9f3db0d111898fc42 100644 (file)
@@ -121,8 +121,8 @@ void Dropdown::list_autosize_changed()
 
 void Dropdown::resize_list()
 {
-       list.autosize();
-       Geometry lgeom = list.get_geometry();
+       Geometry lgeom;
+       list.autosize(lgeom);
        lgeom.x = 0;
        lgeom.y = -lgeom.h;
        lgeom.w = max(geom.w, lgeom.w);
index 1198bdee52b34d3e2057232e8b12e4c65c6791a7..44a169aad7f60283188bc84a3c82c92d2ad56bb8 100644 (file)
@@ -51,11 +51,12 @@ void Entry::autosize_special(const Part &part, Geometry &ageom) const
                Geometry sgeom = part.get_geometry();
                if(!sgeom.w || !sgeom.h)
                {
-                       slider->autosize();
+                       Geometry wgeom;
+                       slider->autosize(wgeom);
                        if(!sgeom.w)
-                               sgeom.w = slider->get_geometry().w;
+                               sgeom.w = wgeom.w;
                        if(!sgeom.h)
-                               sgeom.h = slider->get_geometry().h;
+                               sgeom.h = wgeom.h;
                }
 
                const Sides &margin = part.get_margin();
@@ -237,11 +238,12 @@ void Entry::reposition_slider()
                Geometry sgeom = slider_part->get_geometry();
                if(!sgeom.w || !sgeom.h)
                {
-                       slider->autosize();
+                       Geometry wgeom;
+                       slider->autosize(wgeom);
                        if(!sgeom.w)
-                               sgeom.w = slider->get_geometry().w;
+                               sgeom.w = wgeom.w;
                        if(!sgeom.h)
-                               sgeom.h = slider->get_geometry().h;
+                               sgeom.h = wgeom.h;
                }
 
                slider_part->get_alignment().apply(sgeom, geom, slider_part->get_margin());
index b8d8fb7d23ad6b196d68550c71f7de6db6f29205..5df7bc1f77d2a16f87a02f80e4eea6892a2d3564 100644 (file)
@@ -475,8 +475,7 @@ Layout::Slot::Slot(Layout &l, Widget &w):
        vert_pack.gravity = 1;
        widget.signal_autosize_changed.connect(sigc::mem_fun(this, &Slot::autosize_changed));
        widget.signal_visibility_changed.connect(sigc::mem_fun(this, &Slot::visibility_changed));
-       widget.autosize();
-       autosize_geom = widget.get_geometry();
+       widget.autosize(autosize_geom);
 }
 
 void Layout::Slot::autosize_changed()
index c5dddf5aaac8533c0f40bec86ed53f7e171c6e37..a4550c4ee9ad220dfd22336657894b9cca13de9a 100644 (file)
@@ -121,7 +121,6 @@ List::Item *List::create_item(unsigned index)
        else
                item = new BasicItem(data->get_string(index));
        add(*item);
-       item->autosize();
        item->signal_autosize_changed.connect(sigc::mem_fun(this, &List::item_autosize_changed));
        return item;
 }
@@ -352,7 +351,8 @@ void List::Item::autosize_special(const Part &part, Geometry &ageom) const
                const Sides &margin = part.get_margin();
                for(list<Child *>::const_iterator i=children.begin(); i!=children.end(); ++i)
                {
-                       const Geometry &cgeom = (*i)->widget->get_geometry();
+                       Geometry cgeom;
+                       (*i)->widget->autosize(cgeom);
                        ageom.w = max(ageom.w, cgeom.x+cgeom.w+margin.right);
                        ageom.h = max(ageom.h, cgeom.y+cgeom.h+margin.top);
                }