layout-manager: Add compute_expand() vfunc

This virtual function will let layout managers with legacy expansion
flags be able to influence the lazy computation of the expansion flags
on ClutterActor.
This commit is contained in:
Emmanuele Bassi 2011-12-20 18:38:47 +00:00 committed by Emmanuele Bassi
parent fd5e422b9f
commit 2956116561
2 changed files with 25 additions and 3 deletions

View File

@ -577,6 +577,21 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
clutter_layout_manager_layout_changed (manager);
}
static void
layout_manager_real_compute_expand (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *child,
gboolean *x_expand,
gboolean *y_expand)
{
/* be default, we don't interfere with the Actor [xy]-expand */
if (x_expand != NULL)
*x_expand = FALSE;
if (y_expand != NULL)
*y_expand = FALSE;
}
static void
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
{
@ -594,6 +609,7 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
klass->get_animation_progress = layout_manager_real_get_animation_progress;
klass->end_animation = layout_manager_real_end_animation;
klass->set_container = layout_manager_real_set_container;
klass->compute_expand = layout_manager_real_compute_expand;
/**
* ClutterLayoutManager::layout-changed:

View File

@ -90,6 +90,9 @@ struct _ClutterLayoutManager
* progress of the animation of a #ClutterLayoutManager
* @layout_changed: class handler for the #ClutterLayoutManager::layout-changed
* signal
* @compute_expand: virtual function, used to let the layout manager instance
* influence the result of the clutter_actor_needs_x_expand() and
* clutter_actor_needs_y_expand() functions
*
* The #ClutterLayoutManagerClass structure contains only private
* data and should be accessed using the provided API
@ -102,7 +105,6 @@ struct _ClutterLayoutManagerClass
GInitiallyUnownedClass parent_class;
/*< public >*/
/* vfuncs, not signals */
void (* get_preferred_width) (ClutterLayoutManager *manager,
ClutterContainer *container,
gfloat for_height,
@ -132,9 +134,14 @@ struct _ClutterLayoutManagerClass
gdouble (* get_animation_progress) (ClutterLayoutManager *manager);
void (* end_animation) (ClutterLayoutManager *manager);
/* signals */
void (* layout_changed) (ClutterLayoutManager *manager);
void (* compute_expand) (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *child,
gboolean *x_expand,
gboolean *y_expand);
/*< private >*/
/* padding for future expansion */
void (* _clutter_padding_1) (void);
@ -144,7 +151,6 @@ struct _ClutterLayoutManagerClass
void (* _clutter_padding_5) (void);
void (* _clutter_padding_6) (void);
void (* _clutter_padding_7) (void);
void (* _clutter_padding_8) (void);
};
GType clutter_layout_manager_get_type (void) G_GNUC_CONST;