Synopsis
#include <gtk/gtk.h>
GtkTooltips;
GtkTooltipsData;
GtkTooltips* gtk_tooltips_new (void);
void gtk_tooltips_enable (GtkTooltips *tooltips);
void gtk_tooltips_disable (GtkTooltips *tooltips);
void gtk_tooltips_set_delay (GtkTooltips *tooltips,
guint delay);
void gtk_tooltips_set_tip (GtkTooltips *tooltips,
GtkWidget *widget,
const gchar *tip_text,
const gchar *tip_private);
GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget);
void gtk_tooltips_force_window (GtkTooltips *tooltips);
gboolean gtk_tooltips_get_info_from_tip_window
(GtkWindow *tip_window,
GtkTooltips **tooltips,
GtkWidget **current_widget);
DescriptionGtkTooltips has been deprecated in GTK+ 2.12, in favor of the new GtkTooltip API. Tooltips are the messages that appear next to a widget when the mouse pointer is held over it for a short amount of time. They are especially helpful for adding more verbose descriptions of things such as buttons in a toolbar.
An individual tooltip belongs to a group of tooltips. A group is created with a call to
The length of time the user must keep the mouse over a widget before the tip is shown, can be altered with
To assign a tip to a particular GtkWidget, Note
Tooltips can only be set on widgets which have their own X window and
receive enter and leave events.
To check if a widget has its own window use The default appearance of all tooltips in a program is determined by the current GTK+ theme that the user has selected.
Information about the tooltip (if any) associated with an arbitrary widget can be retrieved using
Example 57. Adding tooltips to buttons.
GtkWidget *load_button, *save_button, *hbox;
GtkTooltips *button_bar_tips;
button_bar_tips = gtk_tooltips_new ();
/* Create the buttons and pack them into a GtkHBox */
hbox = gtk_hbox_new (TRUE, 2);
load_button = gtk_button_new_with_label ("Load a file");
gtk_box_pack_start (GTK_BOX (hbox), load_button, TRUE, TRUE, 2);
gtk_widget_show (load_button);
save_button = gtk_button_new_with_label ("Save a file");
gtk_box_pack_start (GTK_BOX (hbox), save_button, TRUE, TRUE, 2);
gtk_widget_show (save_button);
gtk_widget_show (hbox);
/* Add the tips */
gtk_tooltips_set_tip (GTK_TOOLTIPS (button_bar_tips), load_button,
"Load a new document into this window",
"Requests the filename of a document.
This will then be loaded into the current
window, replacing the contents of whatever
is already loaded.");
gtk_tooltips_set_tip (GTK_TOOLTIPS (button_bar_tips), save_button,
"Saves the current document to a file",
"If you have saved the document previously,
then the new version will be saved over the
old one. Otherwise, you will be prompted for
a filename.");
DetailsGtkTooltipstypedef struct _GtkTooltips GtkTooltips; Warning
Holds information about a group of tooltips. Fields should be changed using the functions provided, rather than directly accessing the struct's members. GtkTooltipsDatatypedef struct {
GtkTooltips *tooltips;
GtkWidget *widget;
gchar *tip_text;
gchar *tip_private;
} GtkTooltipsData;
Warning
gtk_tooltips_new ()GtkTooltips* gtk_tooltips_new (void); Warning
Creates an empty group of tooltips. This function initialises a GtkTooltips structure. Without at least one such structure, you can not add tips to your application.
gtk_tooltips_enable ()void gtk_tooltips_enable (GtkTooltips *tooltips); Warning
Allows the user to see your tooltips as they navigate your application.
gtk_tooltips_disable ()void gtk_tooltips_disable (GtkTooltips *tooltips); Warning
Causes all tooltips in
gtk_tooltips_set_delay ()void gtk_tooltips_set_delay (GtkTooltips *tooltips, guint delay); Warning
Sets the time between the user moving the mouse over a widget and the widget's tooltip appearing.
gtk_tooltips_set_tip ()void gtk_tooltips_set_tip (GtkTooltips *tooltips, GtkWidget *widget, const gchar *tip_text, const gchar *tip_private); Warning
Adds a tooltip containing the message
gtk_tooltips_data_get ()GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget); Warning
Retrieves any GtkTooltipsData previously associated with the given widget.
gtk_tooltips_force_window ()void gtk_tooltips_force_window (GtkTooltips *tooltips); Warning
Ensures that the window used for displaying the given Applications should never have to call this function, since GTK+ takes care of this.
gtk_tooltips_get_info_from_tip_window ()gboolean gtk_tooltips_get_info_from_tip_window
(GtkWindow *tip_window,
GtkTooltips **tooltips,
GtkWidget **current_widget);
Warning
Determines the tooltips and the widget they belong to from the window in which they are displayed. This function is mostly intended for use by accessibility technologies; applications should have little use for it.
Since 2.4 | ||||||||||||||||||||||||||||||||||||||||||