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));
}
}
}
-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")
rebuild();
}
+void Dropdown::list_selection_cleared()
+{
+ text.set(string());
+}
+
Dropdown::Loader::Loader(Dropdown &d):
DataFile::DerivedObjectLoader<Dropdown, Widget::Loader>(d)