examples: Update layout-manager example to use the animations API
https://bugzilla.gnome.org/show_bug.cgi?id=676827
This commit is contained in:
parent
793bde9143
commit
1339b39132
@ -193,6 +193,9 @@ multi_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
int n_items, n_items_per_row, item_index;
|
int n_items, n_items_per_row, item_index;
|
||||||
ClutterPoint center;
|
ClutterPoint center;
|
||||||
double radius, theta;
|
double radius, theta;
|
||||||
|
gboolean use_animations;
|
||||||
|
ClutterAnimationMode easing_mode;
|
||||||
|
guint easing_duration, easing_delay;
|
||||||
|
|
||||||
n_items = get_visible_children (CLUTTER_ACTOR (container));
|
n_items = get_visible_children (CLUTTER_ACTOR (container));
|
||||||
if (n_items == 0)
|
if (n_items == 0)
|
||||||
@ -221,6 +224,11 @@ multi_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
(avail_height - self->cell_height) / 2.0);
|
(avail_height - self->cell_height) / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use_animations = clutter_layout_manager_get_easing_state (manager,
|
||||||
|
&easing_mode,
|
||||||
|
&easing_duration,
|
||||||
|
&easing_delay);
|
||||||
|
|
||||||
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (container));
|
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (container));
|
||||||
while (clutter_actor_iter_next (&iter, &child))
|
while (clutter_actor_iter_next (&iter, &child))
|
||||||
{
|
{
|
||||||
@ -254,8 +262,17 @@ multi_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
child_allocation.y2 = child_allocation.y1 + self->cell_height;
|
child_allocation.y2 = child_allocation.y1 + self->cell_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (use_animations)
|
||||||
|
{
|
||||||
clutter_actor_save_easing_state (child);
|
clutter_actor_save_easing_state (child);
|
||||||
|
clutter_actor_set_easing_mode (child, easing_mode);
|
||||||
|
clutter_actor_set_easing_duration (child, easing_duration);
|
||||||
|
clutter_actor_set_easing_delay (child, easing_delay);
|
||||||
|
}
|
||||||
|
|
||||||
clutter_actor_allocate (child, &child_allocation, flags);
|
clutter_actor_allocate (child, &child_allocation, flags);
|
||||||
|
|
||||||
|
if (use_animations)
|
||||||
clutter_actor_restore_easing_state (child);
|
clutter_actor_restore_easing_state (child);
|
||||||
|
|
||||||
item_index += 1;
|
item_index += 1;
|
||||||
@ -365,6 +382,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
manager = multi_layout_new ();
|
manager = multi_layout_new ();
|
||||||
multi_layout_set_spacing ((MultiLayout *) manager, PADDING);
|
multi_layout_set_spacing ((MultiLayout *) manager, PADDING);
|
||||||
|
clutter_layout_manager_set_use_animations (manager, TRUE);
|
||||||
|
|
||||||
margin.top = margin.bottom = margin.left = margin.right = PADDING;
|
margin.top = margin.bottom = margin.left = margin.right = PADDING;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user