X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=84f6af30422203d8ff26ecd9f3db0d111898fc42;hb=729cb06f85e2888a7ac1e72375380257936106c9;hp=2aac55ec511dc184b5d7952901ebc7bbe5b6ece0;hpb=d2d5b4c4dedf90a42dd2baff8334318b1d000f64;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 2aac55e..84f6af3 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -33,11 +33,12 @@ void Dropdown::init() list.signal_autosize_changed.connect(sigc::mem_fun(this, &Dropdown::list_autosize_changed)); } -void Dropdown::autosize_special(const Part &part, Geometry &ageom) +void Dropdown::autosize_special(const Part &part, Geometry &ageom) const { if(part.get_name()=="list") { - list.autosize(); + Geometry lgeom; + list.autosize(lgeom); ageom.w = max(ageom.w, list.get_geometry().w); } else if(part.get_name()=="text") @@ -58,8 +59,6 @@ void Dropdown::autosize_special(const Part &part, Geometry &ageom) unsigned line_height = static_cast((font.get_ascent()-font.get_descent())*font_size); ageom.h = max(ageom.h, line_height+margin.top+margin.bottom); } - - rebuild(); } void Dropdown::set_selected_index(int index) @@ -72,7 +71,7 @@ void Dropdown::set_selected_index(int index) void Dropdown::rebuild_special(const Part &part) { if(part.get_name()=="text") - text.build(part, geom, part_cache); + text.build(part, state, geom, part_cache); else Widget::rebuild_special(part); } @@ -122,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);