X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=8cc6187f2243a552b0943dde919dff6e6c0d18cb;hb=4b52d16bc895f9d969383d7a7d6a3558c1972cc5;hp=5b1d19b4f4d6c04576e76a9a015b945b0a956a93;hpb=08b48157dc9ca5a4bd59d8eec9fa4e3bff8f0503;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 5b1d19b..8cc6187 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -25,12 +25,16 @@ Dropdown::Dropdown(ListData &d): void Dropdown::init() { + // Necessary to have the parent container raise the dropdown on click + input_type = INPUT_TEXT; + dropped = false; add(list); 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 +171,11 @@ void Dropdown::list_item_selected(unsigned index) rebuild(); } +void Dropdown::list_selection_cleared() +{ + text.set(string()); +} + Dropdown::Loader::Loader(Dropdown &d): DataFile::DerivedObjectLoader(d)