summaryrefslogtreecommitdiff
path: root/tests/testtooltips.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-07-24 03:50:49 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-07-24 03:50:49 +0000
commitffcc8ddb950c27879f37d2d34bec3a4fb3e60d12 (patch)
tree85d1651f42400a84de393eddfdd7b9c90f52cf13 /tests/testtooltips.c
parentd40531635e93359202ba7818d84550141b9feb9d (diff)
downloadgtk+-ffcc8ddb950c27879f37d2d34bec3a4fb3e60d12.tar.gz
Add code to test gtk_tooltip_set_custom()
2007-07-23 Matthias Clasen <mclasen@redhat.com> * tests/testtooltips.c: Add code to test gtk_tooltip_set_custom() svn path=/trunk/; revision=18533
Diffstat (limited to 'tests/testtooltips.c')
-rw-r--r--tests/testtooltips.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 2040e7a8c2..586d2ff4df 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -239,6 +239,21 @@ drawing_area_expose (GtkWidget *drawing_area,
return FALSE;
}
+static gboolean
+query_tooltip_label_cb (GtkWidget *widget,
+ gint x,
+ gint y,
+ gboolean keyboard_tip,
+ GtkTooltip *tooltip,
+ gpointer data)
+{
+ GtkWidget *custom = data;
+
+ gtk_tooltip_set_custom (tooltip, custom);
+
+ return TRUE;
+}
+
int
main (int argc, char *argv[])
{
@@ -246,6 +261,7 @@ main (int argc, char *argv[])
GtkWidget *box;
GtkWidget *drawing_area;
GtkWidget *button;
+ GtkWidget *label;
GtkWidget *tooltip_window;
GtkWidget *tooltip_button;
@@ -390,6 +406,22 @@ main (int argc, char *argv[])
G_CALLBACK (query_tooltip_drawing_area_cb), NULL);
gtk_box_pack_start (GTK_BOX (box), drawing_area, FALSE, FALSE, 2);
+ button = gtk_label_new ("Custom tooltip I");
+ label = gtk_label_new ("See, custom");
+ g_object_ref_sink (label);
+ g_object_set (button, "has-tooltip", TRUE, NULL);
+ g_signal_connect (button, "query-tooltip",
+ G_CALLBACK (query_tooltip_label_cb), label);
+ gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 2);
+
+ button = gtk_label_new ("Custom tooltip II");
+ label = gtk_label_new ("See, custom, too");
+ g_object_ref_sink (label);
+ g_object_set (button, "has-tooltip", TRUE, NULL);
+ gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 2);
+ g_signal_connect (button, "query-tooltip",
+ G_CALLBACK (query_tooltip_label_cb), label);
+
/* Done! */
gtk_widget_show_all (window);