static void
penge_block_container_paint (ClutterActor *actor)
{
  clutter_container_foreach (CLUTTER_CONTAINER (actor),
                             (ClutterCallback)_paint_foreach_cb,
                             actor);
}
Example #2
0
static void
toggle_texture_quality (ClutterActor *actor)
{
  if (CLUTTER_IS_CONTAINER (actor))
    clutter_container_foreach (CLUTTER_CONTAINER (actor),
                               (ClutterCallback) toggle_texture_quality,
                               NULL);

  if (CLUTTER_IS_TEXTURE (actor))
    {
      ClutterTextureQuality quality;

      quality = clutter_texture_get_filter_quality (CLUTTER_TEXTURE (actor));

      if (quality == CLUTTER_TEXTURE_QUALITY_HIGH)
        quality = CLUTTER_TEXTURE_QUALITY_MEDIUM;
      else
        quality = CLUTTER_TEXTURE_QUALITY_HIGH;

      g_print ("switching to quality %s for %p\n",
               quality == CLUTTER_TEXTURE_QUALITY_HIGH
               ? "high" : "medium",
               actor);

      clutter_texture_set_filter_quality (CLUTTER_TEXTURE (actor), quality);
    }
}
Example #3
0
static void
clutter_group_real_show_all (ClutterActor *actor)
{
  clutter_container_foreach (CLUTTER_CONTAINER (actor),
                             CLUTTER_CALLBACK (clutter_actor_show),
                             NULL);
  clutter_actor_show (actor);
}
Example #4
0
static void
notify_children_of_style_change (ClutterContainer *container)
{
  /* notify our children that their parent stylable has changed */
  clutter_container_foreach (container,
                             notify_children_of_style_change_foreach,
                             NULL);
}
static void
champlain_group_real_hide_all (ClutterActor *actor)
{
  clutter_actor_hide (actor);
  clutter_container_foreach (CLUTTER_CONTAINER (actor),
      CLUTTER_CALLBACK (clutter_actor_hide),
      NULL);
}
Example #6
0
static void
sagarmatha_stack_paint (ClutterActor *actor)
{
  CLUTTER_ACTOR_CLASS (sagarmatha_stack_parent_class)->paint (actor);

  clutter_container_foreach (CLUTTER_CONTAINER (actor),
                             CLUTTER_CALLBACK (clutter_actor_paint),
                             NULL);
}
Example #7
0
static VALUE
rbclt_container_each (VALUE self)
{
  ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));

  clutter_container_foreach (container, rbclt_container_each_callback, NULL);

  return self;
}
Example #8
0
static VALUE
rbclt_container_children (VALUE self)
{
  ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));
  VALUE ary = rb_ary_new ();

  clutter_container_foreach (container, rbclt_container_children_callback,
                             (gpointer) ary);

  return ary;
}
Example #9
0
static void
sagarmatha_stack_pick (ClutterActor       *actor,
                  const ClutterColor *pick)
{
  /* Chain up so we get a bounding box painted (if we are reactive) */
  CLUTTER_ACTOR_CLASS (sagarmatha_stack_parent_class)->pick (actor, pick);

  clutter_container_foreach (CLUTTER_CONTAINER (actor),
                             CLUTTER_CALLBACK (clutter_actor_paint),
                             NULL);
}
static void
ntf_tray_dismiss_all_cb (ClutterActor *button, NtfTray *tray)
{
  NtfTrayPrivate *priv = tray->priv;

  clutter_actor_hide (CLUTTER_ACTOR (tray));

  clutter_container_foreach (CLUTTER_CONTAINER (priv->notifiers),
                             (ClutterCallback)ntf_tray_dismiss_all_foreach,
                             NULL);
}
Example #11
0
/**
 * clutter_container_get_children:
 * @container: a #ClutterContainer
 *
 * Retrieves all the children of @container.
 *
 * Return value: (element-type Clutter.Actor) (transfer container): a list
 *   of #ClutterActor<!-- -->s. Use g_list_free() on the returned
 *   list when done.
 *
 * Since: 0.4
 *
 * Deprecated: 1.10: Use clutter_actor_get_children() instead.
 */
GList *
clutter_container_get_children (ClutterContainer *container)
{
  GList *retval;

  g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);

  retval = NULL;
  clutter_container_foreach (container, get_children_cb, &retval);

  return g_list_reverse (retval);
}
Example #12
0
static void
_container_iface_foreach (ClutterContainer  *container,
                          ClutterCallback    callback,
                          void              *data)
{
  ClutterActor *stage;

  stage = mpl_panel_clutter_get_stage (MPL_PANEL_CLUTTER (container));
  g_return_if_fail (stage);

  clutter_container_foreach (CLUTTER_CONTAINER (stage), callback, data);
}
Example #13
0
/**
 * mex_menu_remove_action:
 * @menu: A #MexMenu
 * @action: The action name
 *
 * Remove the menu item that represents the given action name.
 */
void
mex_menu_remove_action (MexMenu     *menu,
                        const gchar *action_name)
{
  gpointer key, value;
  GHashTableIter iter;
  MexMenuPrivate *priv;

  g_return_if_fail (MEX_IS_MENU (menu));
  g_return_if_fail (action_name);

  priv = menu->priv;

  g_hash_table_iter_init (&iter, priv->action_to_item);
  while (g_hash_table_iter_next (&iter, &key, &value))
    {
      gint n_children;
      ClutterActor *parent;

      MxAction *action = key;
      ClutterActor *item = value;

      if (g_strcmp0 (action_name, mx_action_get_name (action)) != 0)
        continue;

      g_hash_table_iter_remove (&iter);

      parent = clutter_actor_get_parent (item);
      clutter_actor_destroy (item);

      n_children = 0;
      clutter_container_foreach (CLUTTER_CONTAINER (parent),
                                 mex_menu_count_children_cb,
                                 &n_children);

      if (!n_children)
        {
          if (priv->depth > 0)
            mex_menu_pop (menu);
          else if (priv->depth < 0)
            mex_menu_push (menu);
        }

      return;
    }

  g_warning (G_STRLOC ": Action '%s' not found", action_name);
}
Example #14
0
static void
tidy_grid_dispose (GObject *object)
{
  TidyGrid *self = (TidyGrid *) object;
  TidyGridPrivate *priv;
 
  priv = self->priv;

  /* Destroy all of the children. This will cause them to be removed
     from the container and unparented */
  clutter_container_foreach (CLUTTER_CONTAINER (object),
                             (ClutterCallback) clutter_actor_destroy,
                             NULL);

  G_OBJECT_CLASS (tidy_grid_parent_class)->dispose (object);
}
Example #15
0
void
test_texture_fbo (TestConformSimpleFixture *fixture,
                  gconstpointer data)
{
  TestState state;
  guint idle_source;
  gulong paint_handler;
  ClutterActor *actor;
  int ypos = 0;

  state.frame = 0;

  state.stage = clutter_stage_get_default ();

  clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);

  /* Onscreen source with clone next to it */
  actor = create_source ();
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
  clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE);
  actor = clutter_texture_new_from_actor (actor);
  clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
  ypos++;

  /* Offscreen source with clone */
#if 0 /* this doesn't work */
  actor = create_source ();
  actor = clutter_texture_new_from_actor (actor);
  clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
#endif
  ypos++;

  /* Source clipped to the top left division */
  actor = create_source ();
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
  clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE);
  clutter_actor_set_clip (actor, 0, 0, DIVISION_WIDTH, DIVISION_HEIGHT);
  actor = clutter_texture_new_from_actor (actor);
  clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
  ypos++;

  /* Source clipped to everything but top left division using a
     path */
  actor = create_source ();
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
  clutter_actor_set_position (actor, 0, ypos * SOURCE_SIZE);
  g_signal_connect (actor, "paint",
                    G_CALLBACK (pre_paint_clip_cb), NULL);
  g_signal_connect_after (actor, "paint",
                          G_CALLBACK (post_paint_clip_cb), NULL);
  actor = clutter_texture_new_from_actor (actor);
  clutter_actor_set_position (actor, SOURCE_SIZE, ypos * SOURCE_SIZE);
  clutter_container_add (CLUTTER_CONTAINER (state.stage), actor, NULL);
  ypos++;

  /* We force continuous redrawing of the stage, since we need to skip
   * the first few frames, and we wont be doing anything else that
   * will trigger redrawing. */
  idle_source = g_idle_add (queue_redraw, state.stage);

  paint_handler = g_signal_connect_after (state.stage, "paint",
                                          G_CALLBACK (on_paint), &state);

  clutter_actor_show_all (state.stage);

  clutter_main ();

  g_signal_handler_disconnect (state.stage, paint_handler);

  g_source_remove (idle_source);

  /* Remove all of the actors from the stage */
  clutter_container_foreach (CLUTTER_CONTAINER (state.stage),
                             (ClutterCallback) clutter_actor_destroy,
                             NULL);

  if (g_test_verbose ())
    g_print ("OK\n");
}
Example #16
0
static gboolean
key_release_cb (ClutterActor    *actor,
                ClutterKeyEvent *event,
                MxBoxLayout   *box)
{

  if (event->keyval == 'v')
    {
      mx_box_layout_set_orientation (box,
                                     !mx_box_layout_get_orientation (box));
    }

  if (event->keyval == '=')
    {
      add_actor ((ClutterContainer*) box);
    }

  if (event->keyval == '-')
    {
      ClutterActor *child = NULL;

      clutter_container_foreach (CLUTTER_CONTAINER (box), (ClutterCallback) find_last_child, &child);

      if (child)
        clutter_container_remove_actor (CLUTTER_CONTAINER (box), child);
    }

  if (event->keyval == 'c')
    {
      gboolean clip;

      g_object_get (actor, "clip-to-allocation", &clip, NULL);
      g_object_set (actor, "clip-to-allocation", !clip, NULL);
    }

  if (event->keyval == 's')
    {
      guint spacing;

      spacing = mx_box_layout_get_spacing (box);

      if (spacing > 6)
        spacing = 0;
      else
        spacing++;

      mx_box_layout_set_spacing (box, spacing);
    }

  if (event->keyval == 'e')
    {
      if (hover_actor)
        {
          gboolean expand;
          clutter_container_child_get ((ClutterContainer*) box, hover_actor,
                                       "expand", &expand, NULL);
          clutter_container_child_set ((ClutterContainer*) box, hover_actor,
                                       "expand", !expand, NULL);
        }
    }

  if (event->keyval == 'a')
    {
      mx_box_layout_set_enable_animations (box,
                                           !mx_box_layout_get_enable_animations (box));
    }

  return FALSE;
}
Example #17
0
void
opt_show_step (OptShow *self, gint step)
{
  OptSlide       *from, *to;
  OptShowPrivate *priv;
  OptTransition  *trans;
  ClutterActor *stage;

  priv = self->priv;

  /* transition already running */
  if (priv->trans_signal_id != 0)
    return;

  stage = clutter_stage_get_default();

  from = g_list_nth_data (priv->slides, priv->current_slide_num);
  to   = g_list_nth_data (priv->slides, priv->current_slide_num + step);

  if (from == NULL)
    from = priv->slides->data;
  
  /* Nowhere to go */
  if (to == NULL)
    return;

  /* Add next slide to stage */
  clutter_group_add (CLUTTER_GROUP(stage), CLUTTER_ACTOR(to));

  trans = opt_slide_get_transition ( step < 0 ? to : from);

  /* 
   * Make sure any textures are loaded before the transitions is started .
  */
  clutter_container_foreach (CLUTTER_CONTAINER (to), 
                             (ClutterCallback)clutter_actor_realize,
                             NULL);

  if (trans != NULL)
    {
      if (step < 0)
	opt_transition_set_direction (trans, OPT_TRANSITION_BACKWARD);
      else
	opt_transition_set_direction (trans, OPT_TRANSITION_FORWARD);

      /* Set up transition and start it */
      opt_transition_set_to (trans, to);
      opt_transition_set_from (trans, from);

      priv->trans_signal_id 
	= g_signal_connect (trans,
			    "completed",  
			    G_CALLBACK (transition_completed_cb), 
			    self);

      /* lower it out of view */
      clutter_actor_lower_bottom (CLUTTER_ACTOR(to));

      clutter_timeline_start (CLUTTER_TIMELINE(trans));
    }
  else
    {
      /* No transition just hide current slide*/
      clutter_group_remove (CLUTTER_GROUP(stage), CLUTTER_ACTOR(from));
      clutter_actor_hide_all (CLUTTER_ACTOR(from));
    }
  
  /* Advance */
    priv->current_slide_num += step;

  priv->current_slide_num = 
      CLAMP(priv->current_slide_num, 0, priv->num_slides-1);

  if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (priv->menu)))
      opt_menu_popdown (priv->menu);
  
  opt_menu_set_current_slide (priv->menu, priv->current_slide_num);
}
Example #18
0
static void
rbclt_container_mark (void *p)
{
  clutter_container_foreach (CLUTTER_CONTAINER (p),
                             rbclt_container_mark_callback, NULL);
}