Method

ClutterActorallocate_available_size

Declaration [src]

void
clutter_actor_allocate_available_size (
  ClutterActor* self,
  gfloat x,
  gfloat y,
  gfloat available_width,
  gfloat available_height
)

Description [src]

Allocates self taking into account the ClutterActors preferred size, but limiting it to the maximum available width and height provided.

This function will do the right thing when dealing with the actor’s request mode.

The implementation of this function is equivalent to:

  if (request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
    {
      clutter_actor_get_preferred_width (self, available_height,
                                         &min_width,
                                         &natural_width);
      width = CLAMP (natural_width, min_width, available_width);

      clutter_actor_get_preferred_height (self, width,
                                          &min_height,
                                          &natural_height);
      height = CLAMP (natural_height, min_height, available_height);
    }
  else if (request_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
    {
      clutter_actor_get_preferred_height (self, available_width,
                                          &min_height,
                                          &natural_height);
      height = CLAMP (natural_height, min_height, available_height);

      clutter_actor_get_preferred_width (self, height,
                                         &min_width,
                                         &natural_width);
      width = CLAMP (natural_width, min_width, available_width);
    }
  else if (request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
    {
      clutter_content_get_preferred_size (content, &natural_width, &natural_height);

      width = CLAMP (natural_width, 0, available_width);
      height = CLAMP (natural_height, 0, available_height);
    }

  box.x1 = x; box.y1 = y;
  box.x2 = box.x1 + available_width;
  box.y2 = box.y1 + available_height;
  clutter_actor_allocate (self, &box);

This function can be used by fluid layout managers to allocate an actor’s preferred size without making it bigger than the area available for the container.

Parameters

x

Type: gfloat

The actor’s X coordinate.

y

Type: gfloat

The actor’s Y coordinate.

available_width

Type: gfloat

The maximum available width, or -1 to use the actor’s natural width.

available_height

Type: gfloat

The maximum available height, or -1 to use the actor’s natural height.