4 /* Create an Arrow widget with the specified parameters
5 * and pack it into a button */
6 GtkWidget *create_arrow_button( GtkArrowType arrow_type,
7 GtkShadowType shadow_type )
12 button = gtk_button_new ();
13 arrow = gtk_arrow_new (arrow_type, shadow_type);
15 gtk_container_add (GTK_CONTAINER (button), arrow);
17 gtk_widget_show (button);
18 gtk_widget_show (arrow);
26 /* GtkWidget is the storage type for widgets */
31 /* Initialize the toolkit */
32 gtk_init (&argc, &argv);
34 /* Create a new window */
35 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
37 gtk_window_set_title (GTK_WINDOW (window), "Arrow Buttons");
39 /* It's a good idea to do this for all windows. */
40 g_signal_connect (G_OBJECT (window), "destroy",
41 G_CALLBACK (gtk_main_quit), NULL);
43 /* Sets the border width of the window. */
44 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
46 /* Create a box to hold the arrows/buttons */
47 box = gtk_hbox_new (FALSE, 0);
48 gtk_container_set_border_width (GTK_CONTAINER (box), 2);
49 gtk_container_add (GTK_CONTAINER (window), box);
51 /* Pack and show all our widgets */
52 gtk_widget_show (box);
54 button = create_arrow_button (GTK_ARROW_UP, GTK_SHADOW_IN);
55 gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
57 button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
58 gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
60 button = create_arrow_button (GTK_ARROW_LEFT, GTK_SHADOW_ETCHED_IN);
61 gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
63 button = create_arrow_button (GTK_ARROW_RIGHT, GTK_SHADOW_ETCHED_OUT);
64 gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
66 gtk_widget_show (window);
68 /* Rest in gtk_main and wait for the fun to begin! */