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 38 39 40 41 42
|
void FCT_DisplayMessage (gchar *message)
{
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *vbox;
GtkTextBuffer *buffer;
GtkWidget *text_view;
// Création de la fênetre
//~~~~~~~~~~~~~~
dialog = gtk_dialog_new ();
// Paramétrage : window c'est la fenêtre mère
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_set_title (GTK_WINDOW (dialog), "Information");
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
// Création d'un ~vbx
//~~~~~~~~~~~~~~~~~~~~
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(dialog), vbox);
// Création d'un text view
//~~~~~~~~~~~~~~~~~~~~~~~~
text_view = gtk_text_view_new();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_set_text (buffer, message, -1);
gtk_text_view_set_editable(GTK_TEXT_VIEW (text_view),FALSE) ;
gtk_box_pack_start(GTK_BOX(vbox), text_view, TRUE, TRUE, 0) ;
// On affiche tous les widgets
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gtk_widget_show_all (dialog);
} |
Partager