static void shell_drawing_area_allocate (ClutterActor *self, const ClutterActorBox *box, ClutterAllocationFlags flags) { ShellDrawingArea *area = SHELL_DRAWING_AREA (self); int width = box->x2 - box->x1; int height = box->y2 - box->y1; ClutterActorBox child_box; /* Chain up directly to ClutterActor to set actor->allocation. We explicitly skip our parent class * ClutterGroup here because we want to override the allocate function. */ (CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->allocate (self, box, flags); child_box.x1 = 0; child_box.x2 = width; child_box.y1 = 0; child_box.y2 = height; clutter_actor_allocate (CLUTTER_ACTOR (area->priv->texture), &child_box, flags); if (width > 0 && height > 0) { clutter_cairo_texture_set_surface_size (area->priv->texture, width, height); g_signal_emit (G_OBJECT (self), shell_drawing_area_signals[REDRAW], 0, area->priv->texture); } }
static void shell_overflow_list_pick (ClutterActor *actor, const ClutterColor *color) { ShellOverflowList *self = SHELL_OVERFLOW_LIST (actor); ShellOverflowListPrivate *priv = self->priv; GList *children, *iter; int i; (CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->pick (actor, color); shell_overflow_list_paint (self); }
static void sagarmatha_slicer_allocate (ClutterActor *self, const ClutterActorBox *box, ClutterAllocationFlags flags) { ClutterActor *child; /* Chain up directly to ClutterActor to set actor->allocation. We explicitly skip our parent class * StBin here because we want to override the allocate function. */ CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ()))->allocate (self, box, flags); child = st_bin_get_child (ST_BIN (self)); if (child) clutter_actor_allocate_preferred_size (child, flags); }
static void shell_overflow_list_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { ShellOverflowList *self = SHELL_OVERFLOW_LIST (actor); ShellOverflowListPrivate *priv = self->priv; GList *children, *iter; int n_pages; int n_children; int n_fits; float width; float curheight; float avail_height; gboolean overflow; /* chain up to set actor->allocation */ (CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->allocate (actor, box, flags); width = box->x2 - box->x1; curheight = 0; avail_height = box->y2 - box->y1; children = clutter_container_get_children (CLUTTER_CONTAINER (self)); n_children = g_list_length (children); n_fits = 0; n_pages = 1; overflow = FALSE; for (iter = children; iter; iter = iter->next) { ClutterActor *actor = CLUTTER_ACTOR (iter->data); ClutterActorBox child_box; if ((curheight + priv->item_height) > avail_height) { overflow = TRUE; curheight = 0; n_pages++; } else if (!overflow) n_fits++; child_box.x1 = 0; child_box.x2 = width; child_box.y1 = curheight; child_box.y2 = child_box.y1 + priv->item_height; clutter_actor_allocate (actor, &child_box, flags); curheight += priv->item_height; if (iter != children) curheight += priv->spacing; } priv->items_per_page = n_fits; if (n_pages != priv->n_pages) { priv->n_pages = n_pages; g_object_notify (G_OBJECT (self), "n-pages"); } g_list_free (children); }