allocate_available_size


Description:

[ Version ( since = "1.0" ) ]
public void allocate_available_size (float x, float y, float available_width, float available_height, AllocationFlags flags)

Allocates this taking into account the Actor's 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, flags);

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:

this

a Actor

x

the actor's X coordinate

y

the actor's Y coordinate

available_width

the maximum available width, or -1 to use the actor's natural width

available_height

the maximum available height, or -1 to use the actor's natural height

flags

flags controlling the allocation