layout: Change the request-mode along with the orientation
When changing the orientation of a FlowLayout, the associated container should also change its request mode. A horizontally flowing layout has a height depending on the width, since it will reflow vertically; similarly, a vertically reflowing layout will have a width depending on the height.
This commit is contained in:
parent
b5895335ab
commit
eb40e856e1
@ -69,8 +69,6 @@ struct _ClutterFlowLayoutPrivate
|
|||||||
gfloat max_row_height;
|
gfloat max_row_height;
|
||||||
gfloat row_height;
|
gfloat row_height;
|
||||||
|
|
||||||
gint max_row_items;
|
|
||||||
|
|
||||||
guint is_homogeneous : 1;
|
guint is_homogeneous : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -333,6 +331,20 @@ clutter_flow_layout_set_container (ClutterLayoutManager *manager,
|
|||||||
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
||||||
|
|
||||||
priv->container = container;
|
priv->container = container;
|
||||||
|
|
||||||
|
if (priv->container != NULL)
|
||||||
|
{
|
||||||
|
ClutterRequestMode request_mode;
|
||||||
|
|
||||||
|
/* we need to change the :request-mode of the container
|
||||||
|
* to match the orientation
|
||||||
|
*/
|
||||||
|
request_mode = (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
||||||
|
? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH
|
||||||
|
: CLUTTER_REQUEST_WIDTH_FOR_HEIGHT;
|
||||||
|
clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container),
|
||||||
|
request_mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -668,6 +680,20 @@ clutter_flow_layout_set_orientation (ClutterFlowLayout *layout,
|
|||||||
|
|
||||||
priv->orientation = orientation;
|
priv->orientation = orientation;
|
||||||
|
|
||||||
|
if (priv->container != NULL)
|
||||||
|
{
|
||||||
|
ClutterRequestMode request_mode;
|
||||||
|
|
||||||
|
/* we need to change the :request-mode of the container
|
||||||
|
* to match the orientation
|
||||||
|
*/
|
||||||
|
request_mode = (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
||||||
|
? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH
|
||||||
|
: CLUTTER_REQUEST_WIDTH_FOR_HEIGHT;
|
||||||
|
clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container),
|
||||||
|
request_mode);
|
||||||
|
}
|
||||||
|
|
||||||
manager = CLUTTER_LAYOUT_MANAGER (layout);
|
manager = CLUTTER_LAYOUT_MANAGER (layout);
|
||||||
clutter_layout_manager_layout_changed (manager);
|
clutter_layout_manager_layout_changed (manager);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user