Hi Augusto,
This doesn't use glade but it might help out. You can add a label and button to
a box and add it to the notebook tab. In the button "clicked" callback you can
us the notebook pointer if you need that variable. If you want to be able to
really customize the look and size of the button you could replace it with a
drawing area and draw your own button.
Eric
/*
gcc -Wall notebook1.c -o notebook1 `pkg-config --cflags --libs gtk+-3.0`
Tested with GTK3.18 on Ubuntu16.04
*/
#include
static void button_clicked(GtkWidget *button, GtkWidget *notebook)
{
g_print("Clicked\n");
}
int main(int argc, char *argv[])
{
gtk_init (&argc, &argv);
GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Notebook");
gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
GtkWidget *label1=gtk_label_new("page1");
GtkWidget *label2=gtk_label_new("page2");
GtkWidget *nb_label1=gtk_label_new("tab1");
GtkWidget *nb_label2=gtk_label_new("tab2");
GtkWidget *x_label=gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(x_label), "x");
GtkWidget *button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button), x_label);
GtkWidget *box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start(GTK_BOX(box), nb_label2, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
gtk_widget_show_all(box);
GtkWidget *notebook=gtk_notebook_new();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), label1, nb_label1);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), label2, box);
g_signal_connect(button, "clicked", G_CALLBACK(button_clicked), notebook);
gtk_container_add(GTK_CONTAINER(window), notebook);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list