X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=34ca1781153f946fddaaf69f82e993643b2864f1;hb=9dbdf5decfa160df15c237887fdcbf12fc8f835b;hp=e48303317b809601514ce71db7dded49dffbc068;hpb=96df5b14a964da5a592a36e10a23022d5649462a;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index e483033..34ca178 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -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)); } @@ -62,13 +63,6 @@ void Dropdown::autosize_special(const Part &part, Geometry &ageom) const } } -void Dropdown::set_selected_index(int index) -{ - list.set_selected_index(index); - if(index<0) - text.set(string()); -} - void Dropdown::rebuild_special(const Part &part) { if(part.get_name()=="text") @@ -174,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(d)