1 /* example-start aspectframe aspectframe.c */
9 GtkWidget *aspect_frame;
10 GtkWidget *drawing_area;
11 gtk_init (&argc, &argv);
13 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
14 gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
15 gtk_signal_connect (GTK_OBJECT (window), "destroy",
16 GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
17 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
19 /* Create an aspect_frame and add it to our toplevel window */
21 aspect_frame = gtk_aspect_frame_new ("2x1", /* label */
24 2, /* xsize/ysize = 2 */
25 FALSE /* ignore child's aspect */);
27 gtk_container_add (GTK_CONTAINER(window), aspect_frame);
28 gtk_widget_show (aspect_frame);
30 /* Now add a child widget to the aspect frame */
32 drawing_area = gtk_drawing_area_new ();
34 /* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
35 * window since we are forcing a 2x1 aspect ratio */
36 gtk_widget_set_usize (drawing_area, 200, 200);
37 gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area);
38 gtk_widget_show (drawing_area);
40 gtk_widget_show (window);