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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| // la fonction associée à l'ajout
void Ajouter(GtkWidget *widget, gpointer data)
{
gtk_widget_destroy(F_Acceuil); // F_acceuil la fenetre principale
// gtk_widget_destroy(WindowManu);
GtkWidget * F_Ajouter=NULL; // declaration de la fenetre
GtkWidget * Layout1,*Layout2; // declaration de layout
GtkWidget * Frame;
GtkWidget * Label[3]; // declaration des labels
GtkWidget * button[2]; // les buttons valider,annuler et effacer
GtkWidget * vBox,* pVBoxFrame;
GtkWidget * enty[2]; // declaration des saisies de données
/****** creation de la fenetre ********/
F_Ajouter=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(F_Ajouter),"Nouveau Article");
gtk_window_set_default_size(GTK_WINDOW(F_Ajouter),600,400);
gtk_window_set_position(GTK_WINDOW(F_Ajouter),GTK_WIN_POS_CENTER);
Layout1=gtk_layout_new(NULL,NULL);
gtk_container_add(GTK_CONTAINER(F_Ajouter), GTK_WIDGET(Layout1));
/*Couleur bleu pale du layout*/
GdkColor color;
color.pixel = 0;
color.red=60500;
color.green=62001;
color.blue=63504;
gtk_widget_modify_bg(GTK_WIDGET(Layout1), GTK_STATE_NORMAL, &color);
// creation, personnalisation et positionnement des labels
Label[0]=gtk_label_new("");
Label[1]=gtk_label_new("");
Label[2]=gtk_label_new("");
Label[3]=gtk_label_new("");
gtk_label_set_markup(GTK_LABEL(Label[0]), "<span font_desc=\"Times New Roman italic 20\"foreground=\"#0000FF\">Ajouter Article</span>\n");
gtk_label_set_markup(GTK_LABEL(Label[1]), "<span font_desc=\"Times New Roman 12\">Code Article </span>\n");
gtk_label_set_markup(GTK_LABEL(Label[2]), "<span font_desc=\"Times New Roman 12\">Prix Article</span>\n");
gtk_label_set_markup(GTK_LABEL(Label[3]), "<span font_desc=\"Times New Roman 12\"> Libelle Article</span>\n");
gtk_layout_put (GTK_LAYOUT(Layout1),Label[0],200,10);
gtk_layout_put (GTK_LAYOUT(Layout1),Label[1],50,100);
gtk_layout_put (GTK_LAYOUT(Layout1),Label[2],50,140);
gtk_layout_put (GTK_LAYOUT(Layout1),Label[3],50,180);
// creation, et positionnement des buttons
button[0]=gtk_button_new_with_label(" Valider ");
button[1]=gtk_button_new_with_label(" Effacer ");
button[2]=gtk_button_new_with_label(" Annuler ");
gtk_layout_put (GTK_LAYOUT(Layout1),button[0],70,240);
gtk_layout_put (GTK_LAYOUT(Layout1),button[1],140,240);
gtk_layout_put (GTK_LAYOUT(Layout1),button[2],210,240);
// création & positionnement des zones de de saisies
// l'affichage de la fenetre et ses widgets
gtk_widget_show_all(F_Ajouter);
} |
Partager