]> Pileus Git - ~andy/gtk/blob - tests/testspinbutton.c
Change FSF Address
[~andy/gtk] / tests / testspinbutton.c
1 /* testspinbutton.c
2  * Copyright (C) 2004 Morten Welinder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 #include "config.h"
19 #include <gtk/gtk.h>
20
21 int
22 main (int argc, char **argv)
23 {
24         GtkWidget *window, *mainbox;
25         int max;
26
27         gtk_init (&argc, &argv);
28
29         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
30         g_signal_connect (window, "delete_event", gtk_main_quit, NULL);
31
32         mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
33         gtk_container_add (GTK_CONTAINER (window), mainbox);
34
35         for (max = 9; max <= 999999999; max = max * 10 + 9) {
36                 GtkAdjustment *adj = gtk_adjustment_new (max,
37                                                          1, max,
38                                                          1,
39                                                          (max + 1) / 10,
40                                                          0.0);
41
42                 GtkWidget *spin = gtk_spin_button_new (adj, 1.0, 0);
43                 GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
44
45                 gtk_box_pack_start (GTK_BOX (hbox),
46                                     spin,
47                                     FALSE,
48                                     FALSE,
49                                     2);
50
51                 gtk_container_add (GTK_CONTAINER (mainbox), hbox);
52
53         }
54
55         gtk_widget_show_all (window);
56
57         gtk_main ();
58
59         return 0;
60 }