From f3d8d9510ac81c23f67025983aa7171ec5adcda9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 26 Dec 2012 22:13:01 +0200 Subject: [PATCH] Fix some problems with List and Dropdown They probably still don't work perfectly, but there's bigger changes coming when I have time. --- source/dropdown.cpp | 2 ++ source/list.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 41e42fa..6ec88fe 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -26,6 +26,7 @@ void Dropdown::autosize() return; Widget::autosize(); + list.autosize_all(); geom.w = max(geom.w, list.get_geometry().w); if(const Part *text_part = style->get_part("text")) @@ -173,6 +174,7 @@ void Dropdown::list_item_selected(unsigned index, const std::string &item) } signal_item_selected.emit(index, item); + rebuild(); } diff --git a/source/list.cpp b/source/list.cpp index 7041f73..218b26b 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -132,6 +132,7 @@ void List::set_selected_index(int i) { sel_index = i; signal_item_selected.emit(sel_index, items[sel_index]); + rebuild(); } else throw out_of_range("List::set_selected_index"); @@ -159,7 +160,7 @@ void List::rebuild_special(const Part &part, CachedPart &cache) GL::MeshBuilder bld(*cache.mesh); bld.color(style->get_font_color()); - bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y+geom.h-pgeom.h, 0); + bld.matrix() *= GL::Matrix::translation(margin.left, geom.h-pgeom.h-font.get_descent()*style->get_font_size(), 0); for(unsigned i=0; (i