]> git.tdb.fi Git - libs/gltk.git/commitdiff
Fix some problems with List and Dropdown
authorMikko Rasa <tdb@tdb.fi>
Wed, 26 Dec 2012 20:13:01 +0000 (22:13 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 26 Dec 2012 20:13:01 +0000 (22:13 +0200)
They probably still don't work perfectly, but there's bigger changes
coming when I have time.

source/dropdown.cpp
source/list.cpp

index 41e42fa72fa4b45b399ede99167d3a45d0bbe869..6ec88fe10e30ad8be3e0dc89279f48b448705b6f 100644 (file)
@@ -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();
 }
 
 
index 7041f733759da99585d2b4dde562458a9684ea3e..218b26bd1410b82d7f33fb80c0dd6cbfa3bf86f1 100644 (file)
@@ -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<n_visible && first+i<items.size()); ++i)
                {