1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| #include <gtk/gtk.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
GtkWidget *pWindow;
GtkWidget *pLabel;
GtkWidget *pBouton;
GtkWidget *pVBox;
GtkWidget *pImage;
GtkWidget *tooltips;
gtk_init(&argc, &argv);
pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);
pVBox = gtk_vbox_new(TRUE, 0);
tooltips = gtk_tooltips_new ();
pImage = gtk_image_new_from_file("img.png");
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), pImage,"Image",NULL);
pLabel=gtk_label_new("Hello World!");
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), pLabel,"Label",NULL);
pBouton=gtk_button_new_with_label("Hello");
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), pBouton,"Bouton",NULL);
gtk_container_add(GTK_CONTAINER(pVBox), pLabel);
gtk_container_add(GTK_CONTAINER(pVBox), pBouton);
gtk_container_add(GTK_CONTAINER(pVBox), pImage);
gtk_container_add(GTK_CONTAINER(pWindow), pVBox);
gtk_widget_show_all(pWindow);
gtk_main();
return EXIT_SUCCESS;
} |
Partager