]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dropdown.cpp
Rework how widget ownership works in Container
[libs/gltk.git] / source / dropdown.cpp
index f922001e2db0764c38000ec046bb9cd1c53150e4..ab00c4c3f0c7bd06c0edc453d18c0315ebf36063 100644 (file)
@@ -27,8 +27,6 @@ void Dropdown::init()
 {
        input_type = INPUT_NAVIGATION;
 
-       dropped = false;
-
        add(list);
        list.set_visible(false);
        list.set_view_all();
@@ -53,7 +51,7 @@ void Dropdown::autosize_special(const Part &part, Geometry &ageom) const
 
                unsigned max_w = 0;
                const ListData &data = list.get_data();
-               for(unsigned i=0; i<data.size(); ++i)
+               for(size_t i=0; i<data.size(); ++i)
                {
                        unsigned w = static_cast<unsigned>(font.get_string_width(data.get_string(i))*font_size);
                        max_w = max(max_w, w);
@@ -179,7 +177,7 @@ void Dropdown::resize_list()
        list.set_geometry(lgeom);
 }
 
-void Dropdown::list_item_selected(unsigned index)
+void Dropdown::list_item_selected(size_t index)
 {
        if(dropped)
        {
@@ -191,7 +189,7 @@ void Dropdown::list_item_selected(unsigned index)
        text.set(list.get_data().get_string(index));
 
        signal_item_selected.emit(index);
-       rebuild();
+       mark_rebuild();
 }
 
 void Dropdown::list_selection_cleared()