static void ntf_overlay_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { NtfOverlayPrivate *priv = NTF_OVERLAY (actor)->priv; ClutterActorClass *klass; gfloat my_width, my_height; ClutterActor *tna = CLUTTER_ACTOR (priv->tray_normal); ClutterActor *tua = CLUTTER_ACTOR (priv->tray_urgent); ClutterActor *lowlight = priv->lowlight; klass = CLUTTER_ACTOR_CLASS (ntf_overlay_parent_class); klass->allocate (actor, box, flags); my_width = box->x2 - box->x1; my_height = box->y2 - box->y1; { ClutterActorBox tray_box; gfloat p_width, p_height, m_width, m_height; clutter_actor_get_preferred_width (tna, -1.0, &m_width, &p_width); clutter_actor_get_preferred_height (tna, p_width, &m_height, &p_height); tray_box.x1 = my_width - p_width; tray_box.y1 = my_height - p_height; tray_box.x2 = tray_box.x1 + p_width; tray_box.y2 = tray_box.y1 + p_height; clutter_actor_allocate (tna, &tray_box, flags); } { ClutterActorBox tray_box; gfloat p_width, p_height, m_width, m_height; clutter_actor_get_preferred_width (tua, -1.0, &m_width, &p_width); clutter_actor_get_preferred_height (tua, p_width, &m_height, &p_height); tray_box.x1 = (gint)((my_width - p_width) / 2.0); tray_box.y1 = (gint)((my_height - p_height) / 2.0); tray_box.x2 = tray_box.x1 + p_width; tray_box.y2 = tray_box.y1 + p_height; clutter_actor_allocate (tua, &tray_box, flags); } { ClutterActorBox lowlight_box; lowlight_box.x1 = 0.0; lowlight_box.y1 = 0.0; lowlight_box.x2 = my_width; lowlight_box.y2 = my_height; clutter_actor_allocate (lowlight, &lowlight_box, flags); } }
static void st_widget_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { StWidget *self = ST_WIDGET (actor); StWidgetPrivate *priv = self->priv; StThemeNode *theme_node; ClutterActorClass *klass; ClutterGeometry area; ClutterVertex in_v, out_v; theme_node = st_widget_get_theme_node (self); klass = CLUTTER_ACTOR_CLASS (st_widget_parent_class); klass->allocate (actor, box, flags); /* update tooltip position */ if (priv->tooltip) { in_v.x = in_v.y = in_v.z = 0; clutter_actor_apply_transform_to_point (actor, &in_v, &out_v); area.x = out_v.x; area.y = out_v.y; in_v.x = box->x2 - box->x1; in_v.y = box->y2 - box->y1; clutter_actor_apply_transform_to_point (actor, &in_v, &out_v); area.width = out_v.x - area.x; area.height = out_v.y - area.y; st_tooltip_set_tip_area (priv->tooltip, &area); } }
static void ntf_tray_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { NtfTrayPrivate *priv = NTF_TRAY (actor)->priv; ClutterActorClass *klass; gfloat m_height = 0.0, p_height = 0.0; gfloat control_height = 0.0; klass = CLUTTER_ACTOR_CLASS (ntf_tray_parent_class); klass->allocate (actor, box, flags); if (priv->control && CLUTTER_ACTOR_IS_MAPPED (priv->control)) { clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->control), box->x2 - box->x1, NULL, &control_height); } if (priv->notifiers) { ClutterActorBox notifier_box = { 0, }; clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->notifiers), box->x2 - box->x1, &m_height, &p_height); notifier_box.x2 = box->x2 - box->x1; notifier_box.y2 = p_height; clutter_actor_allocate (CLUTTER_ACTOR (priv->notifiers), ¬ifier_box, flags); } if (priv->control && CLUTTER_ACTOR_IS_MAPPED (priv->control)) { ClutterActorBox control_box; control_box.x1 = 0.0; control_box.y1 = p_height - 30; clutter_actor_get_preferred_height (CLUTTER_ACTOR (priv->control), box->x2 - box->x1, &m_height, &p_height); control_box.x2 = box->x2 - box->x1; control_box.y2 = control_box.y1 + p_height; clutter_actor_allocate (CLUTTER_ACTOR (priv->control), &control_box, flags); } }
static void clutter_box_real_allocate (ClutterActor *actor, const ClutterActorBox *allocation, ClutterAllocationFlags flags) { ClutterBoxPrivate *priv = CLUTTER_BOX (actor)->priv; ClutterActorClass *klass; klass = CLUTTER_ACTOR_CLASS (clutter_box_parent_class); klass->allocate (actor, allocation, flags); clutter_layout_manager_allocate (priv->manager, CLUTTER_CONTAINER (actor), allocation, flags); }
static void champlain_group_real_allocate (ClutterActor *actor, const ClutterActorBox *allocation, ClutterAllocationFlags flags) { ChamplainGroupPrivate *priv = CHAMPLAIN_GROUP (actor)->priv; ClutterActorClass *klass; klass = CLUTTER_ACTOR_CLASS (champlain_group_parent_class); klass->allocate (actor, allocation, flags); if (priv->children == NULL) return; clutter_layout_manager_allocate (priv->layout, CLUTTER_CONTAINER (actor), allocation, flags); }
/* Actor was (re)parented */ static void _xfdashboard_actor_parent_set(ClutterActor *inActor, ClutterActor *inOldParent) { XfdashboardActor *self; XfdashboardActorPrivate *priv; ClutterActorClass *parentClass; g_return_if_fail(XFDASHBOARD_IS_ACTOR(inActor)); self=XFDASHBOARD_ACTOR(inActor); priv=self->priv; /* Call parent's virtual function */ parentClass=CLUTTER_ACTOR_CLASS(xfdashboard_actor_parent_class); if(parentClass->parent_set) { parentClass->parent_set(inActor, inOldParent); } /* Check if it is a newly created actor which is parented for the first time. * Then emit 'actor-created' signal on stage. */ if(priv->isFirstParent && !inOldParent && clutter_actor_get_parent(inActor)) { ClutterActor *stage; /* Get stage where this actor belongs to and emit signal at stage */ stage=clutter_actor_get_stage(inActor); if(XFDASHBOARD_IS_STAGE(stage)) { g_signal_emit_by_name(stage, "actor-created", inActor, NULL); } /* Set flag that a parent set and signal was emitted */ priv->isFirstParent=FALSE; } /* Invalide styling to get it recomputed because its ID (from point * of view of css) has changed. Also invalidate children as they might * reference the old, invalid parent or the new, valid one. */ _xfdashboard_actor_invalidate_recursive(CLUTTER_ACTOR(self)); }
/* Actor is hidden */ static void _xfdashboard_actor_hide(ClutterActor *inActor) { XfdashboardActor *self; ClutterActorClass *parentClass; g_return_if_fail(XFDASHBOARD_IS_ACTOR(inActor)); self=XFDASHBOARD_ACTOR(inActor); /* Call parent's virtual function */ parentClass=CLUTTER_ACTOR_CLASS(xfdashboard_actor_parent_class); if(parentClass->hide) { parentClass->hide(inActor); } /* Actor is hidden now so remove pseudo-class ":hover" because pointer cannot * be in an actor hidden. */ xfdashboard_stylable_remove_pseudo_class(XFDASHBOARD_STYLABLE(self), "hover"); }
/* Pointer entered actor */ static gboolean _xfdashboard_actor_enter_event(ClutterActor *inActor, ClutterCrossingEvent *inEvent) { XfdashboardActor *self; ClutterActorClass *parentClass; g_return_val_if_fail(XFDASHBOARD_IS_ACTOR(inActor), CLUTTER_EVENT_PROPAGATE); self=XFDASHBOARD_ACTOR(inActor); /* Call parent's virtual function */ parentClass=CLUTTER_ACTOR_CLASS(xfdashboard_actor_parent_class); if(parentClass->enter_event) { parentClass->enter_event(inActor, inEvent); } /* Add pseudo-class ":hover" because pointer entered actor */ xfdashboard_stylable_add_pseudo_class(XFDASHBOARD_STYLABLE(self), "hover"); return(CLUTTER_EVENT_PROPAGATE); }
/* Actor was (re)parented */ static void xfdashboard_stage_interface_parent_set(ClutterActor *inActor, ClutterActor *inOldParent) { XfdashboardStageInterface *self; XfdashboardStageInterfacePrivate *priv; ClutterActorClass *parentClass; ClutterActor *newParent; g_return_if_fail(XFDASHBOARD_IS_STAGE_INTERFACE(inActor)); self=XFDASHBOARD_STAGE_INTERFACE(inActor); priv=self->priv; /* Call parent's virtual function */ parentClass=CLUTTER_ACTOR_CLASS(xfdashboard_stage_interface_parent_class); if(parentClass->parent_set) { parentClass->parent_set(inActor, inOldParent); } /* Set up property bindings to new parent actor */ newParent=clutter_actor_get_parent(inActor); if(priv->bindingBackgroundImageType) { g_object_unref(priv->bindingBackgroundImageType); priv->bindingBackgroundImageType=NULL; } if(priv->bindingBackgroundColor) { g_object_unref(priv->bindingBackgroundColor); priv->bindingBackgroundColor=NULL; } if(newParent && XFDASHBOARD_IS_STAGE(newParent)) { priv->bindingBackgroundImageType=g_object_bind_property(self, "background-image-type", newParent, "background-image-type", G_BINDING_DEFAULT); priv->bindingBackgroundColor=g_object_bind_property(self, "background-color", newParent, "background-color", G_BINDING_DEFAULT); } }
/* Actor was (re)parented */ static void _xfdashboard_actor_parent_set(ClutterActor *inActor, ClutterActor *inOldParent) { XfdashboardActor *self; ClutterActorClass *parentClass; g_return_if_fail(XFDASHBOARD_IS_ACTOR(inActor)); self=XFDASHBOARD_ACTOR(inActor); /* Call parent's virtual function */ parentClass=CLUTTER_ACTOR_CLASS(xfdashboard_actor_parent_class); if(parentClass->parent_set) { parentClass->parent_set(inActor, inOldParent); } /* Invalide styling to get it recomputed because its ID (from point * of view of css) has changed. Also invalidate children as they might * reference the old, invalid parent or the new, valid one. */ _xfdashboard_actor_invalidate_recursive(CLUTTER_ACTOR(self)); }
/* Actor is shown */ static void _xfdashboard_actor_show(ClutterActor *inActor) { XfdashboardActor *self; ClutterActorClass *parentClass; g_return_if_fail(XFDASHBOARD_IS_ACTOR(inActor)); self=XFDASHBOARD_ACTOR(inActor); /* Call parent's virtual function */ parentClass=CLUTTER_ACTOR_CLASS(xfdashboard_actor_parent_class); if(parentClass->show) { parentClass->show(inActor); } /* If actor is visible now check if pointer is inside this actor * then add pseudo-class ":hover" to it */ if(clutter_actor_has_pointer(inActor)) { xfdashboard_stylable_add_pseudo_class(XFDASHBOARD_STYLABLE(self), "hover"); } }
static void ntf_overlay_parent_set (ClutterActor *overlay, ClutterActor *old_parent) { NtfOverlayPrivate *priv = NTF_OVERLAY (overlay)->priv; ClutterActorClass *klass = CLUTTER_ACTOR_CLASS (ntf_overlay_parent_class); ClutterActor *parent = clutter_actor_get_parent (overlay); if (priv->stage_allocation_id) { g_signal_handler_disconnect (old_parent, priv->stage_allocation_id); priv->stage_allocation_id = 0; } if (klass->parent_set) klass->parent_set (overlay, old_parent); if (parent) { priv->stage_allocation_id = g_signal_connect (parent, "notify::allocation", G_CALLBACK (ntf_overlay_stage_allocation_cb), overlay); } }