X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=ab00c4c3f0c7bd06c0edc453d18c0315ebf36063;hb=b4d0a86b77fb5146f5a4f6c76690c16204210f1a;hp=ef0fa22f97c8f150009988b3487c716b1e576cf2;hpb=1597579a34a8d87d4dea0a0cdc0895e6247b6126;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index ef0fa22..ab00c4c 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -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(font.get_string_width(data.get_string(i))*font_size); max_w = max(max_w, w); @@ -108,7 +106,7 @@ bool Dropdown::navigate(Navigation nav) return true; } -void Dropdown::on_geometry_change() +void Dropdown::on_size_change() { if(dropped) resize_list(); @@ -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()