Re: Ellipsizing

2018-01-30 Thread Phil Wolff
For my purposes, using TreeViewColumn->get_width() works well enough. Which brings up a related question: Absent a writable TreeViewColumn->property_width(), is there any way to tell GTK exactly where between the min/max values you want the column width to be initialized? I could probably acco

Re: Ellipsizing

2018-01-29 Thread Phil Wolff
CellRendererText has no get_allocated_width() (or get_allocation()). I'll have to pursue this tomorrow… On 01/29/2018 12:48 PM, Daniel Boles wrote: erm, of course that should be set_has_tooltip( natural > get_allocated_width() ); ___ gtkmm-list ma

Re: Ellipsizing

2018-01-29 Thread Daniel Boles
Haha, what a team. Well, thankfully, I can confirm: simply doing label.set_tooltip_text(label.get_layout()->is_ellipsized() ? text : "") after updating the label text seems to work OK in my case. Fingers crossed it stays that way, and I'll keep the much shorter code. :D

Re: Ellipsizing

2018-01-29 Thread Phil Wolff
...and thank you for that! I found is_ellipsized() because I was looking high and low for a reference to get_layout() that I just *knew* I'd seen somewhere… On 01/29/2018 03:58 PM, Daniel Boles wrote: It would be nice to have proper API for this; I'd support a feature request on the GTK+ side

Re: Ellipsizing

2018-01-29 Thread Daniel Boles
It would be nice to have proper API for this; I'd support a feature request on the GTK+ side, if one doesn't already exist (I don't recall finding one). That said, it should be a general thing for text widgets. That is: including GtkLabel and co. And there's something I only just realised, because

Re: Ellipsizing

2018-01-29 Thread Phil Wolff
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 enhancemen

Re: Ellipsizing

2018-01-29 Thread Daniel Boles
I should also emphasise that this was with a GtkLabel, and I've not specifically tested whether the same process works for a CellRendererText, but hopefully it will ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/g

Re: Ellipsizing

2018-01-29 Thread Daniel Boles
erm, of course that should be set_has_tooltip( natural > get_allocated_width() ); ___ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list

Re: Ellipsizing

2018-01-29 Thread Daniel Boles
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 allocat