--- gigedit/trunk/src/gigedit/compat.h 2021/02/14 14:21:55 3859 +++ gigedit/trunk/src/gigedit/compat.h 2021/02/21 14:41:48 3860 @@ -447,6 +447,10 @@ * the assumption that EVERY word of the text had a line break, which would * cause the label to claim much more vertical space than actually required for * the text. + * + * NOTE: This class only works with Gtk 3 and higher. For Gtk 2 and younger it + * does nothing different than a normal Gtk::Label right now. See TODO comment + * on get_preferred_height_for_width_vfunc() below for details. */ class MultiLineLabel : public Gtk::Label { public: @@ -461,6 +465,12 @@ m_markup = s; } + //TODO: get_preferred_height_for_width_vfunc() did not exist in Gtk 2, nor + // did get_margin_top() and get_margin_bottom() and consequently I'm + // unsure whether the issue MultiLineLabel addresses could actually be + // fixed for Gtk 2 as well. For now this code is simply commented out + // which means MultiLineLabel behaves as Gtk::Label on Gtk 2 & older. + #if GTKMM_MAJOR_VERSION >= 3 void get_preferred_height_for_width_vfunc(int width, int& minimum_height, int& natural_height) const { Gtk::Label::get_preferred_height_for_width_vfunc(width, minimum_height, natural_height); //printf("super suggests minimum_height=%d natural_height=%d\n", minimum_height, natural_height); @@ -478,6 +488,7 @@ if (natural_height < h) natural_height = h; } + #endif // GTKMM_MAJOR_VERSION >= 3 private: Glib::ustring m_markup;