GTK4_GG_hack/cold.c

61 lines
2.1 KiB
C

#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
void print_text(GtkWidget *widget, gpointer data) {g_print (data);}
void click_print_do (GtkWindow *window, GtkWidget *grid,
char *label, char *text, int x, int y, int w, int h){
GtkWidget *button = gtk_button_new_with_label (label);
gtk_grid_attach (GTK_GRID (grid), button, x, y, w, h);
g_signal_connect (button, "clicked", G_CALLBACK (print_text), text);
if (window)
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
}
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);
}
/*----------------------------------------------------------------------------*/
/* GtkBox GtkGrid GtkRevealer GtkStack
* GtkOverlay GtkPaned GtkExpander GtkFixed */
/* GtkBox
* int spacing = 8;
* box = gtk_box_new (0, spacing);
* 0 = GTK_ORIENTATION_HORIZONTAL, 1 = GTK_ORIENTATION_VERTICAL
* 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);
* 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 */
/* TODO or NOT TODO
*
* GtkRevealer *revealer = gtk_revealer_new();
* gtk_revealer_set_child (GTK_ ? (revealer), box);
* gtk_revealer_set_transition_type (revealer, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
*
*/
// GtkWidget *overlay = gtk_overlay_new();
// gtk_overlay_set_buildable_id (GTK_BUILDABLE(overlay), "overlay id");
// printf("overlay %s\n", gtk_buildable_get_buildable_id (GTK_BUILDABLE(overlay)));
// how do I attach a widget to a page ?