diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-03-06 17:06:38 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-03-06 17:06:38 +0000 |
commit | 0697aed059a8dae6c93440924287259422da82be (patch) | |
tree | 8901858dfe4021c2ce462749b3f2dc396d3a8c75 /libs/gtkmm2ext/utils.cc | |
parent | a9d6d162146d7a44cc66b63cbb016f8cec3e6b2f (diff) |
combobox width fixes from mtaht, backported from 2.X
git-svn-id: svn://localhost/ardour2/branches/3.0@4742 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext/utils.cc')
-rw-r--r-- | libs/gtkmm2ext/utils.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 57661a05af..adcaaaaeb5 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -58,6 +58,26 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar * } void +Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, + const std::vector<std::string>& strings, + gint hpadding, gint vpadding) + +{ + int width, height; + int width_max = 0; + int height_max = 0; + w.ensure_style (); + + for (vector<string>::const_iterator i = strings.begin(); + i != strings.end(); ++i) { + get_ink_pixel_size (w.create_pango_layout (*i), width, height); + width_max = max(width_max,width); + height_max = max(height_max, height); + } + w.set_size_request(width_max + hpadding, height_max + vpadding); +} + +void Gtkmm2ext::init () { // Necessary for gettext |