summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2009-10-13 10:11:40 +0100
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2009-11-18 12:18:32 +1100
commitd55e31c9b3871197d941ed8b4ca49fd1bb408f20 (patch)
tree89e5acac2c411670ed7f6735351a4ce0773ffe57 /examples
parent690bf236ba5a9958c46ec769e8b3fd64c542ee1f (diff)
downloadclutter-gtk-d55e31c9b3871197d941ed8b4ca49fd1bb408f20.tar.gz
A scrolled window test
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am7
-rw-r--r--examples/test-scrolling.c52
2 files changed, 58 insertions, 1 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 881d791..ce80f36 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -15,7 +15,8 @@ noinst_PROGRAMS = \
gtk-clutter-window-test2 \
refcounting-test \
reparenting-test \
- stacked-standins
+ stacked-standins \
+ test-scrolling
INCLUDES = -I$(srcdir) -I$(top_srcdir)
@@ -81,6 +82,10 @@ stacked_standins_SOURCES = stacked-standins.c
stacked_standins_DEPENDENCIES = $(common_deps)
stacked_standins_LDADD = $(common_ldadd)
+test_scrolling_SOURCES = test-scrolling.c
+test_scrolling_DEPENDENCIES = $(common_deps)
+test_scrolling_LDADD = $(common_ldadd)
+
EXTRA_DIST = \
animated-notebook.ui \
redhand.png
diff --git a/examples/test-scrolling.c b/examples/test-scrolling.c
new file mode 100644
index 0000000..b09036c
--- /dev/null
+++ b/examples/test-scrolling.c
@@ -0,0 +1,52 @@
+/*
+ * Clutter-Gtk GtkScrolledWindow Test
+ *
+ * (c) 2009, Collabora Ltd.
+ *
+ * Authors:
+ * Danielle Madeley <danielle.madeley@collabora.co.uk>
+ */
+
+#include <clutter-gtk/clutter-gtk.h>
+
+int
+main (int argc, char **argv)
+{
+ gtk_clutter_init (&argc, &argv);
+
+ GtkWidget *window = gtk_clutter_window_new ();
+ GtkWidget *vbox = gtk_vbox_new (TRUE, 0);
+
+ ClutterActor *viewport = gtk_clutter_viewport_new (NULL, NULL, NULL);
+ GtkAdjustment *hadj, *vadj;
+ g_object_get (viewport,
+ "hadjustment", &hadj,
+ "vadjustment", &vadj,
+ NULL);
+
+ GtkWidget *sw = gtk_scrolled_window_new (hadj, vadj);
+ g_object_unref (hadj);
+ g_object_unref (vadj);
+
+ ClutterActor *text = clutter_text_new_with_text ("Sans 18",
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
+ "Fusce vulputate nisi et purus vestibulum fermentum. Fusce "
+ "sed metus eu augue dapibus egestas. Proin tincidunt lectus "
+ "in dolor posuere tincidunt. Integer eu est metus, a luctus "
+ "metus. Aenean sed nulla in nulla laoreet sodales a id erat. "
+ "Pellentesque sodales augue non lectus dictum mollis. Proin "
+ "imperdiet, lorem id pharetra dignissim, lacus nunc condimentum "
+ "massa, sit amet varius justo elit et felis. Quisque sagittis "
+ "tellus a ante vehicula gravida. Vivamus sit amet magna ante. "
+ "Ut id aliquet diam.");
+ clutter_container_add_actor (CLUTTER_CONTAINER (viewport), text);
+
+ GtkWidget *standin = gtk_clutter_standin_new (viewport);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), standin);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_box_pack_start_defaults (GTK_BOX (vbox), sw);
+
+ gtk_widget_show_all (window);
+ gtk_main ();
+}