2 * Copyright (C) 2004 Morten Welinder
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 static gint num_windows = 0;
24 on_delete_event (GtkWidget *w,
36 prepare_window_for_orientation (GtkOrientation orientation)
38 GtkWidget *window, *mainbox;
41 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
42 g_signal_connect (window, "delete_event", G_CALLBACK (on_delete_event), NULL);
44 mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
45 gtk_container_add (GTK_CONTAINER (window), mainbox);
47 for (max = 9; max <= 999999999; max = max * 10 + 9)
49 GtkAdjustment *adj = gtk_adjustment_new (max,
55 GtkWidget *spin = gtk_spin_button_new (adj, 1.0, 0);
56 gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), orientation);
57 gtk_widget_set_halign (GTK_WIDGET (spin), GTK_ALIGN_CENTER);
59 GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
60 gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 2);
61 gtk_container_add (GTK_CONTAINER (mainbox), hbox);
64 gtk_widget_show_all (window);
69 main (int argc, char **argv)
71 gtk_init (&argc, &argv);
73 prepare_window_for_orientation (GTK_ORIENTATION_HORIZONTAL);
74 prepare_window_for_orientation (GTK_ORIENTATION_VERTICAL);