[elm_image.c, elm_icon.c] bug fix : elm_icon is disappeared when theme hook is called...
[framework/uifw/elementary.git] / src / lib / elm_flip.c
index cfe11d1..d02acdd 100644 (file)
@@ -1,31 +1,6 @@
 #include <Elementary.h>
 #include "elm_priv.h"
 
-/**
- * @defgroup Flip Flip
- *
- * This holds 2 content objects: one on the front and one on the back. It
- * allows you to flip from front to back and vice-versa using various effects.
- *
- * Supported flip types:
- * ELM_FLIP_ROTATE_Y_CENTER_AXIS
- * ELM_FLIP_ROTATE_X_CENTER_AXIS
- * ELM_FLIP_ROTATE_XZ_CENTER_AXIS
- * ELM_FLIP_ROTATE_YZ_CENTER_AXIS
- * ELM_FLIP_CUBE_LEFT
- * ELM_FLIP_CUBE_RIGHT
- * ELM_FLIP_CUBE_UP
- * ELM_FLIP_CUBE_DOWN
- * ELM_FLIP_PAGE_LEFT
- * ELM_FLIP_PAGE_RIGHT
- * ELM_FLIP_PAGE_UP
- * ELM_FLIP_PAGE_DOWN
- *
- * Signals that you can add callbacks for are:
- *
- * "animate,done" - when a flip animation is finished
- */
-
 typedef struct _Widget_Data Widget_Data;
 typedef struct _Slice Slice;
 typedef struct _Vertex2 Vertex2;
@@ -55,9 +30,10 @@ struct _Widget_Data
    Elm_Flip_Mode mode;
    Evas_Object *clip;
    Evas_Object *event[4];
-   struct {
-      Evas_Object *content, *clip;
-   } front, back;
+   struct
+     {
+        Evas_Object *content, *clip;
+     } front, back;
    Ecore_Job *job;
    Evas_Coord down_x, down_y, x, y, ox, oy, w, h;
    Elm_Flip_Interaction intmode;
@@ -82,7 +58,7 @@ static void _sizing_eval(Evas_Object *obj);
 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
 
-static void _state_slices_clear(Widget_Data *st);
+static void _state_slices_clear(Widget_Data *wd);
 static void _configure(Evas_Object *obj);
 
 static const char SIG_ANIMATE_BEGIN[] = "animate,begin";
@@ -113,19 +89,17 @@ _theme_hook(Evas_Object *obj)
 }
 
 static Eina_Bool
-_elm_flip_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
+_elm_flip_focus_next_hook(const Evas_Object *obj,
+                          Elm_Focus_Direction dir, Evas_Object **next)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
-
-   if (!wd)
-     return EINA_FALSE;
+   if (!wd) return EINA_FALSE;
 
    /* Try Focus cycle in subitem */
    if (wd->state)
      return elm_widget_focus_next_get(wd->front.content, dir, next);
    else
      return elm_widget_focus_next_get(wd->back.content, dir, next);
-
 }
 
 static void
@@ -177,7 +151,8 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
    if (!wd) return;
    if (sub == wd->front.content)
      {
-        evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+        evas_object_event_callback_del_full(sub,
+                                            EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                             _changed_size_hints, obj);
         wd->front.content = NULL;
         evas_object_hide(wd->front.clip);
@@ -185,7 +160,8 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
      }
    else if (sub == wd->back.content)
      {
-        evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+        evas_object_event_callback_del_full(sub,
+                                            EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                             _changed_size_hints, obj);
         wd->back.content = NULL;
         evas_object_hide(wd->back.clip);
@@ -194,18 +170,17 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
 }
 
 static Slice *
-_slice_new(Widget_Data *st __UNUSED__, Evas_Object *obj)
+_slice_new(Widget_Data *wd, Evas_Object *obj)
 {
    Slice *sl;
 
    sl = calloc(1, sizeof(Slice));
    if (!sl) return NULL;
    sl->obj = evas_object_image_add(evas_object_evas_get(obj));
-   elm_widget_sub_object_add(st->obj, sl->obj);
-   evas_object_clip_set(sl->obj, evas_object_clip_get(st->obj));
-   evas_object_smart_member_add(sl->obj, st->obj);
-   evas_object_image_smooth_scale_set(sl->obj, 0);
-   evas_object_pass_events_set(sl->obj, 1);
+   elm_widget_sub_object_add(wd->obj, sl->obj);
+   evas_object_smart_member_add(sl->obj, wd->obj);
+   evas_object_image_smooth_scale_set(sl->obj, EINA_FALSE);
+   evas_object_pass_events_set(sl->obj, EINA_TRUE);
    evas_object_image_source_set(sl->obj, obj);
    return sl;
 }
@@ -218,8 +193,8 @@ _slice_free(Slice *sl)
 }
 
 static void
-_slice_apply(Widget_Data *st, Slice *sl,
-             Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__, Evas_Coord w, Evas_Coord h __UNUSED__,
+_slice_apply(Widget_Data *wd, Slice *sl, Evas_Coord x __UNUSED__,
+             Evas_Coord y __UNUSED__, Evas_Coord w, Evas_Coord h __UNUSED__,
              Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
 {
    Evas_Map *m;
@@ -227,32 +202,36 @@ _slice_apply(Widget_Data *st, Slice *sl,
 
    m = evas_map_new(4);
    if (!m) return;
-   evas_map_smooth_set(m, 0);
+   evas_map_smooth_set(m, EINA_FALSE);
    for (i = 0; i < 4; i++)
      {
         evas_map_point_color_set(m, i, 255, 255, 255, 255);
-        if (st->dir == 0)
+        if (wd->dir == 0)
           {
              int p[4] = { 0, 1, 2, 3 };
-             evas_map_point_coord_set(m, i, ox + sl->x[p[i]], oy + sl->y[p[i]], sl->z[p[i]]);
+             evas_map_point_coord_set(m, i, ox + sl->x[p[i]], oy + sl->y[p[i]],
+                                      sl->z[p[i]]);
              evas_map_point_image_uv_set(m, i, sl->u[p[i]] , sl->v[p[i]]);
           }
-        else if (st->dir == 1)
+        else if (wd->dir == 1)
           {
              int p[4] = { 1, 0, 3, 2 };
-             evas_map_point_coord_set(m, i, ox + (w - sl->x[p[i]]), oy + sl->y[p[i]], sl->z[p[i]]);
-             evas_map_point_image_uv_set(m, i, ow - sl->u[p[i]] , sl->v[p[i]]);
+             evas_map_point_coord_set(m, i, ox + (w - sl->x[p[i]]),
+                                      oy + sl->y[p[i]], sl->z[p[i]]);
+             evas_map_point_image_uv_set(m, i, ow - sl->u[p[i]], sl->v[p[i]]);
           }
-        else if (st->dir == 2)
+        else if (wd->dir == 2)
           {
              int p[4] = { 1, 0, 3, 2 };
-             evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + sl->x[p[i]], sl->z[p[i]]);
+             evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + sl->x[p[i]],
+                                      sl->z[p[i]]);
              evas_map_point_image_uv_set(m, i, sl->v[p[i]] , sl->u[p[i]]);
           }
-        else if (st->dir == 3)
+        else/* if (wd->dir == 3) will be this anyway */
           {
              int p[4] = { 0, 1, 2, 3 };
-             evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + (w - sl->x[p[i]]), sl->z[p[i]]);
+             evas_map_point_coord_set(m, i, ox + sl->y[p[i]],
+                                      oy + (w - sl->x[p[i]]), sl->z[p[i]]);
              evas_map_point_image_uv_set(m, i, sl->v[p[i]] , oh - sl->u[p[i]]);
           }
      }
@@ -263,7 +242,8 @@ _slice_apply(Widget_Data *st, Slice *sl,
 }
 
 static void
-_slice_3d(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
+_slice_3d(Widget_Data *wd __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y,
+          Evas_Coord w, Evas_Coord h)
 {
    Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
    int i;
@@ -273,9 +253,9 @@ _slice_3d(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Eva
    evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 1024);
    for (i = 0; i < 4; i++)
      {
-        Evas_Coord x, y, z;
-        evas_map_point_coord_get(m, i, &x, &y, &z);
-        evas_map_point_coord_set(m, i, xy, 0);
+        Evas_Coord xx, yy, zz;
+        evas_map_point_coord_get(m, i, &xx, &yy, &zz);
+        evas_map_point_coord_set(m, i, xx, yy, 0);
      }
    if (evas_map_util_clockwise_get(m)) evas_object_show(sl->obj);
    else evas_object_hide(sl->obj);
@@ -283,7 +263,7 @@ _slice_3d(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Eva
 }
 
 static void
-_slice_light(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
+_slice_light(Widget_Data *wd __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
 {
    Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
    int i;
@@ -311,20 +291,20 @@ _slice_light(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y,
 }
 
 static void
-_slice_xyz(Widget_Data *st __UNUSED__, Slice *sl,
-           double x1, double y1, double z1,
-           double x2, double y2, double z2,
-           double x3, double y3, double z3,
-           double x4, double y4, double z4)
+_slice_xyz(Widget_Data *wd __UNUSED__, Slice *sl,
+           double xx1, double yy1, double zz1,
+           double xx2, double yy2, double zz2,
+           double xx3, double yy3, double zz3,
+           double xx4, double yy4, double zz4)
 {
-   sl->x[0] = x1; sl->y[0] = y1; sl->z[0] = z1;
-   sl->x[1] = x2; sl->y[1] = y2; sl->z[1] = z2;
-   sl->x[2] = x3; sl->y[2] = y3; sl->z[2] = z3;
-   sl->x[3] = x4; sl->y[3] = y4; sl->z[3] = z4;
+   sl->x[0] = xx1; sl->y[0] = yy1; sl->z[0] = zz1;
+   sl->x[1] = xx2; sl->y[1] = yy2; sl->z[1] = zz2;
+   sl->x[2] = xx3; sl->y[2] = yy3; sl->z[2] = zz3;
+   sl->x[3] = xx4; sl->y[3] = yy4; sl->z[3] = zz4;
 }
 
 static void
-_slice_uv(Widget_Data *st __UNUSED__, Slice *sl,
+_slice_uv(Widget_Data *wd __UNUSED__, Slice *sl,
           double u1, double v1,
           double u2, double v2,
           double u3, double v3,
@@ -371,29 +351,29 @@ _interp_point(Vertex3 *vi1, Vertex3 *vi2, Vertex3 *vo, double v)
 }
 
 static void
-_state_slices_clear(Widget_Data *st)
+_state_slices_clear(Widget_Data *wd)
 {
    int i, j, num;
 
-   if (st->slices)
+   if (wd->slices)
      {
         num = 0;
-        for (j = 0; j < st->slices_h; j++)
+        for (j = 0; j < wd->slices_h; j++)
           {
-             for (i = 0; i < st->slices_w; i++)
+             for (i = 0; i < wd->slices_w; i++)
                {
-                  if (st->slices[num]) _slice_free(st->slices[num]);
-                  if (st->slices2[num]) _slice_free(st->slices2[num]);
+                  if (wd->slices[num]) _slice_free(wd->slices[num]);
+                  if (wd->slices2[num]) _slice_free(wd->slices2[num]);
                   num++;
                }
           }
-        free(st->slices);
-        free(st->slices2);
-        st->slices = NULL;
-        st->slices2 = NULL;
+        free(wd->slices);
+        free(wd->slices2);
+        wd->slices = NULL;
+        wd->slices2 = NULL;
      }
-   st->slices_w = 0;
-   st->slices_h = 0;
+   wd->slices_w = 0;
+   wd->slices_h = 0;
 }
 
 static int
@@ -416,7 +396,7 @@ _slice_obj_color_set(Slice *s, int p, int r, int g, int b, int a)
    Evas_Map *m;
 
    if (!s) return;
-   m = (Evas_Map *)evas_object_map_get(s->obj);
+   m = (Evas_Map *) evas_object_map_get(s->obj);
    if (!m) return;
    evas_map_point_color_set(m, p, r, g, b, a);
    evas_object_map_set(s->obj, m);
@@ -443,76 +423,75 @@ _slice_obj_vert_color_merge(Slice *s1, int p1, Slice *s2, int p2,
 }
 
 static int
-_state_update(Widget_Data *st)
+_state_update(Widget_Data *wd)
 {
-   Evas_Coord x1, y1, x2, y2, mx, my;
+   Evas_Coord xx1, yy1, xx2, yy2, mx, my;
    Evas_Coord x, y, w, h, ox, oy, ow, oh;
    int i, j, num, nn, jump, num2;
    Slice *sl;
    double b, minv = 0.0, minva, mgrad;
    int gx, gy, gszw, gszh, gw, gh, col, row, nw, nh;
    double rho, A, theta, perc, percm, n, rhol, Al, thetal;
-   Vertex2 *tvi;
    Vertex3 *tvo, *tvol;
    Evas_Object *front, *back;
 
-   st->backflip = 1;
-   if (st->state)
+   wd->backflip = EINA_TRUE;
+   if (wd->state)
      {
-        front = st->front.content;
-        back = st->front.content;
+        front = wd->front.content;
+        back = wd->front.content;
      }
    else
      {
-        front = st->back.content;
-        back = st->back.content;
+        front = wd->back.content;
+        back = wd->back.content;
      }
 
-   evas_object_geometry_get(st->obj, &x, &y, &w, &h);
+   evas_object_geometry_get(wd->obj, &x, &y, &w, &h);
    ox = x; oy = y; ow = w; oh = h;
-   x1 = st->down_x;
-   y1 = st->down_y;
-   x2 = st->x;
-   y2 = st->y;
+   xx1 = wd->down_x;
+   yy1 = wd->down_y;
+   xx2 = wd->x;
+   yy2 = wd->y;
 
-   if (st->dir == 0)
+   if (wd->dir == 0)
      {
         // no nothing. left drag is standard
      }
-   else if (st->dir == 1)
+   else if (wd->dir == 1)
      {
-        x1 = (w - 1) - x1;
-        x2 = (w - 1) - x2;
+        xx1 = (w - 1) - xx1;
+        xx2 = (w - 1) - xx2;
      }
-   else if (st->dir == 2)
+   else if (wd->dir == 2)
      {
         Evas_Coord tmp;
 
-        tmp = x1; x1 = y1; y1 = tmp;
-        tmp = x2; x2 = y2; y2 = tmp;
+        tmp = xx1; xx1 = yy1; yy1 = tmp;
+        tmp = xx2; xx2 = yy2; yy2 = tmp;
         tmp = w; w = h; h = tmp;
      }
-   else if (st->dir == 3)
+   else/* if (wd->dir == 3) will be this anyway */
      {
         Evas_Coord tmp;
 
-        tmp = x1; x1 = y1; y1 = tmp;
-        tmp = x2; x2 = y2; y2 = tmp;
+        tmp = xx1; xx1 = yy1; yy1 = tmp;
+        tmp = xx2; xx2 = yy2; yy2 = tmp;
         tmp = w; w = h; h = tmp;
-        x1 = (w - 1) - x1;
-        x2 = (w - 1) - x2;
+        xx1 = (w - 1) - xx1;
+        xx2 = (w - 1) - xx2;
      }
 
-   if (x2 >= x1) x2 = x1 - 1;
-   mx = (x1 + x2) / 2;
-   my = (y1 + y2) / 2;
+   if (xx2 >= xx1) xx2 = xx1 - 1;
+   mx = (xx1 + xx2) / 2;
+   my = (yy1 + yy2) / 2;
 
    if (mx < 0) mx = 0;
    else if (mx >= w) mx = w - 1;
    if (my < 0) my = 0;
    else if (my >= h) my = h - 1;
 
-   mgrad = (double)(y1 - y2) / (double)(x1 - x2);
+   mgrad = (double)(yy1 - yy2) / (double)(xx1 - xx2);
 
    if (mx < 1) mx = 1; // quick hack to keep curl line visible
 
@@ -538,8 +517,8 @@ _state_update(Widget_Data *st)
           }
      }
 
-   perc = (double)x2 / (double)x1;
-   percm = (double)mx / (double)x1;
+   perc = (double)xx2 / (double)xx1;
+   percm = (double)mx / (double)xx1;
    if (perc < 0.0) perc = 0.0;
    else if (perc > 1.0) perc = 1.0;
    if (percm < 0.0) percm = 0.0;
@@ -576,8 +555,6 @@ _state_update(Widget_Data *st)
 
    nw = 16;
    nh = 16;
-   if (nw < 1) nw = 1;
-   if (nh < 1) nh = 1;
    gszw = w / nw;
    gszh = h / nh;
    if (gszw < 4) gszw = 4;
@@ -585,27 +562,26 @@ _state_update(Widget_Data *st)
 
    nw = (w + gszw - 1) / gszw;
    nh = (h + gszh - 1) / gszh;
-   if ((st->slices_w != nw) || (st->slices_h != nh)) _state_slices_clear(st);
-   st->slices_w = nw;
-   st->slices_h = nh;
-   if (!st->slices)
+   if ((wd->slices_w != nw) || (wd->slices_h != nh)) _state_slices_clear(wd);
+   wd->slices_w = nw;
+   wd->slices_h = nh;
+   if (!wd->slices)
      {
-        st->slices = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
-        if (!st->slices) return 0;
-        st->slices2 = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
-        if (!st->slices2)
+        wd->slices = calloc(wd->slices_w * wd->slices_h, sizeof(Slice *));
+        if (!wd->slices) return 0;
+        wd->slices2 = calloc(wd->slices_w * wd->slices_h, sizeof(Slice *));
+        if (!wd->slices2)
           {
-             free(st->slices);
-             st->slices = NULL;
+             free(wd->slices);
+             wd->slices = NULL;
              return 0;
           }
      }
 
-   num = (st->slices_w + 1) * (st->slices_h + 1);
+   num = (wd->slices_w + 1) * (wd->slices_h + 1);
 
-   tvi = alloca(sizeof(Vertex2) * num);
    tvo = alloca(sizeof(Vertex3) * num);
-   tvol = alloca(sizeof(Vertex3) * (st->slices_w + 1));
+   tvol = alloca(sizeof(Vertex3) * (wd->slices_w + 1));
 
    for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
      {
@@ -640,10 +616,10 @@ _state_update(Widget_Data *st)
           }
      }
 
-   jump = st->slices_h + 1;
+   jump = wd->slices_h + 1;
    for (col = 0, gx = 0; gx < w; gx += gszw, col++)
      {
-        num = st->slices_h * col;
+        num = wd->slices_h * col;
         num2 = jump * col;
 
         gw = gszw;
@@ -653,7 +629,7 @@ _state_update(Widget_Data *st)
           {
              Vertex3 vo[4];
 
-             if (b > 0) nn = num + st->slices_h - row - 1;
+             if (b > 0) nn = num + wd->slices_h - row - 1;
              else nn = num + row;
 
              gh = gszh;
@@ -675,148 +651,122 @@ _state_update(Widget_Data *st)
                }
 
              // FRONT
-             sl = st->slices[nn];
+             sl = wd->slices[nn];
              if (!sl)
                {
-                  sl = _slice_new(st, front);
-                  st->slices[nn] = sl;
+                  sl = _slice_new(wd, front);
+                  wd->slices[nn] = sl;
                }
-             _slice_xyz(st, sl,
+             _slice_xyz(wd, sl,
                         vo[0].x, vo[0].y, vo[0].z,
                         vo[1].x, vo[1].y, vo[1].z,
                         vo[2].x, vo[2].y, vo[2].z,
                         vo[3].x, vo[3].y, vo[3].z);
              if (b <= 0)
-                _slice_uv(st, sl,
-                          gx,       gy,       gx + gw,  gy,
-                          gx + gw,  gy + gh,  gx,       gy + gh);
+               _slice_uv(wd, sl,
+                         gx, gy, gx + gw,  gy,  gx + gw,  gy + gh, gx, gy + gh);
              else
-                _slice_uv(st, sl,
-                          gx,       h - (gy + gh), gx + gw,  h - (gy + gh),
-                          gx + gw,  h - gy,        gx,       h - gy);
+               _slice_uv(wd, sl,
+                         gx, h - (gy + gh), gx + gw, h - (gy + gh), gx + gw,
+                         h - gy, gx, h - gy);
 
-                          // BACK
-             sl = st->slices2[nn];
+             // BACK
+             sl = wd->slices2[nn];
              if (!sl)
                {
-                  sl = _slice_new(st, back);
-                  st->slices2[nn] = sl;
+                  sl = _slice_new(wd, back);
+                  wd->slices2[nn] = sl;
                }
 
-             _slice_xyz(st, sl,
+             _slice_xyz(wd, sl,
                         vo[1].x, vo[1].y, vo[1].z,
                         vo[0].x, vo[0].y, vo[0].z,
                         vo[3].x, vo[3].y, vo[3].z,
                         vo[2].x, vo[2].y, vo[2].z);
-             if (st->backflip)
+             if (wd->backflip)
                {
                   if (b <= 0)
-                     _slice_uv(st, sl,
-                               gx + gw, gy,       gx,       gy,
-                               gx,      gy + gh,  gx + gw,  gy + gh);
+                    _slice_uv(wd, sl, gx + gw, gy, gx, gy, gx, gy + gh, gx + gw,
+                              gy + gh);
                   else
-                     _slice_uv(st, sl,
-                               gx + gw, h - (gy + gh), gx,      h - (gy + gh),
-                               gx,      h - gy,        gx + gw, h - gy);
+                    _slice_uv(wd, sl, gx + gw, h - (gy + gh), gx, h - (gy + gh),
+                              gx, h - gy, gx + gw, h - gy);
                }
              else
                {
                   if (b <= 0)
-                     _slice_uv(st, sl,
-                               w - (gx + gw), gy,       w - (gx),      gy,
-                               w - (gx),      gy + gh,  w - (gx + gw), gy + gh);
+                    _slice_uv(wd, sl, w - (gx + gw), gy, w - (gx), gy, w - (gx),
+                              gy + gh, w - (gx + gw), gy + gh);
                   else
-                     _slice_uv(st, sl,
-                               w - (gx + gw), h - (gy + gh), w - (gx),      h - (gy + gh),
-                               w - (gx),      h - gy,        w - (gx + gw), h - gy);
+                    _slice_uv(wd, sl, w - (gx + gw), h - (gy + gh), w - (gx),
+                              h - (gy + gh),  w - (gx), h - gy, w - (gx + gw),
+                              h - gy);
                }
           }
      }
 
-   num = 0;
-   for (j = 0; j < st->slices_h; j++)
+   for (num = 0; num < wd->slices_h * wd->slices_w; num++)
      {
-        for (i = 0; i < st->slices_w; i++)
-          {
-             _slice_apply(st, st->slices[num], x, y, w, h, ox, oy, ow, oh);
-             _slice_apply(st, st->slices2[num], x, y, w, h, ox, oy, ow, oh);
-             _slice_light(st, st->slices[num], ox, oy, ow, oh);
-             _slice_light(st, st->slices2[num], ox, oy, ow, oh);
-             num++;
-          }
+        _slice_apply(wd, wd->slices[num], x, y, w, h, ox, oy, ow, oh);
+        _slice_apply(wd, wd->slices2[num], x, y, w, h, ox, oy, ow, oh);
+        _slice_light(wd, wd->slices[num], ox, oy, ow, oh);
+        _slice_light(wd, wd->slices2[num], ox, oy, ow, oh);
      }
 
-   for (i = 0; i <= st->slices_w; i++)
+   for (i = 0; i <= wd->slices_w; i++)
      {
-        num = i * st->slices_h;
-        for (j = 0; j <= st->slices_h; j++)
+        num = i * wd->slices_h;
+        for (j = 0; j <= wd->slices_h; j++)
           {
-             Slice *s[4];
-
-             s[0] = s[1] = s[2] = s[3] = NULL;
-             if ((i > 0)            && (j > 0))
-                s[0] = st->slices[num - 1 - st->slices_h];
-             if ((i < st->slices_w) && (j > 0))
-                s[1] = st->slices[num - 1];
-             if ((i > 0)            && (j < st->slices_h))
-                s[2] = st->slices[num - st->slices_h];
-             if ((i < st->slices_w) && (j < st->slices_h))
-                s[3] = st->slices[num];
-             if (st->dir == 0)
-                _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
-                                            s[2], 1, s[3], 0);
-             else if (st->dir == 1)
-                _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
-                                            s[2], 0, s[3], 1);
-             else if (st->dir == 2)
-                _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
-                                            s[2], 0, s[3], 1);
-             else if (st->dir == 3)
-                _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
-                                            s[2], 1, s[3], 0);
-             s[0] = s[1] = s[2] = s[3] = NULL;
-             if ((i > 0)            && (j > 0))
-                s[0] = st->slices2[num - 1 - st->slices_h];
-             if ((i < st->slices_w) && (j > 0))
-                s[1] = st->slices2[num - 1];
-             if ((i > 0)            && (j < st->slices_h))
-                s[2] = st->slices2[num - st->slices_h];
-             if ((i < st->slices_w) && (j < st->slices_h))
-                s[3] = st->slices2[num];
-             if (st->dir == 0)
-                _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
-                                            s[2], 0, s[3], 1);
-             else if (st->dir == 1)
-                _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
-                                            s[2], 1, s[3], 0);
-             else if (st->dir == 2)
-                _slice_obj_vert_color_merge(s[0], 2, s[1], 3,
-                                            s[2], 1, s[3], 0);
-             else if (st->dir == 3)
-                _slice_obj_vert_color_merge(s[0], 3, s[1], 2,
-                                            s[2], 0, s[3], 1);
+             Slice *s[4] = { NULL }, *s2[4] = { NULL };
+
+             if ((i > 0) && (j > 0))
+                s[0] = wd->slices[num - 1 - wd->slices_h],
+                s2[0] = wd->slices2[num - 1 - wd->slices_h];
+             if ((i < wd->slices_w) && (j > 0))
+                s[1] = wd->slices[num - 1],
+                s2[1] = wd->slices2[num - 1];
+             if ((i > 0) && (j < wd->slices_h))
+                s[2] = wd->slices[num - wd->slices_h],
+                s2[2] = wd->slices2[num - wd->slices_h];
+             if ((i < wd->slices_w) && (j < wd->slices_h))
+                s[3] = wd->slices[num],
+                s2[3] = wd->slices2[num];
+             switch (wd->dir)
+               {
+                case 0:
+                  _slice_obj_vert_color_merge(s[0], 2, s[1], 3, s[2], 1, s[3], 0);
+                  _slice_obj_vert_color_merge(s2[0], 3, s2[1], 2, s2[2], 0, s2[3], 1);
+                  break;
+                case 1:
+                  _slice_obj_vert_color_merge(s[0], 3, s[1], 2, s[2], 0, s[3], 1);
+                  _slice_obj_vert_color_merge(s2[0], 2, s2[1], 3, s2[2], 1, s2[3], 0);
+                  break;
+                case 2:
+                  _slice_obj_vert_color_merge(s[0], 3, s[1], 2, s[2], 0, s[3], 1);
+                  _slice_obj_vert_color_merge(s2[0], 2, s2[1], 3, s2[2], 1, s2[3], 0);
+                  break;
+                default:
+                  _slice_obj_vert_color_merge(s[0], 2, s[1], 3, s[2], 1, s[3], 0);
+                  _slice_obj_vert_color_merge(s2[0], 3, s2[1], 2, s2[2], 0, s2[3], 1);
+               }
              num++;
           }
      }
 
-   num = 0;
-   for (i = 0; i < st->slices_w; i++)
+   for (num = 0; num < wd->slices_h * wd->slices_w; num++)
      {
-        for (j = 0; j < st->slices_h; j++)
-          {
-             _slice_3d(st, st->slices[num], ox, oy, ow, oh);
-             _slice_3d(st, st->slices2[num], ox, oy, ow, oh);
-             num++;
-          }
+        _slice_3d(wd, wd->slices[num], ox, oy, ow, oh);
+        _slice_3d(wd, wd->slices2[num], ox, oy, ow, oh);
      }
 
    return 1;
 }
 
 static void
-_state_end(Widget_Data *st)
+_state_end(Widget_Data *wd)
 {
-   _state_slices_clear(st);
+   _state_slices_clear(wd);
 }
 
 
@@ -824,7 +774,7 @@ static void
 flip_show_hide(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (elm_flip_front_get(obj))
+   if (elm_flip_front_visible_get(obj))
      {
         if (wd->pageflip)
           {
@@ -846,10 +796,7 @@ flip_show_hide(Evas_Object *obj)
                 evas_object_show(wd->front.clip);
              else
                 evas_object_hide(wd->front.clip);
-             if (wd->back.content)
-                evas_object_hide(wd->back.clip);
-             else
-                evas_object_hide(wd->back.clip);
+             evas_object_hide(wd->back.clip);
           }
      }
    else
@@ -895,9 +842,9 @@ _flip_do(Evas_Object *obj, double t, Elm_Flip_Mode mode, int lin, int rev)
    if (!wd) return;
 
    mf = evas_map_new(4);
-   evas_map_smooth_set(mf, 0);
+   evas_map_smooth_set(mf, EINA_FALSE);
    mb = evas_map_new(4);
-   evas_map_smooth_set(mb, 0);
+   evas_map_smooth_set(mb, EINA_FALSE);
 
    if (wd->front.content)
      {
@@ -1044,6 +991,7 @@ _flip_do(Evas_Object *obj, double t, Elm_Flip_Mode mode, int lin, int rev)
          break;
       case ELM_FLIP_CUBE_UP:
          p = 1.0 - t;
+         pp = p;
          if (!lin) pp = (p * p);
          p = 1.0 - pp;
          deg = -90.0 * p;
@@ -1311,23 +1259,23 @@ _pos_get(Widget_Data *wd, int *rev, Elm_Flip_Mode *m)
              if (wd->dir == 0)
                {
                   if (wd->down_x > 0)
-                     t = 1.0 - ((double)wd->x / (double)wd->down_x);
+                    t = 1.0 - ((double)wd->x / (double)wd->down_x);
                   *rev = 1;
                }
              else if (wd->dir == 1)
                {
                   if (wd->down_x < w)
-                     t = 1.0 - ((double)(w - wd->x) / (double)(w - wd->down_x));
+                    t = 1.0 - ((double)(w - wd->x) / (double)(w - wd->down_x));
                }
              else if (wd->dir == 2)
                {
                   if (wd->down_y > 0)
-                     t = 1.0 - ((double)wd->y / (double)wd->down_y);
+                    t = 1.0 - ((double)wd->y / (double)wd->down_y);
                }
              else if (wd->dir == 3)
                {
                   if (wd->down_y < h)
-                     t = 1.0 - ((double)(h - wd->y) / (double)(h - wd->down_y));
+                    t = 1.0 - ((double)(h - wd->y) / (double)(h - wd->down_y));
                   *rev = 1;
                }
 
@@ -1566,22 +1514,29 @@ _move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *even
 
         dx = wd->x - wd->down_x;
         dy = wd->y - wd->down_y;
-        if (((dx * dx) + (dy * dy)) > (_elm_config->finger_size * _elm_config->finger_size / 4))
+        if (((dx * dx) + (dy * dy)) >
+            (_elm_config->finger_size * _elm_config->finger_size / 4))
           {
              wd->dir = 0;
-             if      ((wd->x > (w / 2)) && (dx <  0) && (abs(dx) >  abs(dy))) wd->dir = 0; // left
-             else if ((wd->x < (w / 2)) && (dx >= 0) && (abs(dx) >  abs(dy))) wd->dir = 1; // right
-             else if ((wd->y > (h / 2)) && (dy <  0) && (abs(dy) >= abs(dx))) wd->dir = 2; // up
-             else if ((wd->y < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) wd->dir = 3; // down
+             if ((wd->x > (w / 2)) &&
+                 (dx <  0) && (abs(dx) > abs(dy)))
+               wd->dir = 0; // left
+             else if ((wd->x < (w / 2)) && (dx >= 0) &&
+                      (abs(dx) > abs(dy)))
+               wd->dir = 1; // right
+             else if ((wd->y > (h / 2)) && (dy <  0) && (abs(dy) >= abs(dx)))
+               wd->dir = 2; // up
+             else if ((wd->y < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx)))
+               wd->dir = 3; // down
              wd->started = EINA_TRUE;
              if (wd->intmode == ELM_FLIP_INTERACTION_PAGE)
-                wd->pageflip = EINA_TRUE;
+               wd->pageflip = EINA_TRUE;
              flip_show_hide(data);
              evas_smart_objects_calculate(evas_object_evas_get(data));
              _flip(data);
              // FIXME: hack around evas rendering bug (only fix makes evas bitch-slow)
-             evas_object_map_enable_set(wd->front.content, 0);
-             evas_object_map_enable_set(wd->back.content, 0);
+             evas_object_map_enable_set(wd->front.content, EINA_FALSE);
+             evas_object_map_enable_set(wd->back.content, EINA_FALSE);
 // FIXME: XXX why does this bork interactive flip??
 //             evas_object_resize(wd->front.content, 0, 0);
 //             evas_object_resize(wd->back.content, 0, 0);
@@ -1597,109 +1552,29 @@ _move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *even
    wd->job = ecore_job_add(_update_job, wd);
 }
 
-/**
- * Add a new flip to the parent
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Flip
- */
-EAPI Evas_Object *
-elm_flip_add(Evas_Object *parent)
-{
-   Evas_Object *obj;
-   Evas *e;
-   Widget_Data *wd;
-
-   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
-   ELM_SET_WIDTYPE(widtype, "flip");
-   elm_widget_type_set(obj, "flip");
-   elm_widget_sub_object_add(parent, obj);
-   elm_widget_data_set(obj, wd);
-   elm_widget_del_hook_set(obj, _del_hook);
-   elm_widget_theme_hook_set(obj, _theme_hook);
-   elm_widget_focus_next_hook_set(obj, _elm_flip_focus_next_hook);
-   elm_widget_can_focus_set(obj, EINA_FALSE);
-
-   wd->obj = obj;
-
-   wd->clip = evas_object_rectangle_add(e);
-   evas_object_static_clip_set(wd->clip, 1);
-   evas_object_color_set(wd->clip, 255, 255, 255, 255);
-   evas_object_move(wd->clip, -49999, -49999);
-   evas_object_resize(wd->clip, 99999, 99999);
-   elm_widget_sub_object_add(obj, wd->clip);
-   evas_object_clip_set(wd->clip, evas_object_clip_get(obj));
-   evas_object_smart_member_add(wd->clip, obj);
-
-   wd->front.clip = evas_object_rectangle_add(e);
-   evas_object_static_clip_set(wd->front.clip, 1);
-   evas_object_data_set(wd->front.clip, "_elm_leaveme", obj);
-   evas_object_color_set(wd->front.clip, 255, 255, 255, 255);
-   evas_object_move(wd->front.clip, -49999, -49999);
-   evas_object_resize(wd->front.clip, 99999, 99999);
-   elm_widget_sub_object_add(obj, wd->front.clip);
-   evas_object_smart_member_add(wd->front.clip, obj);
-   evas_object_clip_set(wd->front.clip, wd->clip);
-
-   wd->back.clip = evas_object_rectangle_add(e);
-   evas_object_static_clip_set(wd->back.clip, 1);
-   evas_object_data_set(wd->back.clip, "_elm_leaveme", obj);
-   evas_object_color_set(wd->back.clip, 255, 255, 255, 255);
-   evas_object_move(wd->back.clip, -49999, -49999);
-   evas_object_resize(wd->back.clip, 99999, 99999);
-   elm_widget_sub_object_add(wd->back.clip, obj);
-   evas_object_smart_member_add(obj, wd->back.clip);
-   evas_object_clip_set(wd->back.clip, wd->clip);
-
-   evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
-   evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL);
-   evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);
-
-   evas_object_smart_callbacks_descriptions_set(obj, _signals);
-
-   wd->state = 1;
-   wd->intmode = ELM_FLIP_INTERACTION_NONE;
-
-   _sizing_eval(obj);
-
-   return obj;
-}
-
-/**
- * Set the front content of the flip widget.
- *
- * Once the content object is set, a previously set one will be deleted.
- * If you want to keep that old content object, use the
- * elm_flip_content_front_unset() function.
- *
- * @param obj The flip object
- * @param content The new front content object
- *
- * @ingroup Flip
- */
-EAPI void
-elm_flip_content_front_set(Evas_Object *obj, Evas_Object *content)
+static void
+_flip_content_front_set(Evas_Object *obj, Evas_Object *content)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
-   int i;
    if (!wd) return;
+
+   int i;
+
    if (wd->front.content == content) return;
-   if (wd->front.content) evas_object_del(wd->back.content);
+   if (wd->front.content) evas_object_del(wd->front.content);
    wd->front.content = content;
    if (content)
      {
         elm_widget_sub_object_add(obj, content);
         evas_object_smart_member_add(content, obj);
+        //FIXME: smart member clip could be reset by the obj.
         evas_object_clip_set(content, wd->front.clip);
         evas_object_event_callback_add(content,
                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                        _changed_size_hints, obj);
         _sizing_eval(obj);
      }
+
    // force calc to contents are the right size before transition
    evas_smart_objects_calculate(evas_object_evas_get(obj));
    flip_show_hide(obj);
@@ -1710,25 +1585,13 @@ elm_flip_content_front_set(Evas_Object *obj, Evas_Object *content)
      }
 }
 
-/**
- * Set the back content of the flip widget.
- *
- * Once the content object is set, a previously set one will be deleted.
- * If you want to keep that old content object, use the
- * elm_flip_content_back_unset() function.
- *
- * @param obj The flip object
- * @param content The new back content object
- *
- * @ingroup Flip
- */
-EAPI void
-elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
+static void
+_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
-   int i;
    if (!wd) return;
+
+   int i;
    if (wd->back.content == content) return;
    if (wd->back.content) evas_object_del(wd->back.content);
    wd->back.content = content;
@@ -1736,12 +1599,14 @@ elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
      {
         elm_widget_sub_object_add(obj, content);
         evas_object_smart_member_add(content, obj);
+        //FIXME: smart member clip could be reset by the obj.
         evas_object_clip_set(content, wd->back.clip);
         evas_object_event_callback_add(content,
                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                        _changed_size_hints, obj);
         _sizing_eval(obj);
      }
+
    // force calc to contents are the right size before transition
    evas_smart_objects_calculate(evas_object_evas_get(obj));
    flip_show_hide(obj);
@@ -1752,103 +1617,135 @@ elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
      }
 }
 
-/**
- * Get the front content used for the flip
- *
- * Return the front content object which is set for this widget.
- *
- * @param obj The flip object
- * @return The front content object that is being used
- *
- * @ingroup Flip
- */
-EAPI Evas_Object *
-elm_flip_content_front_get(const Evas_Object *obj)
+static Evas_Object *
+_content_front_unset(Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
-   return wd->front.content;
-}
+   if ((!wd) || (!wd->front.content)) return NULL;
 
-
-/**
- * Get the back content used for the flip
- *
- * Return the back content object which is set for this widget.
- *
- * @param obj The flip object
- * @return The back content object that is being used
- *
- * @ingroup Flip
- */
-EAPI Evas_Object *
-elm_flip_content_back_get(const Evas_Object *obj)
-{
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   Widget_Data *wd = elm_widget_data_get(obj);
-   return wd->back.content;
+   Evas_Object *content = wd->front.content;
+   elm_widget_sub_object_del(obj, content);
+   evas_object_smart_member_del(content);
+   return content;
 }
 
-/**
- * Unset the front content used for the flip
- *
- * Unparent and return the front content object which was set for this widget.
- *
- * @param obj The flip object
- * @return The front content object that was being used
- *
- * @ingroup Flip
- */
-EAPI Evas_Object *
-elm_flip_content_front_unset(Evas_Object *obj)
+static Evas_Object *
+_content_back_unset(Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
-   if (!wd->front.content) return NULL;
-   Evas_Object *content = wd->front.content;
-   evas_object_clip_unset(content);
+   if ((!wd) || (!wd->back.content)) return NULL;
+
+   Evas_Object *content = wd->back.content;
    elm_widget_sub_object_del(obj, content);
    evas_object_smart_member_del(content);
-   wd->front.content = NULL;
    return content;
 }
 
-/**
- * Unset the back content used for the flip
- *
- * Unparent and return the back content object which was set for this widget.
- *
- * @param obj The flip object
- * @return The back content object that was being used
- *
- * @ingroup Flip
- */
-EAPI Evas_Object *
-elm_flip_content_back_unset(Evas_Object *obj)
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+
+   if (!part || !strcmp(part, "front"))
+     _flip_content_front_set(obj, content);
+   else if (!strcmp(part, "back"))
+     _flip_content_back_set(obj, content);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return NULL;
-   if (!wd->back.content) return NULL;
-   Evas_Object *content = wd->back.content;
-   evas_object_clip_unset(content);
-   elm_widget_sub_object_del(obj, content);
-   evas_object_smart_member_del(content);
-   wd->back.content = NULL;
-   return content;
+
+   if (!part || !strcmp(part, "front"))
+     return wd->front.content;
+   else if (!strcmp(part, "back"))
+     return wd->back.content;
+
+   return NULL;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+
+   if (!part || !strcmp(part, "front"))
+     return _content_front_unset(obj);
+   else if (!strcmp(part, "back"))
+     return _content_back_unset(obj);
+
+   return NULL;
+}
+
+EAPI Evas_Object *
+elm_flip_add(Evas_Object *parent)
+{
+   Evas_Object *obj;
+   Evas *e;
+   Widget_Data *wd;
+
+   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
+   ELM_SET_WIDTYPE(widtype, "flip");
+   elm_widget_type_set(obj, "flip");
+   elm_widget_sub_object_add(parent, obj);
+   elm_widget_data_set(obj, wd);
+   elm_widget_del_hook_set(obj, _del_hook);
+   elm_widget_theme_hook_set(obj, _theme_hook);
+   elm_widget_focus_next_hook_set(obj, _elm_flip_focus_next_hook);
+   elm_widget_can_focus_set(obj, EINA_FALSE);
+   elm_widget_content_set_hook_set(obj, _content_set_hook);
+   elm_widget_content_get_hook_set(obj, _content_get_hook);
+   elm_widget_content_unset_hook_set(obj, _content_unset_hook);
+
+   wd->obj = obj;
+
+   wd->clip = evas_object_rectangle_add(e);
+   evas_object_static_clip_set(wd->clip, EINA_TRUE);
+   evas_object_move(wd->clip, -49999, -49999);
+   evas_object_resize(wd->clip, 99999, 99999);
+   elm_widget_sub_object_add(obj, wd->clip);
+   evas_object_smart_member_add(wd->clip, obj);
+
+   wd->front.clip = evas_object_rectangle_add(e);
+   evas_object_static_clip_set(wd->front.clip, EINA_TRUE);
+   evas_object_data_set(wd->front.clip, "_elm_leaveme", obj);
+   evas_object_move(wd->front.clip, -49999, -49999);
+   evas_object_resize(wd->front.clip, 99999, 99999);
+   elm_widget_sub_object_add(obj, wd->front.clip);
+   evas_object_smart_member_add(wd->front.clip, obj);
+   evas_object_clip_set(wd->front.clip, wd->clip);
+
+   wd->back.clip = evas_object_rectangle_add(e);
+   evas_object_static_clip_set(wd->back.clip, EINA_TRUE);
+   evas_object_data_set(wd->back.clip, "_elm_leaveme", obj);
+   evas_object_move(wd->back.clip, -49999, -49999);
+   evas_object_resize(wd->back.clip, 99999, 99999);
+   elm_widget_sub_object_add(obj, wd->back.clip);
+   evas_object_smart_member_add(wd->back.clip, obj);
+   evas_object_clip_set(wd->back.clip, wd->clip);
+
+   evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+                                       _changed_size_hints, obj);;
+
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+
+   wd->state = EINA_TRUE;
+   wd->intmode = ELM_FLIP_INTERACTION_NONE;
+
+   _sizing_eval(obj);
+
+   return obj;
 }
 
-/**
- * Get flip front visibility state
- *
- * @param obj The flip object
- * @return If front front is showing or not currently
- *
- * @ingroup Flip
- */
 EAPI Eina_Bool
-elm_flip_front_get(const Evas_Object *obj)
+elm_flip_front_visible_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1856,18 +1753,6 @@ elm_flip_front_get(const Evas_Object *obj)
    return wd->state;
 }
 
-/**
- * Set flip perspective
- *
- * @param obj The flip object
- * @param foc The coordinate to set the focus on
- * @param x The X coordinate
- * @param y The Y coordinate
- *
- * NOTE: This function currently does nothing.
- *
- * @ingroup Flip
- */
 EAPI void
 elm_flip_perspective_set(Evas_Object *obj, Evas_Coord foc __UNUSED__, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
 {
@@ -1878,14 +1763,6 @@ elm_flip_perspective_set(Evas_Object *obj, Evas_Coord foc __UNUSED__, Evas_Coord
 
 // FIXME: add ambient and lighting control
 
-/**
- * Runs the flip animation
- *
- * @param obj The flip object
- * @param mode The mode type
- *
- * @ingroup Flip
- */
 EAPI void
 elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode)
 {
@@ -1916,21 +1793,6 @@ elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode)
    evas_object_smart_callback_call(obj, SIG_ANIMATE_BEGIN, NULL);
 }
 
-/**
- * Set the interactive flip mode
- *
- * @param obj The flip object
- * @param mode The interactive flip mode to use
- *
- * This sets if the flip should be interactive (allow user to click and
- * drag a side of the flip to reveal the back page and cause it to flip).
- * By default a flip is not interactive. You may also need to set which
- * sides of the flip are "active" for flipping and how much space they use
- * (a minimum of a finger size) with elm_flip_interacton_direction_enabled_set()
- * and elm_flip_interacton_direction_hitsize_set()
- *
- * @ingroup Flip
- */
 EAPI void
 elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode)
 {
@@ -1954,15 +1816,23 @@ elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode)
           {
              if ((wd->dir_enabled[i]) && (!wd->event[i]))
                {
-                  wd->event[i] = evas_object_rectangle_add(evas_object_evas_get(obj));
+                  Evas *e = evas_object_evas_get(obj);
+                  wd->event[i] = evas_object_rectangle_add(e);
                   elm_widget_sub_object_add(obj, wd->event[i]);
+                  evas_object_data_set(wd->event[i], "_elm_leaveme", obj);
                   evas_object_clip_set(wd->event[i], evas_object_clip_get(obj));
                   evas_object_color_set(wd->event[i], 0, 0, 0, 0);
                   evas_object_show(wd->event[i]);
                   evas_object_smart_member_add(wd->event[i], obj);
-                  evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_DOWN, _down_cb, obj);
-                  evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_UP, _up_cb, obj);
-                  evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_MOVE, _move_cb, obj);
+                  evas_object_event_callback_add(wd->event[i],
+                                                 EVAS_CALLBACK_MOUSE_DOWN,
+                                                 _down_cb, obj);
+                  evas_object_event_callback_add(wd->event[i],
+                                                 EVAS_CALLBACK_MOUSE_UP,
+                                                 _up_cb, obj);
+                  evas_object_event_callback_add(wd->event[i],
+                                                 EVAS_CALLBACK_MOUSE_MOVE,
+                                                 _move_cb, obj);
                }
           }
      }
@@ -1970,16 +1840,6 @@ elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode)
    _configure(obj);
 }
 
-/**
- * Get the interactive flip mode
- *
- * @param obj The flip object
- * @return The interactive flip mode
- *
- * Returns the interactive flip mode set by elm_flip_interaction_set()
- *
- * @ingroup Flip
- */
 EAPI Elm_Flip_Interaction
 elm_flip_interaction_get(const Evas_Object *obj)
 {
@@ -1989,27 +1849,15 @@ elm_flip_interaction_get(const Evas_Object *obj)
    return wd->intmode;
 }
 
-/**
- * Set which directions of the flip respond to interactive flip
- *
- * @param obj The flip object
- * @param dir The direction to change
- * @param enabled If that direction is enabled or not
- *
- * By default all directions are disabled, so you may want to enable the
- * desired directions for flipping if you need interactive flipping.
- *
- * @ingroup Flip
- */
 EAPI void
-elm_flip_interacton_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled)
+elm_flip_interaction_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    int i = -1;
    if (!wd) return;
    enabled = !!enabled;
-   if      (dir == ELM_FLIP_DIRECTION_UP)    i = 0;
+   if (dir == ELM_FLIP_DIRECTION_UP)    i = 0;
    else if (dir == ELM_FLIP_DIRECTION_DOWN)  i = 1;
    else if (dir == ELM_FLIP_DIRECTION_LEFT)  i = 2;
    else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
@@ -2021,13 +1869,17 @@ elm_flip_interacton_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction d
      {
         wd->event[i] = evas_object_rectangle_add(evas_object_evas_get(obj));
         elm_widget_sub_object_add(obj, wd->event[i]);
+        evas_object_data_set(wd->event[i], "_elm_leaveme", obj);
         evas_object_clip_set(wd->event[i], evas_object_clip_get(obj));
         evas_object_color_set(wd->event[i], 0, 0, 0, 0);
         evas_object_show(wd->event[i]);
         evas_object_smart_member_add(wd->event[i], obj);
-        evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_DOWN, _down_cb, obj);
-        evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_UP, _up_cb, obj);
-        evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_MOVE, _move_cb, obj);
+        evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_DOWN,
+                                       _down_cb, obj);
+        evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_UP,
+                                       _up_cb, obj);
+        evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_MOVE,
+                                       _move_cb, obj);
      }
    else if (!(wd->dir_enabled[i]) && (wd->event[i]))
      {
@@ -2038,51 +1890,31 @@ elm_flip_interacton_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction d
    _configure(obj);
 }
 
-/**
- * Get the enabled state of that flip direction
- *
- * @param obj The flip object
- * @param dir The direction to check
- * @return If that direction is enabled or not
- *
- * Gets the enabled state set by elm_flip_interacton_direction_enabled_set()
- *
- * @ingroup Flip
- */
 EAPI Eina_Bool
-elm_flip_interacton_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir)
+elm_flip_interaction_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
    int i = -1;
    if (!wd) return EINA_FALSE;
-   if      (dir == ELM_FLIP_DIRECTION_UP)    i = 0;
-   else if (dir == ELM_FLIP_DIRECTION_DOWN)  i = 1;
-   else if (dir == ELM_FLIP_DIRECTION_LEFT)  i = 2;
+   if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
+   else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
+   else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
    else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
    if (i < 0) return EINA_FALSE;
    return wd->dir_enabled[i];
 }
 
-/**
- * Set the amount of the flip that is sensitive to interactive flip
- *
- * @param obj The flip object
- * @param dir The direction to modify
- * @param hitsize The amount of that dimension (0.0 to 1.0) to use
- *
- * @ingroup Flip
- */
 EAPI void
-elm_flip_interacton_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize)
+elm_flip_interaction_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    int i = -1;
    if (!wd) return;
-   if      (dir == ELM_FLIP_DIRECTION_UP)    i = 0;
-   else if (dir == ELM_FLIP_DIRECTION_DOWN)  i = 1;
-   else if (dir == ELM_FLIP_DIRECTION_LEFT)  i = 2;
+   if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
+   else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
+   else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
    else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
    if (i < 0) return;
    if (hitsize < 0.0) hitsize = 0.0;
@@ -2093,27 +1925,16 @@ elm_flip_interacton_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction d
    _configure(obj);
 }
 
-/**
- * Get the amount of the flip that is sensitive to interactive flip
- *
- * @param obj The flip object
- * @param dir The direction to check
- * @return The size set for that direction
- *
- * Returns the amount os sensitive area set by elm_flip_interacton_direction_hitsize_set().
- *
- * @ingroup Flip
- */
 EAPI double
-elm_flip_interacton_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir)
+elm_flip_interaction_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
    Widget_Data *wd = elm_widget_data_get(obj);
    int i = -1;
    if (!wd) return 0.0;
-   if      (dir == ELM_FLIP_DIRECTION_UP)    i = 0;
-   else if (dir == ELM_FLIP_DIRECTION_DOWN)  i = 1;
-   else if (dir == ELM_FLIP_DIRECTION_LEFT)  i = 2;
+   if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
+   else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
+   else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
    else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
    if (i < 0) return 0.0;
    return wd->dir_hitsize[i];