Trivial formatting fixes to all examples, simple functional fixes to
* docs/tutorial/gtk-tut.sgml, docs/examples/*: Trivial formatting fixes to all examples, simple functional fixes to rangewidgets example.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
void rotate_book( GtkButton *button,
|
||||
GtkNotebook *notebook )
|
||||
{
|
||||
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos +1) %4);
|
||||
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
|
||||
}
|
||||
|
||||
/* Add/Remove the page tabs and the borders */
|
||||
@ -30,7 +30,7 @@ void remove_book( GtkButton *button,
|
||||
{
|
||||
gint page;
|
||||
|
||||
page = gtk_notebook_get_current_page(notebook);
|
||||
page = gtk_notebook_get_current_page (notebook);
|
||||
gtk_notebook_remove_page (notebook, page);
|
||||
/* Need to refresh the widget --
|
||||
This forces the widget to redraw itself. */
|
||||
@ -64,23 +64,23 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
table = gtk_table_new(3,6,FALSE);
|
||||
table = gtk_table_new (3, 6, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
/* Create a new notebook, place the position of the tabs */
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0,6,0,1);
|
||||
gtk_widget_show(notebook);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), notebook, 0, 6, 0, 1);
|
||||
gtk_widget_show (notebook);
|
||||
|
||||
/* Let's append a bunch of pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Append Frame %d", i+1);
|
||||
sprintf(bufferl, "Page %d", i+1);
|
||||
for (i = 0; i < 5; i++) {
|
||||
sprintf(bufferf, "Append Frame %d", i + 1);
|
||||
sprintf(bufferl, "Page %d", i + 1);
|
||||
|
||||
frame = gtk_frame_new (bufferf);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
|
||||
@ -104,9 +104,9 @@ int main( int argc,
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), checkbutton, label, 2);
|
||||
|
||||
/* Now finally let's prepend pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Prepend Frame %d", i+1);
|
||||
sprintf(bufferl, "PPage %d", i+1);
|
||||
for (i = 0; i < 5; i++) {
|
||||
sprintf (bufferf, "Prepend Frame %d", i + 1);
|
||||
sprintf (bufferl, "PPage %d", i + 1);
|
||||
|
||||
frame = gtk_frame_new (bufferf);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
|
||||
@ -118,56 +118,56 @@ int main( int argc,
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (bufferl);
|
||||
gtk_notebook_prepend_page (GTK_NOTEBOOK(notebook), frame, label);
|
||||
gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), frame, label);
|
||||
}
|
||||
|
||||
/* Set what page to start at (page 4) */
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 3);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 3);
|
||||
|
||||
/* Create a bunch of buttons */
|
||||
button = gtk_button_new_with_label ("close");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,1,2);
|
||||
gtk_widget_show(button);
|
||||
GTK_SIGNAL_FUNC (delete), NULL);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("next page");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,1,2);
|
||||
gtk_widget_show(button);
|
||||
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("prev page");
|
||||
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 2,3,1,2);
|
||||
gtk_widget_show(button);
|
||||
GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("tab position");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (rotate_book),
|
||||
GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2);
|
||||
gtk_widget_show(button);
|
||||
GTK_SIGNAL_FUNC (rotate_book),
|
||||
GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 3, 4, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("tabs/border on/off");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tabsborder_book),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 4,5,1,2);
|
||||
gtk_widget_show(button);
|
||||
GTK_SIGNAL_FUNC (tabsborder_book),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 4, 5, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("remove page");
|
||||
g_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (remove_book),
|
||||
GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2);
|
||||
gtk_widget_show(button);
|
||||
GTK_SIGNAL_FUNC (remove_book),
|
||||
GTK_OBJECT (notebook));
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 5, 6, 1, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show(table);
|
||||
gtk_widget_show(window);
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
|
Reference in New Issue
Block a user