GTK+ Reference Manual | ||||
---|---|---|---|---|
#include <gtk/gtk.h> GtkTooltip; void gtk_tooltip_set_markup (GtkTooltip *tooltip, const gchar *markup); void gtk_tooltip_set_text (GtkTooltip *tooltip, const gchar *text); void gtk_tooltip_set_icon (GtkTooltip *tooltip, GdkPixbuf *pixbuf); void gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip, const gchar *stock_id, GtkIconSize size); void gtk_tooltip_set_custom (GtkTooltip *tooltip, GtkWidget *custom_widget); void gtk_tooltip_trigger_tooltip_query (GdkDisplay *display);
GtkTooltip belongs to the new tooltips API that was introduced in GTK+ 2.12 and which deprecates the old GtkTooltips API.
Basic tooltips can be realized simply by using
gtk_widget_set_tooltip_text()
or gtk_widget_set_tooltip_markup()
without
any explicit tooltip object. For fancy tooltips, you will likely
connect to the "query-tooltip" signal, which is passed
a GtkTooltip object as the last parameter. You can use functions
like gtk_tooltip_set_icon()
to modify the tooltip.
void gtk_tooltip_set_markup (GtkTooltip *tooltip, const gchar *markup);
Sets the text of the tooltip to be markup
, which is marked up
with the Pango text markup language.
If markup
is NULL
, the label will be hidden.
tooltip : |
a GtkTooltip |
markup : |
a markup string (see Pango markup format) or NULL
|
Since 2.12
void gtk_tooltip_set_text (GtkTooltip *tooltip, const gchar *text);
Sets the text of the tooltip to be text
. If text
is NULL
, the label
will be hidden. See also gtk_tooltip_set_markup()
.
tooltip : |
a GtkTooltip |
text : |
a text string or NULL
|
Since 2.12
void gtk_tooltip_set_icon (GtkTooltip *tooltip, GdkPixbuf *pixbuf);
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.
tooltip : |
a GtkTooltip |
pixbuf : |
a GdkPixbuf, or NULL
|
Since 2.12
void gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip, const gchar *stock_id, GtkIconSize size);
Sets the icon of the tooltip (which is in front of the text) to be
the stock item indicated by stock_id
with the size indicated
by size
. If stock_id
is NULL
, the image will be hidden.
tooltip : |
a GtkTooltip |
stock_id : |
a stock icon name, or NULL
|
size : |
a stock icon size |
Since 2.12
void gtk_tooltip_set_custom (GtkTooltip *tooltip, GtkWidget *custom_widget);
Replaces the widget packed into the tooltip with custom_widget
.
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()
.
tooltip : |
a GtkTooltip |
custom_widget : |
a GtkWidget |
Since 2.12
void gtk_tooltip_trigger_tooltip_query (GdkDisplay *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 widget changed by a
key press.
display : |
a GtkDisplay |
Since 2.12