Class
GtkTooltip
since: 4.0
Description [src]
final class Gtk.Tooltip : GObject.Object
{
/* No available fields */
}
GtkTooltip is an object representing a widget tooltip.
Basic tooltips can be realized simply by using
gtk_widget_set_tooltip_text() or
gtk_widget_set_tooltip_markup() without
any explicit tooltip object.
When you need a tooltip with a little more fancy contents,
like adding an image, or you want the tooltip to have different
contents per GtkTreeView row or cell, you will have to do a
little more work:
-
Set the
GtkWidget:has-tooltipproperty toTRUE. This will make GTK monitor the widget for motion and related events which are needed to determine when and where to show a tooltip. -
Connect to the
GtkWidget::query-tooltipsignal. This signal will be emitted when a tooltip is supposed to be shown. One of the arguments passed to the signal handler is aGtkTooltipobject. This is the object that we are about to display as a tooltip, and can be manipulated in your callback using functions likegtk_tooltip_set_icon(). There are functions for setting the tooltip’s markup, setting an image from a named icon, or even putting in a custom widget. -
Return
TRUEfrom your ::query-tooltip handler. This causes the tooltip to be show. If you returnFALSE, it will not be shown.
Available since: 4.0
Instance methods
gtk_tooltip_set_custom
Replaces the widget packed into the tooltip with
custom_widget. custom_widget does not get destroyed when the tooltip goes
away.
By default a box with a GtkImage and GtkLabel is embedded in
the tooltip, which can be configured using gtk_tooltip_set_markup()
and gtk_tooltip_set_icon().
since: 4.0
gtk_tooltip_set_icon
Sets the icon of the tooltip (which is in front of the text) to be
paintable. If paintable is NULL, the image will be hidden.
since: 4.0
gtk_tooltip_set_icon_from_gicon
Sets the icon of the tooltip (which is in front of the text)
to be the icon indicated by gicon with the size indicated
by size. If gicon is NULL, the image will be hidden.
since: 4.0
gtk_tooltip_set_icon_from_icon_name
Sets the icon of the tooltip (which is in front of the text) to be
the icon indicated by icon_name with the size indicated
by size. If icon_name is NULL, the image will be hidden.
since: 4.0
gtk_tooltip_set_tip_area
Sets the area of the widget, where the contents of this tooltip apply,
to be rect (in widget coordinates). This is especially useful for
properly setting tooltips on GtkTreeView rows and cells, GtkIconViews, etc.
since: 4.0
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
since: 2.0