gtk.tooltip

Module for [Tooltip] class

Types 3

Basic tooltips can be realized simply by using [gtk.widget.Widget.setTooltipText] or [gtk.widget.Widget.setTooltipMarkup] 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-tooltip property to true, 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-tooltip signal. This signal will be

emitted when a tooltip is supposed to be shown. One of the arguments passed to the signal handler is a GtkTooltip object. This is the object that we are about to display as a tooltip, and can be manipulated in your callback using functions like [gtk.tooltip.Tooltip.setIcon]. There are functions for setting the tooltip’s markup, setting an image from a named icon, or even putting in a custom widget.

Return true from your query-tooltip handler. This causes the tooltip to be show. If you return false, it will not be shown.

In the probably rare case where you want to have even more control over the tooltip that is about to be shown, you can set your own #GtkWindow which will be used as tooltip window. This works as follows:

  • Set #GtkWidget:has-tooltip and connect to #GtkWidget::query-tooltip as before.

Use [gtk.widget.Widget.setTooltipWindow] to set a #GtkWindow created by you as tooltip window.

  • In the #GtkWidget::query-tooltip callback you can access your window using

[gtk.widget.Widget.getTooltipWindow] and manipulate as you wish. The semantics of the return value are exactly as before, return true to show the window, false to not show it.

Methods
GType _gType() @property
Tooltip self()Returns `this`, for use in `with` statements.
TooltipGidBuilder builder()Get builder for [gtk.tooltip.Tooltip] Returns: New builder object
void triggerTooltipQuery(gdk.display.Display display)Triggers a new tooltip query on display, in order to update the current visible tooltip, or to show/hide the current tooltip. This function is useful to call when, for example, the state of the wi...
void setCustom(gtk.widget.Widget customWidget = null)Replaces the widget packed into the tooltip with customwidget. customwidget does not get destroyed when the tooltip goes away. By default a box with a #GtkImage and #GtkLabel is embedded in the too...
void setIcon(gdkpixbuf.pixbuf.Pixbuf pixbuf = null)Sets the icon of the tooltip (which is in front of the text) to be pixbuf. If pixbuf is null, the image will be hidden.
void setIconFromGicon(gio.icon.Icon gicon, gtk.types.IconSize size)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.
void setIconFromIconName(string iconName, gtk.types.IconSize size)Sets the icon of the tooltip (which is in front of the text) to be the icon indicated by iconname with the size indicated by size. If iconname is null, the image will be hidden.
void setIconFromStock(string stockId, gtk.types.IconSize size)Sets the icon of the tooltip (which is in front of the text) to be the stock item indicated by stockid with the size indicated by size. If stockid is null, the image will be hidden.
void setMarkup(string markup = null)Sets the text of the tooltip to be markup, which is marked up with the [Pango text markup language][PangoMarkupFormat]. If markup is null, the label will be hidden.
void setText(string text = null)Sets the text of the tooltip to be text. If text is null, the label will be hidden. See also [gtk.tooltip.Tooltip.setMarkup].
void setTipArea(gdk.rectangle.Rectangle rect)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, #...
Constructors
this(void * ptr, Flag!"Take" take)

Fluent builder for [gtk.tooltip.Tooltip]

Methods
Tooltip build()