[*]Un-Rollback to 'Merge [elm_multibuttonentry]Changed edc TEXT part to TEXTBLOCK...
[framework/uifw/elementary.git] / src / lib / elm_imageslider.c
index 924b9e8..d3c112c 100644 (file)
@@ -1,6 +1,6 @@
-/* 
-* 
-* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 
+/*
+*
+* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
 #include <stdio.h>
 #include <math.h>
@@ -11,7 +11,7 @@
 * @defgroup Imageslider Imageslider
 * @ingroup Elementary
 *
-* By flicking images on the screen, 
+* By flicking images on the screen,
 * you can see the images in specific path.
 */
 
@@ -49,9 +49,9 @@ struct _Imageslider_Item
    const char *photo_file;
    void (*func) (void *data, Evas_Object *obj, void *event_info);
    void *data;
-   Evas_Coord x, y, w, h;
-   Evas_Coord ox, oy, ow, oh;
-   int moving:1;
+   //Evas_Coord x, y, w, h;
+   //Evas_Coord ox, oy, ow, oh;
+   //int moving:1;
 };
 
 // Image Slider Widget Data.
@@ -78,7 +78,6 @@ struct _Widget_Data
    int moving:1;
 
    Eina_Bool on_zoom:1;
-   Eina_Bool on_hold:1;
    int dx, dy, mx, my;
    int mdx, mdy, mmx, mmy;
    int dratio;
@@ -97,8 +96,6 @@ static void _theme_hook(Evas_Object *obj);
 
 static void _sizing_eval(Evas_Object *obj);
 
-static void _imageslider_del_all(Widget_Data * wd);
-
 static void _imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info);
 static void _imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info);
 static void _imageslider_show(void *data, Evas * e, Evas_Object *obj, void *event_info);
@@ -107,7 +104,6 @@ static void _imageslider_update(Widget_Data * wd);
 
 static void _imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y, Evas_Coord w);
 static void _imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my, Evas_Coord y, Evas_Coord w);
-static Evas_Object *_imageslider_add_obj(Widget_Data * wd);
 
 static void _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left);
 
@@ -124,9 +120,9 @@ static void _anim(Widget_Data * wd);
 static Eina_Bool _timer_cb(void *data);
 
 //static void _signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
+static void _ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
+static void _ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
+static void _ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
 
 // Whenever the Image Slider item is deleted, Call this funtion.
 static void
@@ -143,7 +139,8 @@ _del_hook(Evas_Object *obj)
 
    for (i = 0; i < BLOCK_MAX; i++)
      {
-        evas_object_del(wd->ly[i]);
+       elm_widget_sub_object_del(wd->obj, wd->ly[i]);
+       evas_object_del(wd->ly[i]);
      }
 
    if (wd->its)
@@ -173,23 +170,19 @@ _del_hook(Evas_Object *obj)
 static void
 _theme_hook(Evas_Object *obj)
 {
-   int i;
-
-   Widget_Data *wd;
-
-   wd = elm_widget_data_get(obj);
+   int i = 0;
+   Widget_Data *wd = elm_widget_data_get(obj);
 
-   if (!wd || !wd->ly)
-     return;
+   if (!wd) return;
 
    for (i = 0; i < BLOCK_MAX; i++)
      {
-        wd->ly[i] = elm_layout_add(obj);
-        _elm_theme_object_set(obj, wd->ly[i], "imageslider", "base", "default");
-        elm_widget_resize_object_set(obj, wd->ly[i]);
+        if (wd->ly[i])
+           elm_layout_theme_set(wd->ly[i], "imageslider", "base",
+                                elm_object_style_get(obj));
         evas_object_show(wd->ly[i]);
      }
-
+   _imageslider_update(wd);
    _sizing_eval(obj);
 }
 
@@ -213,7 +206,7 @@ _sizing_eval(Evas_Object *obj)
 
 // Whenever MOVE event occurs, Call this function.
 static void
-_imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_imageslider_move(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
 {
    Widget_Data *wd;
 
@@ -229,7 +222,6 @@ _imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info)
    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
    wd->x = x;
    wd->y = y;
-   evas_object_move(wd->clip, x, y);
 
    _imageslider_update_pos(wd, wd->x, wd->y, wd->w);
 
@@ -237,7 +229,7 @@ _imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info)
 
 // Whenever RESIZE event occurs, Call this fucntion.
 static void
-_imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_imageslider_resize(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
 {
    int i;
 
@@ -249,7 +241,7 @@ _imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info)
      return;
 
    wd = elm_widget_data_get((Evas_Object *) data);
-   if (!wd || !wd->ly)
+   if (!wd)
      return;
 
    evas_object_geometry_get(obj, NULL, NULL, &w, &h);
@@ -262,15 +254,13 @@ _imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info)
         evas_object_resize(wd->ly[i], w, h);
      }
 
-   evas_object_resize(wd->clip, w, h);
-
    _imageslider_update_pos(wd, wd->x, wd->y, wd->w);
 
 }
 
 // Whenever SHOW event occurs, Call this function.
 static void
-_imageslider_show(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_imageslider_show(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Widget_Data *wd;
 
@@ -287,7 +277,7 @@ _imageslider_show(void *data, Evas * e, Evas_Object *obj, void *event_info)
 
 // Whenever HIDE event occurs, Call this function.
 static void
-_imageslider_hide(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_imageslider_hide(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Widget_Data *wd;
 
@@ -298,42 +288,28 @@ _imageslider_hide(void *data, Evas * e, Evas_Object *obj, void *event_info)
    evas_object_hide(wd->clip);
 }
 
-// Delete all Image Slider items.
-static void
-_imageslider_del_all(Widget_Data * wd)
-{
-
-   int i;
-
-   if (!wd) return;
-
-   for (i = 0; i < BLOCK_MAX; i++)
-     {
-        evas_object_del(wd->ly[i]);
-     }
-}
-
 // Update Image Slider item position.
 static void
 _imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y, Evas_Coord w)
 {
+   int i = 0;
    evas_object_move(wd->ly[BLOCK_LEFT], x - (w + INTERVAL_WIDTH), y);
    evas_object_move(wd->ly[BLOCK_CENTER], x, y);
    evas_object_move(wd->ly[BLOCK_RIGHT], x + (w + INTERVAL_WIDTH), y);
+   //making sure that the clipping happens for all three layouts based on clipper's geometry
+   for (i = 0; i < BLOCK_MAX; i++)
+     evas_object_clip_set(wd->ly[i], wd->clip);
    evas_render_idle_flush(evas_object_evas_get(wd->obj));
 }
 
 // Update the center position of Image Slider item.
 static void
-_imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my, Evas_Coord y, Evas_Coord w)
+_imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my __UNUSED__, Evas_Coord y, Evas_Coord w)
 {
-   Evas_Object *eo;
-
-   Evas_Coord ix, iy, iw, ih;
-
-   eo = edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "swl.photo");
-   evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
-
+   Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
+   const Evas_Object *eo = elm_layout_content_get((const Evas_Object*)(wd->ly[BLOCK_CENTER]), "swl.photo");
+   if (eo)
+     evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
    if ((ix > 0) || (ix + iw < wd->w))
      {
         edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.on", "block");
@@ -342,56 +318,27 @@ _imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my, Ev
      }
 }
 
-// Add previous/next Image Slider item.
-static Evas_Object *
-_imageslider_add_obj(Widget_Data * wd)
-{
-   Evas_Object *eo;
-
-   eo = elm_layout_add(wd->obj);
-   elm_layout_theme_set(eo, "imageslider", "base", "default");
-   elm_widget_resize_object_set(wd->obj, eo);
-   //evas_object_smart_member_add(eo, wd->obj);
-
-   //edje_object_signal_callback_add(elm_layout_edje_get(eo), "elm,photo,clicked", "", _signal_clicked, wd->obj);
-   evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN, ev_imageslider_down_cb, wd);
-   evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP, ev_imageslider_up_cb, wd);
-   evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE, ev_imageslider_move_cb, wd);
-   evas_object_resize(eo, wd->w, wd->h);
-   evas_object_move(eo, wd->w + INTERVAL_WIDTH, wd->y);
-   evas_object_clip_set(eo, wd->clip);
-   evas_object_show(eo);
-
-   return eo;
-}
-
 // Shift next/previous Image Slider item in layouts.
 static void
 _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left)
 {
    if (!left)
      {
-        if (wd->ly[BLOCK_LEFT])
-          {
-             evas_object_del(wd->ly[BLOCK_LEFT]);
-             wd->ly[BLOCK_LEFT] = NULL;
-          }
-
+        Evas_Object *ly_temp;
+        ly_temp = wd->ly[BLOCK_LEFT];
         wd->ly[BLOCK_LEFT] = wd->ly[BLOCK_CENTER];
         wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_RIGHT];
-        wd->ly[BLOCK_RIGHT] = _imageslider_add_obj(wd);
+        wd->ly[BLOCK_RIGHT] = ly_temp;
+        elm_layout_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL);
      }
    else
      {
-        if (wd->ly[BLOCK_RIGHT])
-          {
-             evas_object_del(wd->ly[BLOCK_RIGHT]);
-             wd->ly[BLOCK_RIGHT] = NULL;
-          }
-
+        Evas_Object *ly_temp;
+        ly_temp = wd->ly[BLOCK_RIGHT];
         wd->ly[BLOCK_RIGHT] = wd->ly[BLOCK_CENTER];
         wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_LEFT];
-        wd->ly[BLOCK_LEFT] = _imageslider_add_obj(wd);
+        wd->ly[BLOCK_LEFT] = ly_temp;
+        elm_layout_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL);
      }
 }
 
@@ -411,9 +358,9 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step)
           {
              wd->step = -ANI_STEP;
              wd->move_x += wd->w;
-             _imageslider_obj_shift(wd, 0);
+             _imageslider_obj_shift(wd, EINA_FALSE);
           }
-        wd->moving = 1;
+        wd->moving = EINA_TRUE;
      }
    else if (step < 0)
      {
@@ -427,9 +374,9 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step)
           {
              wd->step = ANI_STEP;
              wd->move_x -= wd->w;
-             _imageslider_obj_shift(wd, 1);
+             _imageslider_obj_shift(wd, EINA_TRUE);
           }
-        wd->moving = 1;
+        wd->moving = EINA_TRUE;
      }
    else
      {
@@ -437,7 +384,7 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step)
           wd->step = ANI_STEP;
         else
           wd->step = -ANI_STEP;
-        wd->moving = 0;
+        wd->moving = EINA_FALSE;
      }
 
    _imageslider_update(wd);
@@ -445,14 +392,11 @@ _imageslider_obj_move(Widget_Data * wd, Evas_Coord step)
 
 // Whenever MOUSE DOWN event occurs, Call this function.
 static void
-ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_ev_imageslider_down_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info)
 {
    Widget_Data *wd = data;
-
+   Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
    Evas_Event_Mouse_Down *ev = event_info;
-
-   Evas_Coord ix, iy, iw, ih;
-
    Evas_Object *eo = NULL;
 
    if (wd->ani_lock)
@@ -462,7 +406,7 @@ ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
    wd->timestamp = ev->timestamp;
    wd->move_cnt = MOVE_STEP;
 
-   wd->dx = ev->canvas.x;
+   /*wd->dx = ev->canvas.x;
    wd->dy = ev->canvas.y;
    wd->mx = ev->canvas.x;
    wd->my = ev->canvas.y;
@@ -470,22 +414,22 @@ ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
    wd->dratio = 1;
    wd->ratio = 1;
 
-   eo = edje_object_part_swallow_get(elm_layout_edje_get(obj), "swl.photo");
+   eo = (Evas_Object*)elm_layout_content_get((const Evas_Object*)obj, "swl.photo");
    if (eo)
       evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
 
    if (iw != wd->w)
      {
+        printf("Zooming\n");
         wd->on_zoom = EINA_TRUE;
         edje_object_signal_emit(elm_layout_edje_get(obj), "block.off", "block");
-     }
-
+     }*/
 }
 
 // Whenever MOUSE UP event occurs, Call this function.
 // And make Click Event also.
 static void
-ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_ev_imageslider_up_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
 {
    Widget_Data *wd = data;
 
@@ -525,13 +469,13 @@ ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
           {
              if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN)
                {
-                  fprintf(stderr, "[[[ DEBUG ]]]:ev_imageslider_up_cb-black zone (1)\n");
+                  fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-black zone (1)\n");
 
                    _imageslider_obj_move(wd, 0);
                }
              else
                {
-                  fprintf(stderr, "[[[ DEBUG ]]]:ev_imageslider_up_cb-black zone (2)\n");
+                  fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-black zone (2)\n");
 
                   _imageslider_obj_move(wd, step);
                }
@@ -542,13 +486,13 @@ ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
              step = (wd->x - wd->move_x) << 1;
              if (step <= wd->w && step >= -(wd->w))
                {
-                  fprintf(stderr, "[[[ DEBUG ]]]:ev_imageslider_up_cb-white zone (1)\n");
+                  fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-white zone (1)\n");
 
                   _imageslider_obj_move(wd, 0);
                }
              else
                {
-                  fprintf(stderr, "[[[ DEBUG ]]]:ev_imageslider_up_cb-white zone (2)\n");
+                  fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-white zone (2)\n");
 
                   _imageslider_obj_move(wd, step);
                }
@@ -557,9 +501,9 @@ ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
 
 }
 
-// Whenever MOUSE MOVE event occurs, Call this API.
+// Whenever MOUSE MOVE event occurs, Call this
 static void
-ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
+_ev_imageslider_move_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info)
 {
    int idx;
 
@@ -578,51 +522,27 @@ ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
 
    if (wd->move_cnt == MOVE_STEP)
      {
-        if (wd->on_hold == EINA_FALSE)
-          {
-             wd->move_cnt = 0;
-
-             if (ev->buttons)
-               {
-                  step = ev->cur.canvas.x - wd->down_pos.x;
-                  if (step > 0)
-                    idx = BLOCK_LEFT;
-                  else
-                    idx = BLOCK_RIGHT;
-
-                  wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x)); 
-                  wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y));
+        wd->move_cnt = 0;
 
-                  if (wd->on_zoom)
-                    {
-                       _imageslider_update_center_pos(wd, wd->move_x, wd->move_y, wd->y, wd->w);
-                    }
-                  else
-                    {
-                       _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
-                    }
-               }
-          }
-        else
+        if (ev->buttons)
           {
-             wd->mx = ev->cur.canvas.x;
-             wd->my = ev->cur.canvas.y;
+             step = ev->cur.canvas.x - wd->down_pos.x;
+             if (step > 0)
+               idx = BLOCK_LEFT;
+             else
+               idx = BLOCK_RIGHT;
 
-             wd->ratio =
-             sqrt((wd->mx - wd->mmx) * (wd->mx - wd->mmx) + (wd->my - wd->mmy) * (wd->my - wd->mmy));
+             wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x));
+             wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y));
 
-             eo = edje_object_part_swallow_get(elm_layout_edje_get(obj), "swl.photo");
-             if (eo)
+             /*if (wd->on_zoom)
                {
-                  it = eina_list_data_get(wd->cur);
-                  if (((it->w * wd->ratio / wd->dratio) / it->ow) < MAX_ZOOM_SIZE)
-                    {
-                       edje_object_part_unswallow(elm_layout_edje_get(obj), eo);
-                       evas_object_resize(eo, it->w * wd->ratio / wd->dratio, it->h * wd->ratio / wd->dratio);
-                       evas_object_size_hint_min_set(eo, it->w * wd->ratio / wd->dratio, it->h * wd->ratio / wd->dratio);
-                       edje_object_part_swallow(elm_layout_edje_get(obj), "swl.photo", eo);
-                    }
+                  _imageslider_update_center_pos(wd, wd->move_x, wd->move_y, wd->y, wd->w);
                }
+             else
+               {*/
+                  _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
+               //}
           }
      }
    wd->move_cnt++;
@@ -676,9 +596,9 @@ _check_drag(int state, void *data)
 
    Elm_Imageslider_Item *it;
 
-   Evas_Coord ix, iy, iw, ih;
+   Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
 
-   double dx, dy = 0;
+   double dx = 0, dy = 0;
 
    Eina_List *l[BLOCK_MAX];
 
@@ -690,19 +610,14 @@ _check_drag(int state, void *data)
 
    it = eina_list_data_get(l[state]);
 
-   eo = edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[state]), "swl.photo");
+   eo = (Evas_Object*)elm_layout_content_get(wd->ly[state], "swl.photo");
    if (eo)
      evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
    edje_object_part_drag_value_get(elm_layout_edje_get(wd->ly[state]), "swl.photo", &dx, &dy);
 
    if ((iw != wd->w) || ((dx != 0) || (dy != 0)))
      {
-        if (wd->ly[state])
-          {
-             evas_object_del(wd->ly[state]);
-             wd->ly[state] = NULL;
-          }
-        wd->ly[state] = _imageslider_add_obj(wd);
+        elm_layout_content_set(wd->ly[state], "swl.photo", NULL);
      }
    else
      return 1;
@@ -717,25 +632,23 @@ _check_zoom(void *data)
 
    Elm_Imageslider_Item *it;
 
-   Evas_Coord ix, iy, iw, ih;
+   Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
 
-   double dx, dy = 0;
+   double dx = 0, dy = 0;
 
    Evas_Object *eo = NULL;
 
    it = eina_list_data_get(wd->cur);
 
-   eo =
-      edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "swl.photo");
+   eo = (Evas_Object*)elm_layout_content_get(wd->ly[BLOCK_CENTER], "swl.photo");
    if (eo)
       evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
-   evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
    edje_object_part_drag_value_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "swl.photo", &dx, &dy);
 
    if ((iw != wd->w) || ((dx != 0) || (dy != 0)))
      {
         wd->on_zoom = EINA_TRUE;
-        edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.off", "block");
+        //edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.off", "block");
      }
    else
      {
@@ -758,8 +671,8 @@ _timer_cb(void *data)
    int ret;
 
    wd = data;
-   if (wd->ani_lock == 0)
-      return 0;
+   if (wd->ani_lock == EINA_FALSE)
+      return EINA_FALSE;
 
    gettimeofday(&tv, NULL);
 
@@ -783,7 +696,7 @@ _timer_cb(void *data)
 
    if (wd->move_x == wd->x)
      {
-        wd->ani_lock = 0;
+        wd->ani_lock = EINA_FALSE;
         if (wd->cur)
           {
              it = eina_list_data_get(wd->cur);
@@ -798,7 +711,7 @@ _timer_cb(void *data)
 
         ret = _check_drag(BLOCK_LEFT, wd);
         ret = _check_drag(BLOCK_RIGHT, wd);
-        _check_zoom(wd);
+        //_check_zoom(wd);
 
         if (!wd->queue_idler)
           wd->queue_idler = ecore_idler_add(_icon_to_image, wd);
@@ -826,7 +739,7 @@ _anim(Widget_Data * wd)
         return;
      }
 
-   wd->ani_lock = 1;
+   wd->ani_lock = EINA_TRUE;
 
    w = wd->move_x;
    gettimeofday(&wd->tv, NULL);
@@ -850,11 +763,7 @@ _imageslider_update(Widget_Data * wd)
    if (!wd)
      return;
 
-   if (!wd->cur)
-     {
-        _imageslider_del_all(wd);
-        return;
-     }
+   if (!wd->cur) return;
 
    l[BLOCK_LEFT] = eina_list_prev(wd->cur);
    l[BLOCK_CENTER] = wd->cur;
@@ -862,12 +771,10 @@ _imageslider_update(Widget_Data * wd)
 
    for (i = 0; i < BLOCK_MAX; i++)
      {
-        eo =
-        edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[i]), "swl.photo");
+        eo = (Evas_Object*)elm_layout_content_get((const Evas_Object*)wd->ly[i], "swl.photo");
         if (!l[i])
           {
              elm_layout_content_set(wd->ly[i], "swl.photo", NULL);
-             evas_object_del(eo);
           }
         else
           {
@@ -878,16 +785,15 @@ _imageslider_update(Widget_Data * wd)
              if (!eo)
                {
                   eo = elm_image_add(wd->obj);
-                  elm_layout_content_set(wd->ly[i], "swl.photo", eo);
                   //elm_image_prescale_set(eo, wd->w);
                   elm_image_file_set(eo, it->photo_file, NULL);
-                  elm_image_object_size_get(eo, &it->w, &it->h);
-                  evas_object_geometry_get(eo, &it->ox, &it->oy, &it->ow, &it->oh);
-                  it->ow = it->w;
-                  it->oh = it->h;
+                  elm_layout_content_set(wd->ly[i], "swl.photo", eo);
+                  //elm_image_object_size_get(eo, &it->w, &it->h);
+                  //evas_object_geometry_get(eo, &it->ox, &it->oy, &it->ow, &it->oh);
+                  //it->ow = it->w;
+                  //it->oh = it->h;
                }
-
-             if (wd->moving != it->moving)
+             /*if (wd->moving != it->moving)
                {
                   it->moving = wd->moving;
                   if (wd->moving)
@@ -898,41 +804,32 @@ _imageslider_update(Widget_Data * wd)
                     {
                        //elm_image_prescale_set(eo, it->w > it->h ? it->w : it->h);
                     }
-               }
+               }*/
           }
      }
 
    _anim(wd);
 }
 
-/** 
-* Add an Image Slider widget 
-* 
-* @param       parent  The parent object 
-* @return      The new Image slider object or NULL if it cannot be created 
-* 
-* @ingroup Imageslider 
+/**
+* Add an Image Slider widget
+*
+* @param        parent  The parent object
+* @return       The new Image slider object or NULL if it cannot be created
+*
+* @ingroup Imageslider
 */
 EAPI Evas_Object *
 elm_imageslider_add(Evas_Object *parent)
 {
    int i;
 
-   Evas_Object *obj = NULL;
-
-   Widget_Data *wd = NULL;
-
+   Evas_Object *obj;
    Evas *e;
+   Widget_Data *wd;
 
-   if (!parent)
-     return NULL;
-
-   wd = ELM_NEW(Widget_Data);
-   e = evas_object_evas_get(parent);
-   if (e == NULL)
-     return NULL;
+   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
 
-   obj = elm_widget_add(e);
    ELM_SET_WIDTYPE(widtype, "imageslider");
    elm_widget_type_set(obj, "imageslider");
    elm_widget_sub_object_add(parent, obj);
@@ -941,18 +838,20 @@ elm_imageslider_add(Evas_Object *parent)
    elm_widget_theme_hook_set(obj, _theme_hook);
 
    wd->clip = evas_object_rectangle_add(e);
+   elm_widget_sub_object_add(obj, wd->clip);
+   elm_widget_resize_object_set(obj, wd->clip);
 
    for (i = 0; i < BLOCK_MAX; i++)
      {
         wd->ly[i] = elm_layout_add(obj);
         elm_layout_theme_set(wd->ly[i], "imageslider", "base", "default");
-        elm_widget_resize_object_set(obj, wd->ly[i]);
+        elm_widget_sub_object_add(obj, wd->ly[i]);
         evas_object_smart_member_add(wd->ly[i], obj);
 
         //edje_object_signal_callback_add(elm_layout_edje_get(wd->ly[i]), "elm,photo,clicked", "", _signal_clicked, obj);
-        evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_DOWN, ev_imageslider_down_cb, wd);
-        evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_UP, ev_imageslider_up_cb, wd);
-        evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_MOVE, ev_imageslider_move_cb, wd);
+        evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_DOWN, _ev_imageslider_down_cb, wd);
+        evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_UP, _ev_imageslider_up_cb, wd);
+        evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_MOVE, _ev_imageslider_move_cb, wd);
         evas_object_clip_set(wd->ly[i], wd->clip);
         evas_object_show(wd->ly[i]);
      }
@@ -969,16 +868,16 @@ elm_imageslider_add(Evas_Object *parent)
    return obj;
 }
 
-/** 
-* Append an Image Slider item 
-* 
-* @param       obj          The Image Slider object 
-* @param       photo_file   photo file path 
-* @param       func         callback function 
-* @param       data         callback data 
-* @return      The Image Slider item handle or NULL 
-* 
-* @ingroup Imageslider 
+/**
+* Append an Image Slider item
+*
+* @param        obj          The Image Slider object
+* @param        photo_file   photo file path
+* @param        func         callback function
+* @param        data         callback data
+* @return       The Image Slider item handle or NULL
+*
+* @ingroup Imageslider
 */
 EAPI Elm_Imageslider_Item *
 elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data)
@@ -1011,14 +910,14 @@ elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Images
 /**
 * Insert an Image Slider item into the Image Slider Widget by using the given index.
 *
-* @param       obj                     The Image Slider object
-* @param       photo_file      photo file path
-* @param       func            callback function
-* @param       index           required position
-* @param       data            callback data
-* @return      The Image Slider item handle or NULL
+* @param        obj                     The Image Slider object
+* @param        photo_file      photo file path
+* @param        func            callback function
+* @param        index           required position
+* @param        data            callback data
+* @return       The Image Slider item handle or NULL
 *
-* @ingroup     Imageslider
+* @ingroup      Imageslider
 */
 EAPI Elm_Imageslider_Item *
 elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, unsigned int index, void *data)
@@ -1053,16 +952,16 @@ elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, E
    return it;
 }
 
-/** 
-* Prepend Image Slider item 
-* 
-* @param       obj          The Image Slider object 
-* @param       photo_file   photo file path 
-* @param       func         callback function 
-* @param       data         callback data 
-* @return      The imageslider item handle or NULL 
-* 
-* @ingroup Imageslider 
+/**
+* Prepend Image Slider item
+*
+* @param        obj          The Image Slider object
+* @param        photo_file   photo file path
+* @param        func         callback function
+* @param        data         callback data
+* @return       The imageslider item handle or NULL
+*
+* @ingroup Imageslider
 */
 EAPI Elm_Imageslider_Item *
 elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data)
@@ -1093,7 +992,7 @@ elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Image
 /**
 * Delete the selected Image Slider item
 *
-* @param it            The selected Image Slider item handle
+* @param it             The selected Image Slider item handle
 *
 * @ingroup Imageslider
 */
@@ -1110,17 +1009,17 @@ elm_imageslider_item_del(Elm_Imageslider_Item * it)
      return;
 
    EINA_LIST_FOREACH(wd->its, l, _it)
-   {
-      if (_it == it)
-        {
-           if (l == wd->cur)
-              wd->cur = eina_list_prev(wd->cur);
-           wd->its = eina_list_remove(wd->its, it);
-           if (!wd->cur)
-              wd->cur = wd->its;
-           break;
-        }
-   }
+     {
+        if (_it == it)
+          {
+             if (l == wd->cur)
+                wd->cur = eina_list_prev(wd->cur);
+             wd->its = eina_list_remove(wd->its, it);
+             if (!wd->cur)
+                wd->cur = wd->its;
+             break;
+          }
+     }
 
    _imageslider_update(wd);
 
@@ -1129,7 +1028,7 @@ elm_imageslider_item_del(Elm_Imageslider_Item * it)
 /**
 * Get the selected Image Slider item
 *
-* @param obj           The Image Slider object
+* @param obj            The Image Slider object
 * @return The selected Image Slider item or NULL
 *
 * @ingroup Imageslider
@@ -1152,7 +1051,7 @@ elm_imageslider_selected_item_get(Evas_Object *obj)
 /**
 * Get whether an Image Slider item is selected or not
 *
-* @param it             the selected Image Slider item
+* @param it              the selected Image Slider item
 * @return EINA_TRUE or EINA_FALSE
 *
 * @ingroup Imageslider
@@ -1178,7 +1077,7 @@ elm_imageslider_item_selected_get(Elm_Imageslider_Item * it)
 /**
 * Set the selected Image Slider item
 *
-* @param it            The Imaga Slider item
+* @param it             The Imaga Slider item
 *
 * @ingroup Imageslider
 */
@@ -1199,19 +1098,17 @@ elm_imageslider_item_selected_set(Elm_Imageslider_Item * it)
      return;
 
    EINA_LIST_FOREACH(wd->its, l, _it)
-   {
-      if (_it == it)
-         wd->cur = l;
-   }
+     {
+        if (_it == it)
+          wd->cur = l;
+     }
 
    for (i = 0; i < BLOCK_MAX; i++)
      {
-        eo =
-        edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[i]), "swl.photo");
-        if (eo)
+       eo = (Evas_Object*)elm_layout_content_get(wd->ly[i], "swl.photo");
+       if (eo)
           {
              elm_layout_content_set(wd->ly[i], "swl.photo", NULL);
-             evas_object_del(eo);
           }
      }
 
@@ -1222,7 +1119,7 @@ elm_imageslider_item_selected_set(Elm_Imageslider_Item * it)
 /**
 * Get the photo file path of given Image Slider item
 *
-* @param it            The Image Slider item
+* @param it             The Image Slider item
 * @return The photo file path or NULL;
 *
 * @ingroup Imageslider
@@ -1230,16 +1127,36 @@ elm_imageslider_item_selected_set(Elm_Imageslider_Item * it)
 EAPI const char *
 elm_imageslider_item_photo_file_get(Elm_Imageslider_Item * it)
 {
-   if (!it)
-     return NULL;
+   if (!it) return NULL;
 
    return it->photo_file;
 }
 
 /**
+* Sets the photo file path of given Image Slider item
+*
+* @param it         The Image Slider item
+* @param photo_file The photo file path or NULL;
+*
+* @ingroup Imageslider
+*/
+EAPI void
+elm_imageslider_item_photo_file_set(Elm_Imageslider_Item *it, const char *photo_file)
+{
+   if (!it) return;
+   ELM_CHECK_WIDTYPE(it->obj, widtype);
+
+   if (photo_file)
+     {
+        eina_stringshare_replace(&(it->photo_file), photo_file);
+        elm_imageslider_item_update(it);
+     }
+}
+
+/**
 * Get the previous Image Slider item
 *
-* @param it            The Image Slider item
+* @param it             The Image Slider item
 * @return The previous Image Slider item or NULL
 *
 * @ingroup Imageslider
@@ -1257,15 +1174,15 @@ elm_imageslider_item_prev(Elm_Imageslider_Item * it)
      return NULL;
 
    EINA_LIST_FOREACH(wd->its, l, _it)
-   {
-      if (_it == it)
-        {
-           l = eina_list_prev(l);
-           if (!l)
-             break;
-           return eina_list_data_get(l);
-        }
-   }
+     {
+        if (_it == it)
+          {
+             l = eina_list_prev(l);
+             if (!l)
+               break;
+             return eina_list_data_get(l);
+          }
+     }
 
    return NULL;
 }
@@ -1273,7 +1190,7 @@ elm_imageslider_item_prev(Elm_Imageslider_Item * it)
 /**
 * Get the next Image Slider item
 *
-* @param it            The Image Slider item
+* @param it             The Image Slider item
 * @return The next Image Slider item or NULL
 *
 * @ingroup Imageslider
@@ -1291,15 +1208,15 @@ elm_imageslider_item_next(Elm_Imageslider_Item * it)
      return NULL;
 
    EINA_LIST_FOREACH(wd->its, l, _it)
-   {
-      if (_it == it)
-        {
-           l = eina_list_next(l);
-           if (!l)
-             break;
-           return eina_list_data_get(l);
-        }
-   }
+     {
+        if (_it == it)
+          {
+             l = eina_list_next(l);
+             if (!l)
+               break;
+             return eina_list_data_get(l);
+          }
+     }
 
    return NULL;
 }
@@ -1307,7 +1224,7 @@ elm_imageslider_item_next(Elm_Imageslider_Item * it)
 /**
 * Move to the previous Image Slider item
 *
-* @param obj   The Image Slider object
+* @param obj    The Image Slider object
 *
 * @ingroup Imageslider
 */
@@ -1348,3 +1265,28 @@ elm_imageslider_next(Evas_Object * obj)
    _imageslider_obj_move(wd, 1);
 
 }
+
+/**
+* Updates an Image Slider item
+*
+* @param it The Image Slider item
+*
+* @ingroup Imageslider
+*/
+EAPI void
+elm_imageslider_item_update(Elm_Imageslider_Item *it)
+{
+   Widget_Data *wd;
+
+   if (!it || (!(wd = elm_widget_data_get(it->obj)))) return;
+   ELM_CHECK_WIDTYPE(it->obj, widtype);
+
+   if (wd->ani_lock == EINA_TRUE) return;
+   if (it == eina_list_data_get(eina_list_prev(wd->cur)))
+     elm_layout_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL);
+   else if (it == eina_list_data_get(wd->cur))
+     elm_layout_content_set(wd->ly[BLOCK_CENTER], "swl.photo", NULL);
+   else if (it == eina_list_data_get(eina_list_next(wd->cur)))
+     elm_layout_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL);
+   _imageslider_update(wd);
+}