示例#1
0
/**
 * clutter_clone_get_source:
 * @self: a #ClutterClone
 *
 * Retrieves the source #ClutterActor being cloned by @self.
 *
 * Return value: (transfer none): the actor source for the clone
 *
 * Since: 1.0
 */
ClutterActor *
clutter_clone_get_source (ClutterClone *self)
{
  g_return_val_if_fail (CLUTTER_IS_CLONE (self), NULL);

  return self->priv->clone_source;
}
/* input handler */
void 
input_cb (ClutterStage *stage,
	  ClutterEvent *event,
	  gpointer      data)
{
  if (event->type == CLUTTER_BUTTON_PRESS)
    {
      ClutterActor *a;
      gfloat x, y;

      clutter_event_get_coords (event, &x, &y);

      a = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, x, y);
      if (a && (CLUTTER_IS_TEXTURE (a) || CLUTTER_IS_CLONE (a)))
	clutter_actor_hide (a);
    }
  else if (event->type == CLUTTER_KEY_PRESS)
    {
      g_print ("*** key press event (key:%c) ***\n",
	       clutter_event_get_key_symbol (event));
      
      if (clutter_event_get_key_symbol (event) == CLUTTER_q)
	gtk_main_quit ();
    }
}
示例#3
0
/**
 * clutter_clone_set_source:
 * @self: a #ClutterClone
 * @source: (allow-none): a #ClutterActor, or %NULL
 *
 * Sets @source as the source actor to be cloned by @self.
 *
 * Since: 1.0
 */
void
clutter_clone_set_source (ClutterClone *self,
                          ClutterActor *source)
{
  g_return_if_fail (CLUTTER_IS_CLONE (self));
  g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));

  clutter_clone_set_source_internal (self, source);
  clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
}
示例#4
0
/* input handler */
static gboolean
input_cb (ClutterStage *stage,
	  ClutterEvent *event,
	  gpointer      data)
{
  ClutterEventType event_type = clutter_event_type (event);
  SuperOH *oh = data;

  if (event_type == CLUTTER_BUTTON_PRESS)
    {
      ClutterActor *a;
      gfloat x, y;

      clutter_event_get_coords (event, &x, &y);

      a = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, x, y);
      if (a != NULL && (CLUTTER_IS_TEXTURE (a) || CLUTTER_IS_CLONE (a)))
	clutter_actor_hide (a);
    }
  else if (event->type == CLUTTER_KEY_PRESS)
    {
      g_print ("*** key press event (key:%c) ***\n",
	       clutter_event_get_key_symbol (event));
      
      if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_q)
	gtk_main_quit ();
      else if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_r)
        {
          int i;

          for (i = 0; i < NHANDS; i++)
            clutter_actor_show (oh->hand[i]);
        }
    }

  return TRUE;
}
示例#5
0
static void
clutter_clone_set_source_internal (ClutterClone *clone,
				   ClutterActor *source)
{
  ClutterClonePrivate *priv;

  g_return_if_fail (CLUTTER_IS_CLONE (clone));
  g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));

  priv = clone->priv;

  if (priv->clone_source)
    {
      g_signal_handlers_disconnect_by_func (priv->clone_source,
					    (void *) clone_source_queue_redraw_cb,
					    clone);
      g_signal_handlers_disconnect_by_func (priv->clone_source,
					    (void *) clone_source_queue_relayout_cb,
					    clone);
      g_object_unref (priv->clone_source);
      priv->clone_source = NULL;
    }

  if (source)
    {
      priv->clone_source = g_object_ref (source);
      g_signal_connect (priv->clone_source, "queue-redraw",
			G_CALLBACK (clone_source_queue_redraw_cb), clone);
      g_signal_connect (priv->clone_source, "queue-relayout",
			G_CALLBACK (clone_source_queue_relayout_cb), clone);
    }

  g_object_notify (G_OBJECT (clone), "source");

  clutter_actor_queue_relayout (CLUTTER_ACTOR (clone));
}