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
| #include <stdlib.h>
#include <gtk/gtk.h>
void OnDestroy(GtkWidget *pWidget, gpointer pData);
int main(int argc,char **argv)
{
/* Declaration du widget */
GtkWidget *pWindow;
gtk_init(&argc,&argv);
/* Creation de la fenetre */
pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* Definition de la position */
gtk_window_set_position(GTK_WINDOW(pWindow), GTK_WIN_POS_CENTER);
/* Definition de la taille de la fenetre */
gtk_window_set_default_size(GTK_WINDOW(pWindow), 320, 200);
/* Titre de la fenetre */
gtk_window_set_title(GTK_WINDOW(pWindow), "Chapitre Fenetre");
/* Connexion du signal "destroy" */
g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(OnDestroy), NULL);
/* Affichage de la fenetre */
gtk_widget_show(pWindow);
/* Demarrage de la boucle evenementielle */
gtk_main();
return EXIT_SUCCESS;
}
void OnDestroy(GtkWidget *pWidget, gpointer pData)
{
/* Arret de la boucle evenementielle */
gtk_main_quit();
} |
Partager