From: Mikko Rasa Date: Thu, 7 Nov 2013 12:33:01 +0000 (+0200) Subject: Fix some more inefficient autosizes X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=729cb06f85e2888a7ac1e72375380257936106c9;p=libs%2Fgltk.git Fix some more inefficient autosizes --- diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 013e1d9..84f6af3 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -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); diff --git a/source/entry.cpp b/source/entry.cpp index 1198bde..44a169a 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -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()); diff --git a/source/layout.cpp b/source/layout.cpp index b8d8fb7..5df7bc1 100644 --- a/source/layout.cpp +++ b/source/layout.cpp @@ -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() diff --git a/source/list.cpp b/source/list.cpp index c5dddf5..a4550c4 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -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::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); }