/[svn]/gigedit/trunk/src/gigedit/compat.h
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/compat.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3859 by schoenebeck, Sat Feb 1 19:28:43 2020 UTC revision 3860 by schoenebeck, Sun Feb 21 14:41:48 2021 UTC
# Line 447  namespace Glib { Line 447  namespace Glib {
447   * the assumption that EVERY word of the text had a line break, which would   * the assumption that EVERY word of the text had a line break, which would
448   * cause the label to claim much more vertical space than actually required for   * cause the label to claim much more vertical space than actually required for
449   * the text.   * the text.
450     *
451     * NOTE: This class only works with Gtk 3 and higher. For Gtk 2 and younger it
452     * does nothing different than a normal Gtk::Label right now. See TODO comment
453     * on get_preferred_height_for_width_vfunc() below for details.
454   */   */
455  class MultiLineLabel : public Gtk::Label {  class MultiLineLabel : public Gtk::Label {
456  public:  public:
# Line 461  public: Line 465  public:
465          m_markup = s;          m_markup = s;
466      }      }
467    
468        //TODO: get_preferred_height_for_width_vfunc() did not exist in Gtk 2, nor
469        // did get_margin_top() and get_margin_bottom() and consequently I'm
470        // unsure whether the issue MultiLineLabel addresses could actually be
471        // fixed for Gtk 2 as well. For now this code is simply commented out
472        // which means MultiLineLabel behaves as Gtk::Label on Gtk 2 & older.
473        #if GTKMM_MAJOR_VERSION >= 3
474      void get_preferred_height_for_width_vfunc(int width, int& minimum_height, int& natural_height) const {      void get_preferred_height_for_width_vfunc(int width, int& minimum_height, int& natural_height) const {
475          Gtk::Label::get_preferred_height_for_width_vfunc(width, minimum_height, natural_height);          Gtk::Label::get_preferred_height_for_width_vfunc(width, minimum_height, natural_height);
476          //printf("super suggests minimum_height=%d natural_height=%d\n", minimum_height, natural_height);          //printf("super suggests minimum_height=%d natural_height=%d\n", minimum_height, natural_height);
# Line 478  public: Line 488  public:
488          if (natural_height < h)          if (natural_height < h)
489              natural_height = h;              natural_height = h;
490      }      }
491        #endif // GTKMM_MAJOR_VERSION >= 3
492    
493  private:  private:
494      Glib::ustring m_markup;      Glib::ustring m_markup;

Legend:
Removed from v.3859  
changed lines
  Added in v.3860

  ViewVC Help
Powered by ViewVC