summaryrefslogtreecommitdiff
path: root/examples/aspectframe
diff options
context:
space:
mode:
authorBST 1998 Tony Gale <gale@gtk.org>1998-04-04 11:31:51 +0000
committerTony Gale <gale@src.gnome.org>1998-04-04 11:31:51 +0000
commite19f939b53c833ac2fc47d6fe18c88fcbb0b7e39 (patch)
tree6ab57b3d3285a18b09af62bcfb1ea3bd0a5e7260 /examples/aspectframe
parent977b13d37f44beff17830009bfc55d39848c3dc1 (diff)
downloadgtk+-e19f939b53c833ac2fc47d6fe18c88fcbb0b7e39.tar.gz
subsections on Aspect Frames and Paned widgets.
Sat Apr 4 12:23:23 BST 1998 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: (gtk-crichton-980403-0) subsections on Aspect Frames and Paned widgets. * examples/paned examples/aspectframe: new examples
Diffstat (limited to 'examples/aspectframe')
-rw-r--r--examples/aspectframe/Makefile8
-rw-r--r--examples/aspectframe/aspectframe.c43
2 files changed, 51 insertions, 0 deletions
diff --git a/examples/aspectframe/Makefile b/examples/aspectframe/Makefile
new file mode 100644
index 0000000000..fe8b11e286
--- /dev/null
+++ b/examples/aspectframe/Makefile
@@ -0,0 +1,8 @@
+
+CC = gcc
+
+aspectframe: aspectframe.c
+ $(CC) `gtk-config --cflags` `gtk-config --libs` aspectframe.c -o aspectframe
+
+clean:
+ rm -f *.o aspectframe
diff --git a/examples/aspectframe/aspectframe.c b/examples/aspectframe/aspectframe.c
new file mode 100644
index 0000000000..0376bf92b9
--- /dev/null
+++ b/examples/aspectframe/aspectframe.c
@@ -0,0 +1,43 @@
+/* aspectframe.c */
+
+#include <gtk/gtk.h>
+
+int
+main (int argc, char *argv[])
+{
+ 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");
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+ gtk_container_border_width (GTK_CONTAINER (window), 10);
+
+ /* 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 */);
+
+ gtk_container_add (GTK_CONTAINER(window), aspect_frame);
+ 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 */
+ gtk_widget_set_usize (drawing_area, 200, 200);
+ gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area);
+ gtk_widget_show (drawing_area);
+
+ gtk_widget_show (window);
+ gtk_main ();
+ return 0;
+}