X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=87ea5eece9cc7fcbe8341284a289fce8612ed434;hb=e5f9004b672b038e43cf2b20c3fc9327f2b55ffd;hp=801c8a6428cfe81de6b1d82ac5f86154f4d1e3d0;hpb=43ac7c4514658754d09552463425bcd344fb9ded;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 801c8a6..87ea5ee 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspgltk -Copyright © 2007-2011 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include "dropdown.h" #include "list.h" @@ -24,6 +17,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 +41,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 +119,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();