c++ - How do I set the number of visible lines in a Gtk::TextView? -
i have gtk::textview have 2 lines of text visible, regardless of font size. if more 2 lines entered box scroll i'd text view remain 2 lines tall.
how do this?
this difficult. example, if 2 font sizes mixed in 1 line?
one way create pango layout of 1 letter , find out height. untested simplification of code wrote in c 1 time; shouldn't trouble convert c++ , gtkmm:
pangolayout *cell = gtk_widget_create_pango_layout(textview, "x"); int line_height; pango_layout_get_pixel_extents(cell, null, &line_height); g_object_unref(cell); gtk_widget_set_size_request(textview, -1, line_height);
Comments
Post a Comment