• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CLUTTER_CONTAINER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CLUTTER_CONTAINER函数的典型用法代码示例。如果您正苦于以下问题:C++ CLUTTER_CONTAINER函数的具体用法?C++ CLUTTER_CONTAINER怎么用?C++ CLUTTER_CONTAINER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CLUTTER_CONTAINER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mex_menu_item_new

static ClutterActor *
mex_menu_item_new (MexMenu *self, MxAction *action, MexMenuActionType type)
{
  ClutterActor *button, *layout, *icon, *vbox, *label, *arrow = NULL;

  button = mx_button_new ();
  mx_button_set_is_toggle (MX_BUTTON (button), TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (button), "Item");

  layout = mx_box_layout_new ();
  mx_bin_set_child (MX_BIN (button), layout);
  mx_bin_set_fill (MX_BIN (button), TRUE, FALSE);

  if (type == MEX_MENU_LEFT)
    {
      arrow = mx_icon_new ();
      mx_stylable_set_style_class (MX_STYLABLE (arrow), "Left");
      clutter_container_add_actor (CLUTTER_CONTAINER (layout), arrow);

    }

  vbox = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL);

  label = mx_label_new ();
  mx_label_set_fade_out (MX_LABEL (label), TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (label), "Action");
  g_object_bind_property (action, "display-name", label, "text",
                          G_BINDING_SYNC_CREATE);
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label);

  label = mx_label_new ();
  mx_label_set_fade_out (MX_LABEL (label), TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (label), "Detail");
  clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label);
  clutter_actor_hide (label);
  g_object_set_data (G_OBJECT (button), "detail-label", label);

  clutter_container_add_actor (CLUTTER_CONTAINER (layout), vbox);
  clutter_container_child_set (CLUTTER_CONTAINER (layout), vbox,
                               "expand", TRUE,
                               "x-fill", FALSE,
                               "x-align", MX_ALIGN_START,
                               "y-fill", FALSE,
                               NULL);

  icon = mx_icon_new ();
  g_object_bind_property (action, "icon", icon, "icon-name",
                          G_BINDING_SYNC_CREATE);
  clutter_container_add_actor (CLUTTER_CONTAINER (layout), icon);

  if (type == MEX_MENU_RIGHT)
    {
      arrow = mx_icon_new ();
      mx_stylable_set_style_class (MX_STYLABLE (arrow), "Right");
      clutter_container_add_actor (CLUTTER_CONTAINER (layout), arrow);
    }
  else if (type == MEX_MENU_TOGGLE)
    {
      ClutterActor *toggle = mx_icon_new ();
      mx_stylable_set_style_class (MX_STYLABLE (toggle), "Toggle");
      clutter_container_add_actor (CLUTTER_CONTAINER (layout), toggle);
      g_object_set_data (G_OBJECT (button), "toggle-icon", toggle);
    }

  if (arrow)
    clutter_container_child_set (CLUTTER_CONTAINER (layout),
                                 arrow,
                                 "expand", FALSE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 "y-fill", FALSE,
                                 NULL);

  g_signal_connect (button, "clicked",
                    G_CALLBACK (mex_menu_item_clicked_cb), action);

  g_object_weak_ref (G_OBJECT (button),
                     (GWeakNotify)mex_menu_item_destroyed_cb,
                     self);

  /* Set the item qdata on the button to mark that we created it */
  g_object_set_qdata (G_OBJECT (button), mex_menu_item_quark,
                      GINT_TO_POINTER (TRUE));

  return button;
}
开发者ID:ocrete,项目名称:media-explorer,代码行数:86,代码来源:mex-menu.c


示例2: st_table_get_preferred_width

static void
st_table_get_preferred_width (ClutterActor *self,
                              gfloat        for_height,
                              gfloat       *min_width_p,
                              gfloat       *natural_width_p)
{
  gint *min_widths, *pref_widths;
  gfloat total_min_width, total_pref_width;
  StTablePrivate *priv = ST_TABLE (self)->priv;
  StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
  gint i;
  ClutterActor *child;

  if (priv->n_cols < 1)
    {
      *min_width_p = 0;
      *natural_width_p = 0;
      return;
    }

  /* Setting size to zero and then what we want it to be causes a clear if
   * clear flag is set (which it should be.)
   */
  g_array_set_size (priv->min_widths, 0);
  g_array_set_size (priv->pref_widths, 0);
  g_array_set_size (priv->min_widths, priv->n_cols);
  g_array_set_size (priv->pref_widths, priv->n_cols);

  min_widths = (gint *) priv->min_widths->data;
  pref_widths = (gint *) priv->pref_widths->data;

  /* calculate minimum row widths */
  for (child = clutter_actor_get_first_child (self);
       child != NULL;
       child = clutter_actor_get_next_sibling (child))
    {
      gint col, col_span;
      gfloat w_min, w_pref;
      StTableChild *meta;

      meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (self), child);

      if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
        continue;

      /* get child properties */
      col = meta->col;
      col_span = meta->col_span;

      _st_actor_get_preferred_width (child, -1, meta->y_fill, &w_min, &w_pref);

      if (col_span == 1 && w_min > min_widths[col])
        min_widths[col] = w_min;
      if (col_span == 1 && w_pref > pref_widths[col])
        pref_widths[col] = w_pref;
    }

  total_min_width = (priv->n_cols - 1) * (float) priv->col_spacing;
  total_pref_width = total_min_width;

  for (i = 0; i < priv->n_cols; i++)
    {
      total_min_width += min_widths[i];
      total_pref_width += pref_widths[i];
    }

  /* If we were requested width-for-height, then we reported minimum/natural
   * heights based on our natural width. If we were allocated less than our
   * natural width, then we need more height. So in the width-for-height
   * case we need to disable shrinking.
   */
  if (for_height >= 0)
    total_min_width = total_pref_width;

  if (min_width_p)
    *min_width_p = total_min_width;
  if (natural_width_p)
    *natural_width_p = total_pref_width;

  st_theme_node_adjust_preferred_width (theme_node, min_width_p, natural_width_p);
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:81,代码来源:st-table.c


示例3: test_cogl_vertex_buffer_contiguous

void
test_cogl_vertex_buffer_contiguous (TestUtilsGTestFixture *fixture,
		                    void *data)
{
  TestState state;
  ClutterActor *stage;
  ClutterColor stage_clr = {0x0, 0x0, 0x0, 0xff};
  ClutterActor *group;
  unsigned int idle_source;
  guchar tex_data[] = {
    0xff, 0x00, 0x00, 0xff,
    0xff, 0x00, 0x00, 0xff,
    0x00, 0xff, 0x00, 0xff,
    0x00, 0xff, 0x00, 0xff
  };

  stage = clutter_stage_get_default ();

  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
  clutter_actor_get_geometry (stage, &state.stage_geom);

  group = clutter_group_new ();
  clutter_actor_set_size (group,
			  state.stage_geom.width,
			  state.stage_geom.height);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);

  /* We force continuous redrawing incase someone comments out the
   * clutter_main_quit and wants visual feedback for the test since we
   * wont be doing anything else that will trigger redrawing. */
  idle_source = g_idle_add (queue_redraw, stage);

  g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);

  state.texture = cogl_texture_new_from_data (2, 2,
                                              COGL_TEXTURE_NO_SLICING,
                                              COGL_PIXEL_FORMAT_RGBA_8888,
                                              COGL_PIXEL_FORMAT_ANY,
                                              0, /* auto calc row stride */
                                              tex_data);

  state.material = cogl_material_new ();
  cogl_material_set_color4ub (state.material, 0x00, 0xff, 0x00, 0xff);
  cogl_material_set_layer (state.material, 0, state.texture);

  {
    GLfloat triangle_verts[3][2] =
      {
	{0.0,	0.0},
	{100.0, 100.0},
	{0.0,	100.0}
      };
    GLbyte triangle_colors[3][4] =
      {
	{0x00, 0x00, 0xff, 0xff}, /* blue */
	{0x00, 0x00, 0xff, 0x00}, /* transparent blue */
	{0x00, 0x00, 0xff, 0x00}  /* transparent blue */
      };
    GLfloat triangle_tex_coords[3][2] =
      {
        {0.0, 0.0},
        {1.0, 1.0},
        {0.0, 1.0}
      };
    state.buffer = cogl_vertex_buffer_new (3 /* n vertices */);
    cogl_vertex_buffer_add (state.buffer,
			    "gl_Vertex",
			    2, /* n components */
			    GL_FLOAT,
			    FALSE, /* normalized */
			    0, /* stride */
			    triangle_verts);
    cogl_vertex_buffer_add (state.buffer,
			    "gl_Color::blue",
			    4, /* n components */
			    GL_UNSIGNED_BYTE,
			    FALSE, /* normalized */
			    0, /* stride */
			    triangle_colors);
    cogl_vertex_buffer_add (state.buffer,
			    "gl_MultiTexCoord0",
			    2, /* n components */
			    GL_FLOAT,
			    FALSE, /* normalized */
			    0, /* stride */
			    triangle_tex_coords);

    cogl_vertex_buffer_submit (state.buffer);
  }

  clutter_actor_show_all (stage);

  clutter_main ();

  cogl_handle_unref (state.buffer);
  cogl_handle_unref (state.material);
  cogl_handle_unref (state.texture);

  g_source_remove (idle_source);

//.........这里部分代码省略.........
开发者ID:collects,项目名称:cogl,代码行数:101,代码来源:test-vertex-buffer-contiguous.c


示例4: st_table_homogeneous_allocate

static void
st_table_homogeneous_allocate (ClutterActor          *self,
                               const ClutterActorBox *content_box,
                               gboolean               flags)
{
  gfloat col_width, row_height;
  gint row_spacing, col_spacing;
  StTablePrivate *priv = ST_TABLE (self)->priv;
  gboolean ltr = clutter_actor_get_text_direction (self) == CLUTTER_TEXT_DIRECTION_LTR;
  ClutterActor *child;

  col_spacing = priv->col_spacing;
  row_spacing = priv->row_spacing;

  col_width = (int) ((content_box->x2 - content_box->x1
                      - (col_spacing * (priv->n_cols - 1)))
                     / priv->n_cols + 0.5);
  row_height = (int) ((content_box->y2 - content_box->y1
                      - (row_spacing * (priv->n_rows - 1)))
                      / priv->n_rows + 0.5);

  for (child = clutter_actor_get_first_child (self);
       child != NULL;
       child = clutter_actor_get_next_sibling (child))
    {
      gint row, col, row_span, col_span;
      StTableChild *meta;
      ClutterActorBox childbox;
      gdouble x_align_f, y_align_f;

      meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (self), child);

      if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
        continue;

      /* get child properties */
      col = meta->col;
      row = meta->row;
      row_span = meta->row_span;
      col_span = meta->col_span;

      _st_get_align_factors (meta->x_align, meta->y_align,
                             &x_align_f, &y_align_f);

      if (ltr)
        {
          childbox.x1 = content_box->x1 + (col_width + col_spacing) * col;
          childbox.x2 = childbox.x1 + (col_width * col_span) + (col_spacing * (col_span - 1));
        }
      else
        {
          childbox.x2 = content_box->x2 - (col_width + col_spacing) * col;
          childbox.x1 = childbox.x2 - (col_width * col_span) - (col_spacing * (col_span - 1));
        }

      childbox.y1 = content_box->y1 + (row_height + row_spacing) * row;
      childbox.y2 = childbox.y1 + (row_height * row_span) + (row_spacing * (row_span - 1));

      clutter_actor_allocate_align_fill (child, &childbox,
                                         x_align_f, y_align_f,
                                         meta->x_fill, meta->y_fill,
                                         flags);
    }

}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:65,代码来源:st-table.c


示例5: st_table_calculate_row_heights

static gint *
st_table_calculate_row_heights (StTable *table,
                                gint     for_height,
                                gint   * col_widths)
{
  StTablePrivate *priv = ST_TABLE (table)->priv;
  gint *is_expand_row, *min_heights, *pref_heights, *row_heights, extra_row_height;
  gint i, total_min_height;
  gint expanded_rows = 0;
  gint n_expanded_rows = 0;
  ClutterActor *child;

  g_array_set_size (priv->row_heights, 0);
  g_array_set_size (priv->row_heights, priv->n_rows);
  row_heights = (gboolean *) priv->row_heights->data;

  g_array_set_size (priv->is_expand_row, 0);
  g_array_set_size (priv->is_expand_row, priv->n_rows);
  is_expand_row = (gboolean *) priv->is_expand_row->data;

  g_array_set_size (priv->min_heights, 0);
  g_array_set_size (priv->min_heights, priv->n_rows);
  min_heights = (gboolean *) priv->min_heights->data;

  g_array_set_size (priv->pref_heights, 0);
  g_array_set_size (priv->pref_heights, priv->n_rows);
  pref_heights = (gboolean *) priv->pref_heights->data;

  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (table));
       child != NULL;
       child = clutter_actor_get_next_sibling (child))
    {
      gint row, col, cell_width;
      gfloat h_min, h_pref;
      gboolean y_expand;
      StTableChild *meta;
      gint col_span, row_span;

      meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (table), child);

      if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
        continue;

      /* get child properties */
      col = meta->col;
      row = meta->row;
      y_expand = meta->y_expand;
      col_span = meta->col_span;
      row_span = meta->row_span;

      if (y_expand)
        is_expand_row[row] = TRUE;

      /* calculate the cell width by including any spanned columns */
      cell_width = 0;
      for (i = 0; i < col_span && col + i < priv->n_cols; i++)
        cell_width += (float)(col_widths[col + i]);

      if (!meta->x_fill)
        {
          gfloat width;
          _st_actor_get_preferred_width (child, -1, meta->y_fill, NULL, &width);
          cell_width = MIN (cell_width, width);
        }

      _st_actor_get_preferred_height (child, cell_width, meta->x_fill,
                                      &h_min, &h_pref);

      if (row_span == 1 && h_pref > pref_heights[row])
        {
          pref_heights[row] = (int)(h_pref);
        }
      if (row_span == 1 && h_min > min_heights[row])
        {
          min_heights[row] = (int)(h_min);
        }
    }

  total_min_height = 0; // priv->row_spacing * (priv->n_rows - 1);
  for (i = 0; i < priv->n_rows; i++)
    total_min_height += pref_heights[i];

  /* calculate the remaining space and distribute it evenly onto all rows/cols
   * with the x/y expand property set. */
  for (i = 0; i < priv->n_rows; i++)
    if (is_expand_row[i])
      {
        expanded_rows += pref_heights[i];
        n_expanded_rows++;
      }

  /* extra row height = for height - row spacings - total_min_height */
  for_height -= (priv->row_spacing * (priv->n_rows - 1));
  extra_row_height = for_height - total_min_height;


  if (extra_row_height < 0)
    {
      gint *skip = g_slice_alloc0 (sizeof (gint) * priv->n_rows);
      gint total_shrink_height;
//.........这里部分代码省略.........
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:101,代码来源:st-table.c


示例6: main

int
main (int     argc,
      char  **argv)
{
  bool standalone = false;
  char const *geometry = NULL;
  int dpi = 0;
  GOptionEntry _options[] = {
    { "standalone", 's', 0, G_OPTION_ARG_NONE, &standalone,
      "Run as standalone app (for testing purpose)", NULL },
    { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry,
      "Window geometry in standalone mode", NULL },
#if CLUTTER_CHECK_VERSION(1, 3, 0)
    { "clutter-font-dpi", 'd', 0, G_OPTION_ARG_INT, &dpi,
      "Set clutter font resolution to <dpi>", "<dpi>" },
#endif
    { NULL }
  };

  ClutterActor     *shell;
  GOptionContext   *context;
  ClutterInitError  clutter_error;
  GError           *error = NULL;

  setlocale (LC_ALL, "");
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  context = g_option_context_new ("- Dawati devices panel");
  g_option_context_add_main_entries (context, _options, GETTEXT_PACKAGE);
  g_option_context_add_group (context, clutter_get_option_group_without_init ());
  if (!g_option_context_parse (context, &argc, &argv, &error))
  {
    g_critical ("%s %s", G_STRLOC, error->message);
    g_critical ("Starting in standalone mode.");
    g_clear_error (&error);
    standalone = true;
  }
  g_option_context_free (context);

  clutter_error = clutter_init (&argc, &argv);
  if (clutter_error != CLUTTER_INIT_SUCCESS)
    {
      g_critical ("Unable to initialise clutter");
      return EXIT_FAILURE;
    }

  notify_init (_("Dawati Devices Panel"));

  /* Just for icon theme, no widgets. */
  gtk_init (&argc, &argv);

  if (dpi)
    {
#if CLUTTER_CHECK_VERSION(1, 3, 0)
      ClutterSettings *settings = clutter_settings_get_default ();
      g_object_set (settings, "font-dpi", dpi * 1000, NULL);
#endif
    }

  /* Load base styling for default font size */
  mpl_panel_clutter_load_base_style ();

  mx_texture_cache_load_cache (mx_texture_cache_get_default (),
                               PKGDATADIR "/mx.cache");
  mx_style_load_from_file (mx_style_get_default (),
                           THEMEDIR "/panel.css", NULL);

  if (standalone)
  {
    ClutterActor *stage = clutter_stage_get_default ();

    if (geometry)
    {
      int x, y;
      unsigned int width, height;
      XParseGeometry (geometry, &x, &y, &width, &height);
      clutter_actor_set_size (stage, width, height);
    } else
    {
      clutter_actor_set_size (stage, MPD_SHELL_WIDTH, MPD_SHELL_HEIGHT);
    }

    shell = mpd_shell_new ();

    g_signal_connect (shell, "request-hide",
                      G_CALLBACK (_shell_request_hide_cb), NULL);
    g_signal_connect (stage, "notify::width",
                      G_CALLBACK (_stage_width_notify_cb), shell);
    g_signal_connect (stage, "notify::height",
                      G_CALLBACK (_stage_height_notify_cb), shell);

    clutter_container_add_actor (CLUTTER_CONTAINER (stage), shell);
    clutter_actor_show_all (stage);

  } else {

    MplPanelClient *panel = mpd_panel_new ("devices",
                                           _("devices"),
//.........这里部分代码省略.........
开发者ID:xclaesse,项目名称:dawati-shell,代码行数:101,代码来源:dawati-panel-devices.c


示例7: scene_prismatic_joint

void
scene_prismatic_joint (Scene *scene)
{
  ClutterActor     *ground;
  ClutterActor     *group;
  ClutterActor     *prev_hand  = NULL;
  ClutterActor     *first_hand = NULL;
  ClutterActor     *stage;

  stage = clutter_stage_get_default ();

  first_hand = ground = clutter_rectangle_new ();
  clutter_actor_set_size (ground, 500, 120);



  group = clutter_box2d_new ();
  clutter_group_add (CLUTTER_GROUP (stage), group);

  clutter_group_add (CLUTTER_GROUP (group), ground);
  clutter_actor_set_position (ground, clutter_actor_get_width (
                                ground) * -0.3, 568);                             /*
                                                                                    this
                                                                                    is
                                                                                    wrong
                                                                                    */

  add_cage (group, TRUE);

  ground = clutter_rectangle_new ();
  clutter_actor_set_size (ground, 256, 3);
  clutter_actor_set_position (ground, -100, 310);
  clutter_actor_set_rotation (ground, CLUTTER_Z_AXIS, 30, 128, 16, 0);
  clutter_group_add (CLUTTER_GROUP (group), ground);

  clutter_container_child_set (CLUTTER_CONTAINER (group), ground,
                               "mode", CLUTTER_BOX2D_STATIC, NULL);

  ground = clutter_rectangle_new ();
  clutter_actor_set_size (ground, 256, 3);
  clutter_actor_set_position (ground, 200, 200);
  clutter_actor_set_rotation (ground, CLUTTER_Z_AXIS, -30, 0, 0, 0);
  clutter_group_add (CLUTTER_GROUP (group), ground);
  clutter_container_child_set (CLUTTER_CONTAINER (group), ground,
                               "mode", CLUTTER_BOX2D_STATIC, NULL);

  /*add_hand (group, 100, 100);*/
  prev_hand = add_hand (group, 200, 100);

  if(0){
    ClutterVertex anchor1 = {  (0),
                               (0) };
    ClutterVertex anchor2 = {  (0),
                               (0) };
    ClutterVertex axis = {  (100.0),
                            (20.0) };
    clutter_box2d_add_prismatic_joint (CLUTTER_BOX2D (group),
                                       first_hand, prev_hand,
                                       &anchor1, &anchor2,
                                       200.0, 220.0, &axis);
  }

  clutter_actor_set_depth (group, -600);
  clutter_actor_set_position (group, 0, -100);

  clutter_actor_set_reactive (group, TRUE);

  clutter_box2d_set_simulating (CLUTTER_BOX2D (group), simulating);

  scene->group = group;
}
开发者ID:GNOME,项目名称:clutter-box2d,代码行数:71,代码来源:scene-prismatic-joint.c


示例8: main

int
main (int argc, char *argv[])
{
  GError *error = NULL;

  /* UI */
  ClutterActor *stage;
  ClutterLayoutManager *layout;
  ClutterActor *box;
  ClutterActor *top, *bottom;
  ClutterState *transitions;

  clutter_init_with_args (&argc, &argv,
                          " - cross-fade", entries,
                          NULL,
                          NULL);

  if (source == NULL || target == NULL)
    {
      g_print ("Usage: %s -s <source> -t <target> [-d <duration>]\n", argv[0]);
      exit (EXIT_FAILURE);
    }

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade");
  clutter_actor_set_size (stage, 400, 300);
  clutter_actor_show (stage);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
                                   CLUTTER_BIN_ALIGNMENT_CENTER);

  box = clutter_box_new (layout);
  clutter_actor_set_size (box, 400, 300);

  bottom = clutter_texture_new ();
  top = clutter_texture_new ();

  clutter_container_add_actor (CLUTTER_CONTAINER (box), bottom);
  clutter_container_add_actor (CLUTTER_CONTAINER (box), top);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

  /* load the first image into the bottom */
  load_image (CLUTTER_TEXTURE (bottom), source);

  /* load the second image into the top */
  load_image (CLUTTER_TEXTURE (top), target);

  /* animations */
  transitions = clutter_state_new ();
  clutter_state_set (transitions, NULL, "show-bottom",
                     top, "opacity", CLUTTER_LINEAR, 0,
                     bottom, "opacity", CLUTTER_LINEAR, 255,
                     NULL);
  clutter_state_set (transitions, NULL, "show-top",
                     top, "opacity", CLUTTER_EASE_IN_CUBIC, 255,
                     bottom, "opacity", CLUTTER_EASE_IN_CUBIC, 0,
                     NULL);
  clutter_state_set_duration (transitions, NULL, NULL, duration);

  /* make the bottom opaque and top transparent */
  clutter_state_warp_to_state (transitions, "show-bottom");

  /* on key press, fade in the top texture and fade out the bottom texture */
  g_signal_connect (stage,
                    "key-press-event",
                    G_CALLBACK (start_animation),
                    transitions);

  clutter_actor_show (stage);

  clutter_main ();

  g_object_unref (transitions);

  if (error != NULL)
    g_error_free (error);

  return EXIT_SUCCESS;
}
开发者ID:nobled,项目名称:clutter,代码行数:82,代码来源:textures-crossfade.c


示例9: contact_widget_location_update


//.........这里部分代码省略.........
      if (gvalue == NULL)
        continue;

      user_label = location_key_to_label (skey);

      label = gtk_label_new (user_label);
      gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
      gtk_table_attach (GTK_TABLE (information->table_location),
          label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 10, 0);
      gtk_widget_show (label);

      if (G_VALUE_TYPE (gvalue) == G_TYPE_DOUBLE)
        {
          gdouble dvalue;
          dvalue = g_value_get_double (gvalue);
          svalue = g_strdup_printf ("%f", dvalue);
        }
      else if (G_VALUE_TYPE (gvalue) == G_TYPE_STRING)
        {
          svalue = g_value_dup_string (gvalue);
        }
      else if (G_VALUE_TYPE (gvalue) == G_TYPE_INT64)
        {
          time_t time_;

          time_ = g_value_get_int64 (value);
          svalue = empathy_time_to_string_utc (time_, _("%B %e, %Y at %R UTC"));
        }

      if (svalue != NULL)
        {
          label = gtk_label_new (svalue);
          gtk_table_attach_defaults (GTK_TABLE (information->table_location),
              label, 1, 2, row, row + 1);
          gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
          gtk_widget_show (label);

          if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP))
            gtk_label_set_selectable (GTK_LABEL (label), TRUE);
        }

      g_free (svalue);
      row++;
    }

#if HAVE_LIBCHAMPLAIN
  if (has_position &&
      !(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP))
    {
      /* Cannot be displayed in tooltips until Clutter-Gtk can deal with such
       * windows */
      display_map = TRUE;
    }
#endif

  if (row > 0)
    {
      /* We can display some fields */
      gtk_widget_show (information->table_location);
    }
  else if (!display_map)
    {
      /* Can't display either fields or map */
      gtk_widget_hide (information->vbox_location);
      return;
    }

#if HAVE_LIBCHAMPLAIN
  if (display_map)
    {
      ClutterActor *marker;
      ChamplainLayer *layer;

      information->map_view_embed = gtk_champlain_embed_new ();
      information->map_view = gtk_champlain_embed_get_view (
          GTK_CHAMPLAIN_EMBED (information->map_view_embed));

      gtk_container_add (GTK_CONTAINER (information->viewport_map),
          information->map_view_embed);
      g_object_set (G_OBJECT (information->map_view),
          "show-license", TRUE,
          "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
          "zoom-level", 10,
          NULL);

      layer = champlain_layer_new ();
      champlain_view_add_layer (information->map_view, layer);

      marker = champlain_marker_new_with_text (
          empathy_contact_get_name (information->contact), NULL, NULL, NULL);
      champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), lat, lon);
      clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);

      champlain_view_center_on (information->map_view, lat, lon);
      gtk_widget_show_all (information->viewport_map);
    }
#endif

    gtk_widget_show (information->vbox_location);
}
开发者ID:mirsal,项目名称:empathy,代码行数:101,代码来源:empathy-contact-widget.c


示例10: _update_layout

static void
_update_layout (PengeGridView *grid_view)
{
  PengeGridViewPrivate *priv = GET_PRIVATE (grid_view);
  gint col = 0;

  if (priv->vertical_apps)
  {
    clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                 priv->favourite_apps_pane,
                                 "column", col,
                                 "row", 1,
                                 "y-expand", TRUE,
                                 "y-fill", FALSE,
                                 "y-align", MX_ALIGN_START,
                                 "x-align", MX_ALIGN_START,
                                 "x-expand", FALSE,
                                 "x-fill", FALSE,
                                 NULL);

    if (priv->show_calendar_pane)
    {
      col++;

      clutter_actor_show (priv->calendar_pane);
      clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                   priv->calendar_pane,
                                   "column", col,
                                   "x-expand", FALSE,
                                   "y-fill", FALSE,
                                   "y-align", MX_ALIGN_START,
                                   NULL);
    } else {
      clutter_actor_hide (priv->calendar_pane);
    }

    if (priv->show_email_pane)
    { 
      clutter_actor_show (priv->email_pane);
      clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                   priv->email_pane,
                                   "column", col,
                                   "y-expand", TRUE,
                                   "y-fill", FALSE,
                                   "y-align", MX_ALIGN_END,
                                   "x-align", MX_ALIGN_MIDDLE,
                                   "x-expand", FALSE,
                                   "x-fill", FALSE,
                                   NULL);
      col++;
    } else {
      clutter_actor_hide (priv->email_pane);
    }


    clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                 priv->div_tex,
                                 "row-span", 1,
                                 "column", col,
                                 "x-expand", FALSE,
                                 NULL);

    col++;

    clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                 priv->everything_pane,
                                 "row-span", 1,
                                 "column", col,
                                 "x-expand", TRUE,
                                 "x-fill", TRUE,
                                 "y-expand", TRUE,
                                 "y-fill", TRUE,
                                 NULL);

    if (priv->show_email_pane)
    {
      clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                   priv->everything_pane,
                                   "row-span", 2,
                                   NULL);
      clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                   priv->div_tex,
                                   "row-span", 2,
                                   NULL);
    } else {
      clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                   priv->everything_pane,
                                   "row-span", 1,
                                   NULL);
      clutter_container_child_set (CLUTTER_CONTAINER (grid_view),
                                   priv->div_tex,
                                   "row-span", 1,
                                   NULL);
    }

    g_object_set (priv->favourite_apps_pane,
                  "vertical", TRUE,
                  NULL);

    if (!priv->show_calendar_pane)
//.........这里部分代码省略.........
开发者ID:dudochkin-victor,项目名称:gogoo-panel-myzone,代码行数:101,代码来源:penge-grid-view.c


示例11: main

int
main (int   argc,
      char *argv[])
{
  ClutterActor *stage;
  ClutterActor *texture;
  ClutterEffect *effect;
  ClutterState *transitions;
  GError *error = NULL;

  gchar *filename;

  if (argc < 2)
    {
      g_print ("Usage: %s <path to image file>\n", argv[0]);
      return EXIT_FAILURE;
    }

  filename = argv[1];

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 400, 300);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  texture = clutter_texture_new ();
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE);
  clutter_actor_set_width (texture, 400);
  clutter_actor_set_reactive (texture, TRUE);
  clutter_texture_set_from_file (CLUTTER_TEXTURE (texture),
                                 filename,
                                 &error);

  if (error != NULL)
    {
      g_critical ("Error loading texture from file %s; error was:\n%s",
                  filename,
                  error->message);
      return EXIT_FAILURE;
    }

  /* create the page fold effect instance with destination fold angle
   * of 180 degrees and starting period of 0 (no folding)
   */
  effect = cb_page_fold_effect_new (180.0, 0.0);

  /* add the effect to the texture actor */
  clutter_actor_add_effect (texture, effect);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture);

  /* animation for the period property of the effect,
   * to animate its value between 0.0 and 1.0 and back
   */
  transitions = clutter_state_new ();
  clutter_state_set_duration (transitions, NULL, NULL, 500);

  clutter_state_set_duration (transitions,
                              "partially-folded",
                              "folded",
                              375);

  clutter_state_set (transitions, NULL, "folded",
                     effect, "period", CLUTTER_LINEAR, 1.0,
                     NULL);

  clutter_state_set (transitions, NULL, "partially-folded",
                     effect, "period", CLUTTER_LINEAR, 0.25,
                     NULL);

  clutter_state_set (transitions, NULL, "unfolded",
                     effect, "period", CLUTTER_LINEAR, 0.0,
                     NULL);

  clutter_state_warp_to_state (transitions, "partially-folded");

  g_signal_connect (texture,
                    "button-press-event",
                    G_CALLBACK (button_pressed_cb),
                    transitions);

  clutter_actor_show (stage);

  clutter_main ();

  g_object_unref (transitions);

  return EXIT_SUCCESS;
}
开发者ID:ChrisCummins,项目名称:clutter,代码行数:92,代码来源:effects-custom-deform.c


示例12: main

int
main (int argc, char **argv)
{
  ClutterActor *stage = stage;
  ClutterActor *side_box;
  ClutterActor *button_box;
  ClutterActor *box;
  ClutterAnimation *anim;
  MashLightSet *light_set;
  MxStyle *style;
  GError *error = NULL;
  Data data;
  int i;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  style = mx_style_get_default ();
  if (!mx_style_load_from_file (style, "lights.css",
                                &error))
    {
      g_warning ("Error setting style: %s", error->message);
      g_clear_error (&error);
    }

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 800, 600);

  side_box = mx_table_new ();
  clutter_actor_set_name (side_box, "side-box");
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), side_box);
  clutter_actor_set_size (side_box, 300,
                          clutter_actor_get_height (stage));
  clutter_actor_set_x (side_box,
                       clutter_actor_get_width (stage)
                       - clutter_actor_get_width (side_box));

  button_box = mx_table_new ();
  mx_table_add_actor (MX_TABLE (side_box), button_box, 0, 0);

  data.notebook = mx_notebook_new ();

  mx_table_add_actor (MX_TABLE (side_box), data.notebook, 1, 0);

  data.model = mash_model_new_from_file (MASH_DATA_NONE,
                                         argc > 1
                                         ? argv[1]
                                         : "suzanne.ply",
                                         &error);
  if (data.model == NULL)
    {
      g_warning ("Error loading model: %s", error->message);
      g_clear_error (&error);
      return 1;
    }

  light_set = mash_light_set_new ();

  box = clutter_box_new (clutter_fixed_layout_new ());

  clutter_actor_set_size (data.model, 400, 400);
  clutter_actor_set_position (data.model, 50.0, 100.0);
  clutter_container_add_actor (CLUTTER_CONTAINER (box), data.model);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

  g_signal_connect_swapped (box, "paint",
                            G_CALLBACK (cogl_set_depth_test_enabled),
                            GINT_TO_POINTER (TRUE));
  g_signal_connect_data (box, "paint",
                         G_CALLBACK (cogl_set_depth_test_enabled),
                         GINT_TO_POINTER (FALSE), NULL,
                         G_CONNECT_AFTER | G_CONNECT_SWAPPED);

  data.light_marker_material = cogl_material_new ();
  {
    CoglColor color;
    cogl_color_set_from_4ub (&color, 255, 0, 0, 255);
    /* Use the layer state to ignore the vertex color from the shader so
       that the light marker won't itself be lit */
    cogl_material_set_layer_combine_constant (data.light_marker_material, 0,
                                              &color);
    cogl_material_set_layer_combine (data.light_marker_material, 0,
                                     "RGBA = REPLACE(CONSTANT)",
                                     NULL);
  }

  clutter_actor_set_rotation (data.model, CLUTTER_Y_AXIS,
                              0.0f,
                              clutter_actor_get_width (data.model) / 2.0f,
                              0.0f,
                              0.0f);

  anim = clutter_actor_animate (data.model, CLUTTER_LINEAR, 3000,
                                "rotation-angle-y", 360.0f,
                                NULL);
  clutter_animation_set_loop (anim, TRUE);

  for (i = 0; i < N_LIGHTS; i++)
    {
//.........这里部分代码省略.........
开发者ID:clutter-project,项目名称:mash,代码行数:101,代码来源:lights.c


示例13: test_bin_layout_main

G_MODULE_EXPORT int
test_bin_layout_main (int argc, char *argv[])
{
  ClutterActor *stage, *box, *rect;
  ClutterLayoutManager *layout;
  ClutterColor stage_color = { 0xe0, 0xf2, 0xfc, 0xff };
  ClutterColor bg_color = { 0xcc, 0xcc, 0xcc, 0x99 };
  ClutterColor *color;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "Box test");
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  clutter_actor_set_size (stage, 640, 480);

  layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
                                   CLUTTER_BIN_ALIGNMENT_CENTER);

  box = clutter_box_new (layout);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
  clutter_actor_set_anchor_point_from_gravity (box, CLUTTER_GRAVITY_CENTER);
  clutter_actor_set_position (box, 320, 240);
  clutter_actor_set_reactive (box, TRUE);
  clutter_actor_set_name (box, "box");

  rect = make_background (&bg_color, 200, 200);

  /* first method: use clutter_box_pack() */
  clutter_box_pack (CLUTTER_BOX (box), rect,
                    "x-align", CLUTTER_BIN_ALIGNMENT_FILL,
                    "y-align", CLUTTER_BIN_ALIGNMENT_FILL,
                    NULL);

  clutter_actor_lower_bottom (rect);
  clutter_actor_set_name (rect, "background");

  {
    ClutterActor *tex;
    GError *error;
    gchar *file;

    error = NULL;
    file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
    tex = clutter_texture_new_from_file (file, &error);
    if (error)
      g_error ("Unable to create texture: %s", error->message);

    clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (tex), TRUE);

    /* second method: use clutter_bin_layout_add() */
    clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), tex,
                            CLUTTER_BIN_ALIGNMENT_CENTER,
                            CLUTTER_BIN_ALIGNMENT_CENTER);

    clutter_actor_raise (tex, rect);
    clutter_actor_set_width (tex, 175);
    clutter_actor_set_name (tex, "texture");

    g_free (file);
  }

  color = clutter_color_new (g_random_int_range (0, 255),
                             g_random_int_range (0, 255),
                             g_random_int_range (0, 255),
                             224);

  rect = clutter_rectangle_new_with_color (color);

  /* third method: container_add() and set_alignment() */
  clutter_container_add_actor (CLUTTER_CONTAINER (box), rect);
  clutter_bin_layout_set_alignment (CLUTTER_BIN_LAYOUT (layout), rect,
                                    CLUTTER_BIN_ALIGNMENT_END,
                                    CLUTTER_BIN_ALIGNMENT_END);

  clutter_actor_set_size (rect, 50, 50);
  clutter_actor_set_opacity (rect, 0);
  clutter_actor_raise_top (rect);
  clutter_actor_set_name (rect, "emblem");


  g_signal_connect (box,
                    "enter-event", G_CALLBACK (on_box_enter),
                    rect);
  g_signal_connect (box,
                    "leave-event", G_CALLBACK (on_box_leave),
                    rect);

  clutter_actor_show_all (stage);

  clutter_main ();

  clutter_color_free (color);

  return EXIT_SUCCESS;
}
开发者ID:gramozeka,项目名称:GSB-NEW,代码行数:96,代码来源:test-bin-layout.c


示例14: mex_media_controls_init

static void
mex_media_controls_init (MexMediaControls *self)
{
    ClutterActor *actor;
    ClutterScript *script;
    GError *err = NULL;
    MxAdjustment *adjustment;
    ClutterActor *related_box;
    gchar *tmp;

    MexMediaControlsPrivate *priv = self->priv = MEDIA_CONTROLS_PRIVATE (self);

    priv->script = script = clutter_script_new ();

    tmp = g_build_filename (mex_get_data_dir (), "json", "media-controls.json",
                            NULL);
    clutter_script_load_from_file (script, tmp, &err);
    g_free (tmp);

    if (err)
        g_error ("Could not load media controls interface: %s", err->message);

    priv->vbox =
        (ClutterActor*) clutter_script_get_object (script, "media-controls");
    clutter_actor_set_parent (priv->vbox, CLUTTER_ACTOR (self));

    /* add shadow to media controls box */
    actor = (ClutterActor *) clutter_script_get_object (script,
            "media-controls-box");
    clutter_actor_add_effect (actor, CLUTTER_EFFECT (mex_shadow_new ()));


    /* vertical fade effect */
    priv->vertical_effect = mx_fade_effect_new ();
    clutter_actor_add_effect (priv->vbox, priv->vertical_effect);
    mx_scrollable_get_adjustments (MX_SCROLLABLE (mx_bin_get_child (MX_BIN (priv->vbox))),
                                   NULL, &adjustment);
    g_signal_connect (adjustment, "changed",
                      G_CALLBACK (notify_vertical_changed_cb), self);
    g_signal_connect (adjustment, "notify::value",
                      G_CALLBACK (notify_vertical_value_cb), self);

    /* horizontal fade effect */
    priv->horizontal_effect = mx_fade_effect_new ();
    related_box = (ClutterActor *) clutter_script_get_object (priv->script,
                  "related-box");
    clutter_actor_add_effect (related_box, priv->horizontal_effect);
    mx_scrollable_get_adjustments (MX_SCROLLABLE (related_box), &adjustment,
                                   NULL);
    g_signal_connect (adjustment, "changed",
                      G_CALLBACK (notify_horizontal_changed_cb), self);
    g_signal_connect (adjustment, "notify::value",
                      G_CALLBACK (notify_horizontal_value_cb), self);


    /* slider setup */
    priv->slider = (ClutterActor*) clutter_script_get_object (script, "slider");
    g_signal_connect (priv->slider, "notify::value",
                      G_CALLBACK (slider_value_changed_cb), self);
    g_signal_connect (priv->slider, "captured-event",
                      G_CALLBACK (slider_captured_event), self);

    priv->play_pause_action =
        (MxAction*) clutter_script_get_object (script, "play-pause-action");

    priv->stop_action =
        (MxAction*) clutter_script_get_object (script, "stop-action");

    priv->add_to_queue_action =
        (MxAction*) clutter_script_get_object (script, "add-to-queue-action");

    priv->queue_button =
        (ClutterActor *) clutter_script_get_object (script, "add-to-queue-button");

    g_signal_connect (priv->play_pause_action, "activated",
                      G_CALLBACK (mex_media_controls_play_cb), self);
    g_signal_connect (priv->stop_action, "activated",
                      G_CALLBACK (mex_media_controls_stop_cb), self);
#if 0
    g_signal_connect (priv->add_to_queue_action, "activated",
                      G_CALLBACK (mex_media_controls_add_to_queue_cb) 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CLUTTER_IS_ACTOR函数代码示例发布时间:2022-05-30
下一篇:
C++ CLUTTER_BACKEND_X11函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap