Re: Ellipsizing



I just found Pango::Layout::is_ellipsized(). Since there's CellRendererText::property_ellipsize(), it seems reasonable to think it has access to a Pango::Layout for the rendering of the text; maybe it should also have a property_is_ellipsized() — that's probably a GtkCellRendererText enhancement, yes?

Thanks for the hint — I'll give it a try.

On 01/29/2018 12:47 PM, Daniel Boles wrote:
I had the same desire and arrived at this method. I can't vouch for whether it works in every situation, but it has never seemed to fail for me.

The idea is that you force the full natural request by setting :max-width-chars to -1, get that request, then check whether it's below the actual allocation and en/disable the tooltip accordingly. then, of course, change :max-width-chars back to something that allows ellipsisation

so, in short:

  * set_max_width_chars(-1);
  * get_preferred_width(dummy, natural);
  * set_has_tooltip( natural < get_allocated_width() );
  * set_max_width_chars(0);



_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

--
”Wait, what if these quote marks are inside out, so everything in the rest of the document is the quotation and /this/ part isn't? Duuuuude.“
   — Randall Munroe


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]