request_mode


Description:

[ Version ( since = "0.8" ) ]
public RequestMode request_mode { get; set; }

Request mode for the Actor.

The request mode determines the type of geometry management used by the actor, either height for width (the default) or width for height.

For actors implementing height for width, the parent container should get the preferred width first, and then the preferred height for that width.

For actors implementing width for height, the parent container should get the preferred height first, and then the preferred width for that height.

For instance:

	ClutterRequestMode mode;
gfloat natural_width, min_width;
gfloat natural_height, min_height;

mode = clutter_actor_get_request_mode (child);
if (mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
{
clutter_actor_get_preferred_width (child, -1,
&min_width,
&natural_width);
clutter_actor_get_preferred_height (child, natural_width,
&min_height,
&natural_height);
}
else if (mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
{
clutter_actor_get_preferred_height (child, -1,
&min_height,
&natural_height);
clutter_actor_get_preferred_width (child, natural_height,
&min_width,
&natural_width);
}
else if (mode == CLUTTER_REQUEST_CONTENT_SIZE)
{
ClutterContent *content = clutter_actor_get_content (child);

min_width, min_height = 0;
natural_width = natural_height = 0;

if (content != NULL)
clutter_content_get_preferred_size (content, &natural_width, &natural_height);
}

will retrieve the minimum and natural width and height depending on the preferred request mode of the Actor "child".

The get_preferred_size function will implement this check for you.




2022 vala-language.org