From ffcc8ddb950c27879f37d2d34bec3a4fb3e60d12 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 24 Jul 2007 03:50:49 +0000 Subject: [PATCH] Add code to test gtk_tooltip_set_custom() 2007-07-23 Matthias Clasen * tests/testtooltips.c: Add code to test gtk_tooltip_set_custom() svn path=/trunk/; revision=18533 --- ChangeLog | 4 ++++ tests/testtooltips.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/ChangeLog b/ChangeLog index 93e88218e0..0cb397c02f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-07-23 Matthias Clasen + + * tests/testtooltips.c: Add code to test gtk_tooltip_set_custom() + 2007-07-23 Christian Persch * tests/testtooltips.c: (query_tooltip_tree_view_cb): Remove obsolete 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);