Re: Tooltips for GtkTreeView?



On Thu, 2007-02-22 at 20:50 +0100, Jan-Oliver Wagner wrote: 
does anyone established tooltips for the entries in a GtkTreeView?

I've not found anything ready-to-use in the GTK API nor through a google 
search. So, any hint is welcome.

You want Kris's super-shiny new tooltips API, which is so super-shiny
that it isn't in a released version (will be in GTK+ 2.12) and isn't
even properly documented yet.  No, it isn't possible with pre-2.12,
though there are some hacks floating around I believe.  (Fairly obvious:
you monitor mouse motion over the treeview and continually update the
tooltip text.  Rather inefficient, of course.)

AIUI (though I might be very wrong) you set the "has-tooltip"[0]
property on the widget, and then connect to "query-tooltip"[1]:

gboolean user_function (GtkWidget *widget, 
                        gint        x,
                        gint        y,
                        gboolean    keyboard_mode,
                        GtkTooltip *tooltip,
                        gpointer    user_data)

In the callback you use gtk_tree_view_get_path_at_pos[2] to work out
what tooltip to display, and then use the super-shiny undocumented API
on the GtkTooltip (not to be confused with GtkTooltips, oh no) to set
the tooltip text (or image, or arbitrary widget, hooray!)

Hope this is what you were looking for,

Ed

0.http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget--has-tooltip
1.http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-query-tooltip
2.http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-get-path-at-pos




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