Doesn't appear to work!


#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, *tex2, *group;
  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");


  group = clutter_group_new;


  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, 100, 100);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), viewport);

  clutter_container_add_actor (CLUTTER_CONTAINER (viewport), group);

  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);
        }
    }



  tex2 = clutter_texture_new_from_file ("tex2.png", NULL);

  clutter_container_add_actor (CLUTTER_CONTAINER (group), tex2);
  clutter_actor_set_position (tex2, 40, 40);
  clutter_container_add_actor (CLUTTER_CONTAINER (group), 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;
}



On Thu, Nov 13, 2008 at 7:35 AM, Pierre-Luc Beaudoin <[EMAIL PROTECTED]
> wrote:

> On Thu, 2008-11-13 at 06:47 +1000, Saul Lethbridge wrote:
> > Are there any plans to have something similar to GtkClutterViewport
> > but that can contain multiple actors - like embedding the stage in the
> > viewport and applying a size limit? The limit of a single actor makes
> > GtkClutterViewport reasonably useless.
> >
>
> I didn't try it, but you probably can have a ClutterGroup as the actor
> in GtkClutterViewport.  Then you are free to add as many actors to that
> group.
>
> Try that, and let us know! :)
>
>
> --
> Pierre-Luc Beaudoin
>

Reply via email to