8 GtkWidget *aspect_frame;
9 GtkWidget *drawing_area;
10 gtk_init (&argc, &argv);
12 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
13 gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
14 g_signal_connect (G_OBJECT (window), "destroy",
15 G_CALLBACK (gtk_main_quit), NULL);
16 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
18 /* Create an aspect_frame and add it to our toplevel window */
20 aspect_frame = gtk_aspect_frame_new ("2x1", /* label */
23 2, /* xsize/ysize = 2 */
24 FALSE /* ignore child's aspect */);
26 gtk_container_add (GTK_CONTAINER (window), aspect_frame);
27 gtk_widget_show (aspect_frame);
29 /* Now add a child widget to the aspect frame */
31 drawing_area = gtk_drawing_area_new ();
33 /* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
34 * window since we are forcing a 2x1 aspect ratio */
35 gtk_widget_set_size_request (drawing_area, 200, 200);
36 gtk_container_add (GTK_CONTAINER (aspect_frame), drawing_area);
37 gtk_widget_show (drawing_area);
39 gtk_widget_show (window);