GTK4_GG_hack/cold.c

30 lines
1.0 KiB
C
Raw Normal View History

2024-04-27 16:16:21 +02:00
#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
void print_text(GtkWidget *widget, gpointer data) {g_print (data);}
2024-04-28 06:21:57 +02:00
void button_0(GtkWindow *window, GtkWidget *grid, int x, int y, int w, int h){
GtkWidget *button_0 = gtk_button_new_with_label ("Quit");
g_signal_connect (button_0, "clicked", G_CALLBACK (print_text), "bye !...\n");
g_signal_connect_swapped (button_0, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_grid_attach (GTK_GRID (grid), button_0, x, y, w, h);
}
void button_1(GtkWidget *grid, int x, int y, int w, int h){
GtkWidget *button_1 = gtk_button_new_with_label ("bouton (I)");
g_signal_connect (button_1, "clicked", G_CALLBACK (print_text), "n°1\n");
gtk_grid_attach (GTK_GRID (grid), button_1, x, y, w, h);
}
void window_bar(GtkWindow *window, char *title){
GtkWidget *titlebar = gtk_header_bar_new();
gtk_window_set_title (window, title);
gtk_window_set_titlebar (window, titlebar); // header_bar
}
void window_grid(GtkWindow *window){
GtkWidget *grid = gtk_grid_new();
gtk_window_set_child (window, grid);
}