Beispiel #1
0
static VALUE
rbclt_flow_layout_initialize (VALUE self, VALUE orientation)
{
  ClutterGravity orientation_val = RVAL2GENUM (orientation, CLUTTER_TYPE_FLOW_ORIENTATION);
  rbclt_initialize_unowned (self, clutter_flow_layout_new (orientation_val));

  return Qnil;
}
int
main (int    argc,
      char **argv)
{
    ClutterActor *stage;

    clutter_init (&argc, &argv);

    stage = clutter_stage_get_default ();
    clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
    clutter_actor_set_size (stage, 640, 480);
#if 1
    layout = penge_block_layout_new ();
    penge_block_layout_set_min_tile_size (PENGE_BLOCK_LAYOUT (layout),
                                          140,
                                          92);
    penge_block_layout_set_spacing (PENGE_BLOCK_LAYOUT (layout), 6);

#else
    layout = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
#endif

    box = clutter_box_new (layout);

    bridge = g_object_new (PENGE_TYPE_MODEL_BRIDGE, NULL);

    penge_model_bridge_set_container (bridge, CLUTTER_CONTAINER (box));
    penge_model_bridge_set_factory (bridge, factory_func);

    client = sw_client_new ();
    sw_client_get_services (client, _client_get_services_cb, NULL);

    clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

    clutter_actor_set_size (box,
                            clutter_actor_get_width (stage),
                            clutter_actor_get_height (stage));
    clutter_actor_show (stage);

    g_signal_connect (stage,
                      "allocation-changed", G_CALLBACK (stage_allocation_changed_cb),
                      box);
    clutter_main ();

    return EXIT_SUCCESS;
}
Beispiel #3
0
G_MODULE_EXPORT int
test_texture_material_main (int argc, char *argv[])
{
  ClutterActor *stage, *box;
  ClutterLayoutManager *manager;
  int i;

  g_thread_init (NULL);
  clutter_threads_init ();
  clutter_init (&argc, &argv);

  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Texture Material");
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
  box = clutter_box_new (manager);
  clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -25.0));
  clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -25.0));
  clutter_actor_set_position (box, 25.0, 25.0);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

  for (i = 0; i < 48; i++)
    {
      ClutterActor *texture = clutter_texture_new ();

      clutter_texture_set_load_data_async (CLUTTER_TEXTURE (texture), TRUE);
      clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE);
      clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
                                     TESTS_DATADIR "/redhand.png",
                                     NULL);
      clutter_actor_set_width (texture, 96);

      clutter_container_add_actor (CLUTTER_CONTAINER (box), texture);
    }

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
Beispiel #4
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage, *box;
  ClutterLayoutManager *layout;
  GError *error;
  gint i;

  error = NULL;
  if (clutter_init_with_args (&argc, &argv,
                              NULL,
                              entries,
                              NULL,
                              &error) != CLUTTER_INIT_SUCCESS)
    {
      g_print ("Unable to run flow-layout: %s", error->message);
      g_error_free (error);

      return EXIT_FAILURE;
    }

  stage = clutter_stage_new ();
  clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue);
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Flow Layout");
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  layout = clutter_flow_layout_new (vertical ? CLUTTER_FLOW_VERTICAL
                                             : CLUTTER_FLOW_HORIZONTAL);
  clutter_flow_layout_set_homogeneous (CLUTTER_FLOW_LAYOUT (layout),
                                       is_homogeneous);
  clutter_flow_layout_set_column_spacing (CLUTTER_FLOW_LAYOUT (layout),
                                          x_spacing);
  clutter_flow_layout_set_row_spacing (CLUTTER_FLOW_LAYOUT (layout),
                                       y_spacing);

  box = clutter_actor_new ();
  clutter_actor_set_layout_manager (box, layout);
  clutter_actor_set_background_color (box, CLUTTER_COLOR_Aluminium2);
  clutter_actor_add_child (stage, box);

  if (!fixed_size)
    clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0.0));

  clutter_actor_set_position (box, 0, 0);
  clutter_actor_set_name (box, "box");

  for (i = 0; i < n_rects; i++)
    {
      ClutterColor color = CLUTTER_COLOR_INIT (255, 255, 255, 255);
      gfloat width, height;
      ClutterActor *rect;
      gchar *name;

      name = g_strdup_printf ("rect%02d", i);

      clutter_color_from_hls (&color,
                              360.0 / n_rects * i,
                              0.5,
                              0.8);
      rect = clutter_actor_new ();
      clutter_actor_set_background_color (rect, &color);

      if (random_size)
        {
          width = g_random_int_range (50, 100);
          height = g_random_int_range (50, 100);
        }
      else
        width = height = 50.f;

      clutter_actor_set_size (rect, width, height);
      clutter_actor_set_name (rect, name);

      clutter_actor_add_child (box, rect);

      g_free (name);
    }

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}