X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=cff5387408a2b7551d308f014fcf91f7e1f674c5;hb=033732b500a35f3737bad515349d884cb3f123f0;hp=801c8a6428cfe81de6b1d82ac5f86154f4d1e3d0;hpb=43ac7c4514658754d09552463425bcd344fb9ded;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 801c8a6..cff5387 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -24,6 +24,7 @@ Dropdown::Dropdown(): { add(list); list.signal_item_selected.connect(sigc::mem_fun(this, &Dropdown::list_item_selected)); + list.signal_autosize_changed.connect(sigc::mem_fun(this, &Dropdown::list_autosize_changed)); } void Dropdown::autosize() @@ -47,25 +48,21 @@ void Dropdown::autosize() void Dropdown::append(const string &item) { list.append(item); - resize_list(); } void Dropdown::insert(unsigned i, const string &v) { list.insert(i, v); - resize_list(); } void Dropdown::remove(unsigned i) { list.remove(i); - resize_list(); } void Dropdown::clear() { list.clear(); - resize_list(); } unsigned Dropdown::get_n_items() const @@ -129,6 +126,12 @@ void Dropdown::on_style_change() resize_list(); } +void Dropdown::list_autosize_changed() +{ + resize_list(); + signal_autosize_changed.emit(); +} + void Dropdown::resize_list() { list.autosize_all();