diff options
author | Emmanuele Bassi <ebassi@openedhand.com> | 2008-10-20 15:29:40 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@openedhand.com> | 2008-10-20 15:29:40 +0000 |
commit | caf305e365ed92c7f7a3750e88a37f5fc9922da7 (patch) | |
tree | d4e576332e0942fcbc24cc2113b467b1e4f29f0b /examples | |
parent | 713766257c46a7fed378db6e44d03ccdf0739a6c (diff) | |
download | clutter-gtk-caf305e365ed92c7f7a3750e88a37f5fc9922da7.tar.gz |
2008-10-20 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter-gtk/Makefile.am:
* examples/Makefile.am: Update the build.
* clutter-gtk/clutter-gtk.h: Added a single include header, and
disabled the inclusion of specific headers; this keeps the
library clean and future-proof, now that we have more than one
header file.
* clutter-gtk/gtk-clutter-embed.h:
* clutter-gtk/gtk-clutter-util.h: Disabled the direct inclusion
of a single header file.
* clutter-gtk/gtk-clutter-scrollable.c:
* clutter-gtk/gtk-clutter-scrollable.h: Added a GtkClutterScrollable
interface for scrollable actors using GtkAdjustments.
* clutter-gtk/gtk-clutter-viewport.c:
* clutter-gtk/gtk-clutter-viewport.h: Added a scrollable actor
implementing GtkClutterScrollable.
* doc/reference/Makefile.am:
* doc/reference/clutter-gtk-docs.sgml:
* doc/reference/clutter-gtk-sections.txt:
* doc/reference/clutter-gtk.types: Update the documentation.
* examples/gtk-clutter-events.c:
* examples/gtk-clutter-multistage.c:
* examples/gtk-clutter-test.c: Update to include clutter-gtk.h.
* examples/gtk-clutter-viewport.c: Added an example of
the GtkClutterViewport usage.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 13 | ||||
-rw-r--r-- | examples/gtk-clutter-events.c | 3 | ||||
-rw-r--r-- | examples/gtk-clutter-multistage.c | 3 | ||||
-rw-r--r-- | examples/gtk-clutter-test.c | 3 | ||||
-rw-r--r-- | examples/gtk-clutter-viewport.c | 88 |
5 files changed, 100 insertions, 10 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index 6402291..4abe2de 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,9 +1,10 @@ NULL = noinst_PROGRAMS = \ - gtk-clutter-test \ gtk-clutter-events \ - gtk-clutter-multistage + gtk-clutter-multistage \ + gtk-clutter-test \ + gtk-clutter-viewport INCLUDES = \ -I$(srcdir) \ @@ -12,10 +13,10 @@ INCLUDES = \ AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(GTK_CFLAGS) common_deps = \ - $(top_builddir)/clutter-gtk/libclutter-gtk-0.8.la + $(top_builddir)/clutter-gtk/libclutter-gtk-0.9.la common_ldadd = \ - $(top_builddir)/clutter-gtk/libclutter-gtk-0.8.la \ + $(top_builddir)/clutter-gtk/libclutter-gtk-0.9.la \ $(CLUTTER_LIBS) \ $(GTK_LIBS) @@ -31,4 +32,8 @@ gtk_clutter_multistage_SOURCES = gtk-clutter-multistage.c gtk_clutter_multistage_DEPENDENCIES = $(common_deps) gtk_clutter_multistage_LDADD = $(common_ldadd) +gtk_clutter_viewport_SOURCES = gtk-clutter-viewport.c +gtk_clutter_viewport_DEPENDENCIES = $(common_deps) +gtk_clutter_viewport_LDADD = $(common_ldadd) + EXTRA_DIST = redhand.png diff --git a/examples/gtk-clutter-events.c b/examples/gtk-clutter-events.c index 3143bc9..ec5fb9e 100644 --- a/examples/gtk-clutter-events.c +++ b/examples/gtk-clutter-events.c @@ -1,8 +1,7 @@ #include <gtk/gtk.h> #include <clutter/clutter.h> -#include <clutter-gtk/gtk-clutter-embed.h> -#include <clutter-gtk/gtk-clutter-util.h> +#include <clutter-gtk/clutter-gtk.h> typedef struct { diff --git a/examples/gtk-clutter-multistage.c b/examples/gtk-clutter-multistage.c index 34abe32..e97da88 100644 --- a/examples/gtk-clutter-multistage.c +++ b/examples/gtk-clutter-multistage.c @@ -1,8 +1,7 @@ #include <gtk/gtk.h> #include <clutter/clutter.h> -#include <clutter-gtk/gtk-clutter-embed.h> -#include <clutter-gtk/gtk-clutter-util.h> +#include <clutter-gtk/clutter-gtk.h> int main (int argc, char *argv[]) diff --git a/examples/gtk-clutter-test.c b/examples/gtk-clutter-test.c index 975572f..88ab664 100644 --- a/examples/gtk-clutter-test.c +++ b/examples/gtk-clutter-test.c @@ -2,8 +2,7 @@ #include <clutter/clutter.h> #include <math.h> -#include <clutter-gtk/gtk-clutter-embed.h> -#include <clutter-gtk/gtk-clutter-util.h> +#include <clutter-gtk/clutter-gtk.h> #define TRAILS 0 #define NHANDS 2 diff --git a/examples/gtk-clutter-viewport.c b/examples/gtk-clutter-viewport.c new file mode 100644 index 0000000..37c2980 --- /dev/null +++ b/examples/gtk-clutter-viewport.c @@ -0,0 +1,88 @@ +#include <gtk/gtk.h> +#include <clutter/clutter.h> + +#include <clutter-gtk/clutter-gtk.h> + +int +main (int argc, char *argv[]) +{ + ClutterTimeline *timeline; + ClutterActor *stage, *viewport, *tex; + ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff }; + GtkWidget *window, *embed; + GtkWidget *table, *scrollbar; + GtkAdjustment *h_adjustment, *v_adjustment; + gint i; + ClutterColor col2 = { 0, }; + + if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) + g_error ("Unable to initialize GtkClutter"); + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); + + table = gtk_table_new (2, 2, FALSE); + gtk_container_add (GTK_CONTAINER (window), table); + gtk_widget_show (table); + + embed = gtk_clutter_embed_new (); + gtk_table_attach (GTK_TABLE (table), embed, + 0, 1, + 0, 1, + GTK_EXPAND | GTK_FILL, + GTK_EXPAND | GTK_FILL, + 0, 0); + gtk_widget_set_size_request (embed, 320, 240); + gtk_widget_show (embed); + + stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed)); + clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + + viewport = gtk_clutter_viewport_new (NULL, NULL); + clutter_actor_set_size (viewport, 320, 240); + clutter_container_add_actor (CLUTTER_CONTAINER (stage), viewport); + + if (argc < 1) + tex = gtk_clutter_texture_new_from_stock (embed, + GTK_STOCK_DIALOG_INFO, + GTK_ICON_SIZE_DIALOG); + else + { + GError *error = NULL; + + tex = clutter_texture_new_from_file (argv[1], &error); + if (error) + { + g_warning ("Unable to open `%s': %s", argv[1], error->message); + g_error_free (error); + } + } + + clutter_container_add_actor (CLUTTER_CONTAINER (viewport), tex); + + gtk_clutter_scrollable_get_adjustments (GTK_CLUTTER_SCROLLABLE (viewport), + &h_adjustment, + &v_adjustment); + + scrollbar = gtk_vscrollbar_new (v_adjustment); + gtk_table_attach (GTK_TABLE (table), scrollbar, + 1, 2, + 0, 1, + 0, GTK_EXPAND | GTK_FILL, + 0, 0); + gtk_widget_show (scrollbar); + + scrollbar = gtk_hscrollbar_new (h_adjustment); + gtk_table_attach (GTK_TABLE (table), scrollbar, + 0, 1, + 1, 2, + GTK_EXPAND | GTK_FILL, 0, + 0, 0); + gtk_widget_show (scrollbar); + + gtk_widget_show (window); + + gtk_main(); + + return 0; +} |