static void _xfdashboard_scaled_table_layout_get_preferred_height(ClutterLayoutManager *self, ClutterContainer *inContainer, gfloat inForWidth, gfloat *outMinHeight, gfloat *outNaturalHeight) { XfdashboardScaledTableLayoutPrivate *priv; gfloat maxMinHeight, maxNaturalHeight; ClutterActor *parent; g_return_if_fail(XFDASHBOARD_IS_SCALED_TABLE_LAYOUT(self)); g_return_if_fail(CLUTTER_IS_CONTAINER(inContainer)); priv=XFDASHBOARD_SCALED_TABLE_LAYOUT(self)->priv; /* Set up default values */ maxMinHeight=0.0f; maxNaturalHeight=0.0f; /* Update number of rows and columns needed for layout */ _xfdashboard_scaled_table_layout_update_rows_and_columns(XFDASHBOARD_SCALED_TABLE_LAYOUT(self), inContainer); /* Get size of parent if this child is parented and if it is not reentrant */ parent=clutter_actor_get_parent(CLUTTER_ACTOR(inContainer)); if(parent && !priv->reentrantDetermineHeight) { /* Prevent getting size of parent (reentrance) */ priv->reentrantDetermineHeight=TRUE; /* Get size of parent */ clutter_actor_get_size(CLUTTER_ACTOR(parent), NULL, &maxNaturalHeight); /* Allow getting size of parent again */ priv->reentrantDetermineHeight=FALSE; } /* Calculate height */ if(priv->rows>0) { maxMinHeight=(priv->rows-1)*priv->rowSpacing; if(maxNaturalHeight==0.0f) maxNaturalHeight=(priv->rows-1)*priv->rowSpacing; } /* Set return values */ if(outMinHeight) *outMinHeight=maxMinHeight; if(outNaturalHeight) *outNaturalHeight=maxNaturalHeight; }
/* Get preferred width/height */ static void _xfdashboard_scaled_table_layout_get_preferred_width(ClutterLayoutManager *self, ClutterContainer *inContainer, gfloat inForHeight, gfloat *outMinWidth, gfloat *outNaturalWidth) { XfdashboardScaledTableLayoutPrivate *priv; gfloat maxMinWidth, maxNaturalWidth; ClutterActor *parent; g_return_if_fail(XFDASHBOARD_IS_SCALED_TABLE_LAYOUT(self)); g_return_if_fail(CLUTTER_IS_CONTAINER(inContainer)); priv=XFDASHBOARD_SCALED_TABLE_LAYOUT(self)->priv; /* Set up default values */ maxMinWidth=0.0f; maxNaturalWidth=0.0f; /* Update number of rows and columns needed for layout */ _xfdashboard_scaled_table_layout_update_rows_and_columns(XFDASHBOARD_SCALED_TABLE_LAYOUT(self), inContainer); /* Get size of parent if this child is parented */ parent=clutter_actor_get_parent(CLUTTER_ACTOR(inContainer)); if(parent) clutter_actor_get_size(CLUTTER_ACTOR(parent), &maxNaturalWidth, NULL); /* Calculate width */ if(priv->columns>0) { maxMinWidth=(priv->columns-1)*priv->columnSpacing; if(maxNaturalWidth==0.0f) maxNaturalWidth=(priv->columns-1)*priv->columnSpacing; } /* Set return values */ if(outMinWidth) *outMinWidth=maxMinWidth; if(outNaturalWidth) *outNaturalWidth=maxNaturalWidth; }