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
This commit is contained in:
Matthias Clasen 2007-07-24 03:50:49 +00:00 committed by Matthias Clasen
parent d40531635e
commit ffcc8ddb95
2 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2007-07-23 Matthias Clasen <mclasen@redhat.com>
* tests/testtooltips.c: Add code to test gtk_tooltip_set_custom()
2007-07-23 Christian Persch <chpe@gnome.org> 2007-07-23 Christian Persch <chpe@gnome.org>
* tests/testtooltips.c: (query_tooltip_tree_view_cb): Remove obsolete * tests/testtooltips.c: (query_tooltip_tree_view_cb): Remove obsolete

View File

@ -239,6 +239,21 @@ drawing_area_expose (GtkWidget *drawing_area,
return FALSE; 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 int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
@ -246,6 +261,7 @@ main (int argc, char *argv[])
GtkWidget *box; GtkWidget *box;
GtkWidget *drawing_area; GtkWidget *drawing_area;
GtkWidget *button; GtkWidget *button;
GtkWidget *label;
GtkWidget *tooltip_window; GtkWidget *tooltip_window;
GtkWidget *tooltip_button; GtkWidget *tooltip_button;
@ -390,6 +406,22 @@ main (int argc, char *argv[])
G_CALLBACK (query_tooltip_drawing_area_cb), NULL); G_CALLBACK (query_tooltip_drawing_area_cb), NULL);
gtk_box_pack_start (GTK_BOX (box), drawing_area, FALSE, FALSE, 2); 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! */ /* Done! */
gtk_widget_show_all (window); gtk_widget_show_all (window);