////////////////////////////////////////////////////////////////////////////////
#include <gtk/gtk.h>
int
main (int argc, char **argv)
{
GtkWidget *window;
GtkWidget *vbox;
gtk_init (&argc, &argv);
/* create window, etc */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "notebook_da");
gtk_container_set_border_width (GTK_CONTAINER (window), 2);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_size_request (window, 400, 300);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (window), vbox);
{
GtkWidget *notebook_0;
GtkWidget *notebook_1;
notebook_0 = gtk_notebook_new ();
notebook_1 = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (vbox), notebook_0, TRUE, TRUE, 0);
{
GtkWidget *vbox_in_n0_page0;
GtkWidget *vbox_in_n0_page1;
GtkWidget *vbox_in_n0_page2;
vbox_in_n0_page0 = gtk_vbox_new (FALSE, 2);
vbox_in_n0_page1 = gtk_vbox_new (FALSE, 2);
vbox_in_n0_page2 = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (notebook_0), vbox_in_n0_page0);
{ ←ここは、{}で囲う必要は特にないが見やすいように囲っているだけ
GtkWidget *n0page0_label;
GtkWidget *n0page0_entry;
n0page0_label = gtk_label_new ("Page 0 / Note0");
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_0),
gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_0), 0),
n0page0_label);
n0page0_entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox_in_n0_page0), n0page0_entry, FALSE, FALSE, 12);
}
gtk_container_add (GTK_CONTAINER (notebook_0), vbox_in_n0_page1);
{
GtkWidget *n0page1_label;
n0page1_label = gtk_label_new ("Page 1 / Note0");
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_0),
gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_0), 1),
n0page1_label);
}
gtk_container_add (GTK_CONTAINER (notebook_0), vbox_in_n0_page2);
{
GtkWidget *n0page2_label;
n0page2_label = gtk_label_new ("Page 2 / Note0");
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_0),
gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_0), 2),
n0page2_label);
}
}
gtk_box_pack_start (GTK_BOX (vbox), notebook_1, TRUE, TRUE, 0);
{
GtkWidget *table_in_n1_page0;
GtkWidget *table_in_n1_page1;
table_in_n1_page0 = gtk_table_new (1, 1, TRUE); // col, row
table_in_n1_page1 = gtk_table_new (1, 1, TRUE); // col, row
gtk_container_add (GTK_CONTAINER (notebook_1), table_in_n1_page0);
{
GtkWidget *n1page0_label;
GtkWidget *n1page0_entry;
n1page0_label = gtk_label_new ("Page 0 / Note1");
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_1),
gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_1), 0),
n1page0_label);
n1page0_entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table_in_n1_page0), n1page0_entry,
0, 1, // left - rigth
0, 1, // top - bottom
GTK_FILL | GTK_SHRINK | GTK_EXPAND,
GTK_FILL | GTK_SHRINK ,
12, 12);
}
gtk_container_add (GTK_CONTAINER (notebook_1), table_in_n1_page1);
{
GtkWidget *n1page1_label;
n1page1_label = gtk_label_new ("Page 1 / Note1");
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_1),
gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_1), 1),
n1page1_label);
}
}
}
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
/////////////////////////////////////// EOF ////////////////////////////////////
|