]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dropdown.cpp
Clear dropdown text if the associated list selection is cleared
[libs/gltk.git] / source / dropdown.cpp
index 5b1d19b4f4d6c04576e76a9a015b945b0a956a93..34ca1781153f946fddaaf69f82e993643b2864f1 100644 (file)
@@ -31,6 +31,7 @@ void Dropdown::init()
        list.set_visible(false);
        list.set_view_all();
        list.signal_item_selected.connect(sigc::mem_fun(this, &Dropdown::list_item_selected));
+       list.signal_selection_cleared.connect(sigc::mem_fun(this, &Dropdown::list_selection_cleared));
        list.signal_autosize_changed.connect(sigc::mem_fun(this, &Dropdown::list_autosize_changed));
 }
 
@@ -167,6 +168,11 @@ void Dropdown::list_item_selected(unsigned index)
        rebuild();
 }
 
+void Dropdown::list_selection_cleared()
+{
+       text.set(string());
+}
+
 
 Dropdown::Loader::Loader(Dropdown &d):
        DataFile::DerivedObjectLoader<Dropdown, Widget::Loader>(d)