13
0

add std::string variant of set_size_request_to_display_given_string()

This commit is contained in:
Paul Davis 2014-07-09 16:47:42 -04:00
parent 9f4a00fa89
commit b9c53ea395
2 changed files with 16 additions and 0 deletions

View File

@ -65,11 +65,16 @@ namespace Gtkmm2ext {
gint hpadding,
gint vpadding);
LIBGTKMM2EXT_API void set_size_request_to_display_given_text (Gtk::Widget &w,
std::string const & text,
gint hpadding,
gint vpadding);
LIBGTKMM2EXT_API void set_size_request_to_display_given_text (Gtk::Widget &w,
const std::vector<std::string>&,
gint hpadding,
gint vpadding);
LIBGTKMM2EXT_API Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_string (const std::string& name,
const Pango::FontDescription& font,
int clip_width,

View File

@ -76,6 +76,17 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *
w.set_size_request(width + hpadding, height + vpadding);
}
void
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, std::string const & text,
gint hpadding, gint vpadding)
{
int width, height;
w.ensure_style ();
get_pixel_size (w.create_pango_layout (text), width, height);
w.set_size_request(width + hpadding, height + vpadding);
}
void
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w,
const std::vector<std::string>& strings,