Re: How to set a tool tip on a gtk_tree_store ?
- From: Kristian Rietveld <kris gtk org>
- To: Gregory Hosler <ghosler redhat com>
- Cc: GTK developer list <gtk-app-devel-list gnome org>
- Subject: Re: How to set a tool tip on a gtk_tree_store ?
- Date: Mon, 11 May 2009 19:57:30 +0200
On Mon, May 11, 2009 at 6:55 PM, Gregory Hosler <ghosler redhat com> wrote:
The problem I'm facing is getting the GtkTooltip of a cell of the GtkTreeStore.
You should keep in mind that tooltips operate on GtkWidgets; a
GtkTreeStore is not a widget. Instead you use the widget GtkTreeView
which displays the GtkTreeStore for you.
I have read on gtk_tree_view_set_tooltip_cell(), but this requires me to
identify the GtkTreePath (to identify the row) and GtkTreeViewColumn (to
identify the column), and set the GtkTooltip. Again, I need a GtkTooltip.
The GtkTooltip doesn't appear to have a "new" function, and only appears to be
obtainable by setting the "has-tooltip" (which I would want to set on the cell),
and then the invoked callback from the "query-tooltip" signal. The problem is
that the private data will be different for each individual cell which has a
tool tip.
GtkTooltip objects are always obtained in a query-tooltip callback,
you do not create them yourself.
The workflow for tooltips on tree views is basically:
1. Set has-tooltip to TRUE on the tree view widget and install a
query-tooltip signal handler.
2. In the signal handler you obtain the path and column/cell from the
given (x, y) coordinates.
3. Decide whether or not you want to display a tooltip for these coordinates.
See
http://git.gnome.org/cgit/gtk+/tree/tests/testtooltips.c
for a brief example. (It uses gtk_tree_view_set_tooltip_row() though,
but it should get the point across and you'll then understand how to
substitute the usage of gtk_tree_view_set_tooltip_row() with
gtk_tree_view_set_tooltip_cell()).
regards,
-kris.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]