Table of Contents

Widgets Menu


Flip Widgets

The flip widget can hold two Evas Objects and allows the user flip between them using several pre-defined animations.

Table of Contents

Adding a Flip

This is how to create a flip widget.

Evas_Object *flip, *content1, *content2;
flip = elm_flip_add(parent);

We can add content to the flip widget. content1 is set to the “front” content and content2 is set to the “back” mode.

elm_object_part_content_set(flip, "front", content1);
elm_object_part_content_set(flip, "back", content2);

Configuring Flip Animation

Now we can run an flip animation.

elm_flip_go(flip, ELM_FLIP_CUBE_UP);

This animation flips up the “front” content object as if it was on a side of a cube, letting the down facing side of the cube appear with the “back” content object. Several animations are available:

elm_flip_go_to(flip,front,ELM_FLIP_CUBE_UP) is the same as elm_flip_go() except if front is EINA_TRUE it makes front visible, otherwise makes back.

Interacting With the User

By default, the user cannot interact with the flip. We can set the interaction to be possible, but we have to choose which animation appears on the interaction (rotation has been selected in the following example).

elm_flip_interaction_set(flip, ELM_FLIP_INTERACTION_ROTATE);

The available modes of interaction are

We must also choose, which interaction directions are enabled (only right and left in the following example).

elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_LEFT, EINA_TRUE);
elm_flip_interaction_direction_enabled_set(flip, ELM_FLIP_DIRECTION_RIGHT, EINA_TRUE);

We can also set the amount of the flip that is sensitive to user interaction. In the following example, it is set to the entire flip (1) to make the flip easy to interact with.

elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_LEFT, 1);
elm_flip_interaction_direction_hitsize_set(flip, ELM_FLIP_DIRECTION_RIGHT, 1);

Using Flip Callbacks

Two signals are emitted by the flip: one when an animation starts and one when it ends. For these signals, event_info parameter is NULL.

We can register a callback on the “animation,begin” signal.

evas_object_smart_callback_add(entry, "animate,begin", _anim_start_cb, data);
 
// Callback function for the "animate,begin" signal
// This callback is called when the flip animation starts
static void
_anim_start_cb(void *data, Evas_Object *obj, void *event_info)
{
   printf("Animation starts\n");
}


A Flip Example


Widgets Menu