]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dropdown.cpp
Add a signal to notify when the automatic size of a widget changes
[libs/gltk.git] / source / dropdown.cpp
index 801c8a6428cfe81de6b1d82ac5f86154f4d1e3d0..cff5387408a2b7551d308f014fcf91f7e1f674c5 100644 (file)
@@ -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();