1998-04-04 11:31:51 +00:00
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
1998-04-04 11:31:51 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
1999-11-13 23:06:46 +00:00
|
|
|
int main( int argc,
|
|
|
|
char *argv[] )
|
1998-04-04 11:31:51 +00:00
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *aspect_frame;
|
|
|
|
GtkWidget *drawing_area;
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
|
2002-02-19 19:47:16 +00:00
|
|
|
g_signal_connect (G_OBJECT (window), "destroy",
|
|
|
|
G_CALLBACK (gtk_main_quit), NULL);
|
1999-01-28 10:35:40 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
1998-04-04 11:31:51 +00:00
|
|
|
|
|
|
|
/* Create an aspect_frame and add it to our toplevel window */
|
|
|
|
|
|
|
|
aspect_frame = gtk_aspect_frame_new ("2x1", /* label */
|
|
|
|
0.5, /* center x */
|
|
|
|
0.5, /* center y */
|
|
|
|
2, /* xsize/ysize = 2 */
|
|
|
|
FALSE /* ignore child's aspect */);
|
|
|
|
|
2002-02-19 01:25:26 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (window), aspect_frame);
|
1998-04-04 11:31:51 +00:00
|
|
|
gtk_widget_show (aspect_frame);
|
|
|
|
|
|
|
|
/* Now add a child widget to the aspect frame */
|
|
|
|
|
|
|
|
drawing_area = gtk_drawing_area_new ();
|
|
|
|
|
|
|
|
/* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
|
|
|
|
* window since we are forcing a 2x1 aspect ratio */
|
2002-02-16 23:52:30 +00:00
|
|
|
gtk_widget_set_size_request (drawing_area, 200, 200);
|
2002-02-19 01:25:26 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (aspect_frame), drawing_area);
|
1998-04-04 11:31:51 +00:00
|
|
|
gtk_widget_show (drawing_area);
|
|
|
|
|
|
|
|
gtk_widget_show (window);
|
|
|
|
gtk_main ();
|
|
|
|
return 0;
|
|
|
|
}
|