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")
unsigned line_height = static_cast<unsigned>((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)
else if(btn==1)
{
dropped = true;
+ resize_list();
set_state(ACTIVE);
signal_grab_pointer.emit();
}
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);
{
const Geometry &rgeom = root->get_geometry();
if(lgeom.h*2>rgeom.h)
+ {
lgeom.h = rgeom.h/2;
+ lgeom.y = -lgeom.h;
+ }
if(root_y+lgeom.y<0)
lgeom.y = -root_y;
if(root_y+lgeom.y+lgeom.h>rgeom.h)