une grille pour plusieurs boutons (mini commit)

This commit is contained in:
Jean Sirmai 2024-04-22 20:00:37 +02:00
parent f2835b9bb0
commit 4157c93edf
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 16 additions and 2 deletions

BIN
exec

Binary file not shown.

18
main.c
View File

@ -1,3 +1,17 @@
/* GtkBox GtkGrid GtkRevealer GtkStack
* GtkOverlay GtkPaned GtkExpander GtkFixed */
/* box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_halign (box, GTK_ALIGN_FILL);
gtk_widget_set_valign (box, GTK_ALIGN_CENTER); * START CENTER END FILL *
gtk_window_set_child (GTK_WINDOW (window), box);
puis, après déclaration du bouton, gtk_box_append (GTK_BOX (box), button); */
/* grid = gtk_grid_new ();
gtk_window_set_child (GTK_WINDOW (window), grid);
button = gtk_button_new_with_label (" I "); n fois
gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); n fois */
#include <gtk/gtk.h> #include <gtk/gtk.h>
static void print (GtkWidget *widget, gpointer data) {g_print (data);} static void print (GtkWidget *widget, gpointer data) {g_print (data);}
@ -10,8 +24,8 @@ static void activate (GtkApplication *app, gpointer user_data) {
window = gtk_application_window_new (app); window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window"); gtk_window_set_title (GTK_WINDOW (window), "Window");
grid = gtk_grid_new (); grid = gtk_grid_new ();
gtk_window_set_child (GTK_WINDOW (window), grid); gtk_window_set_child (GTK_WINDOW (window), grid);
button = gtk_button_new_with_label (" I "); button = gtk_button_new_with_label (" I ");
g_signal_connect (button, "clicked", G_CALLBACK (print), "I'm n°1\n"); g_signal_connect (button, "clicked", G_CALLBACK (print), "I'm n°1\n");