3 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
7 #include <Elementary.h>
11 * @defgroup Imageslider Imageslider
14 * By flicking images on the screen,
15 * you can see the images in specific path.
18 typedef struct _Widget_Data Widget_Data;
20 #define ANI_STEP (14 * elm_scale_get())
21 #define ANI_TIME (0.005)
22 #define ANI_TIME_MSEC (12)
23 #define CLICK_TIME_MAX (180)
24 #define CLICK_WIDTH_MIN (elm_finger_size_get() >> 1)
25 #define FLICK_TIME_MAX (200)
26 #define FLICK_WIDTH_MIN (elm_finger_size_get() >> 2)
28 #define STEP_WEIGHT_DEF (1)
29 #define STEP_WEIGHT_MAX (2)
30 #define STEP_WEIGHT_MIN (0)
31 #define MOVING_IMAGE_SIZE (128)
32 #define MAX_ZOOM_SIZE (6)
33 #define INTERVAL_WIDTH (15)
34 #define MULTITOUCHDEVICE (11)
36 // Enumeration for layout.
46 struct _Imageslider_Item
49 const char *photo_file;
50 void (*func) (void *data, Evas_Object *obj, void *event_info);
52 Evas_Coord x, y, w, h;
53 Evas_Coord ox, oy, ow, oh;
57 // Image Slider Widget Data.
60 Evas_Object *ly[BLOCK_MAX];
64 Evas_Coord x, y, w, h;
66 Ecore_Idler *queue_idler;
67 Ecore_Timer *anim_timer;
69 Evas_Coord_Point down_pos;
74 unsigned int timestamp;
83 int mdx, mdy, mmx, mmy;
88 // Global value definition.
89 static const char *widtype = NULL;
91 static const char SIG_CLICKED[] = "clicked";
93 // Internal function definition.
94 static void _del_hook(Evas_Object *obj);
96 static void _theme_hook(Evas_Object *obj);
98 static void _sizing_eval(Evas_Object *obj);
100 static void _imageslider_del_all(Widget_Data * wd);
102 static void _imageslider_move(void *data, Evas * e, Evas_Object *obj,
104 static void _imageslider_resize(void *data, Evas * e, Evas_Object *obj,
106 static void _imageslider_show(void *data, Evas * e, Evas_Object *obj,
108 static void _imageslider_hide(void *data, Evas * e, Evas_Object *obj,
110 static void _imageslider_update(Widget_Data * wd);
112 static void _imageslider_update_pos(Widget_Data * wd, Evas_Coord x,
113 Evas_Coord y, Evas_Coord w);
114 static void _imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x,
115 Evas_Coord my, Evas_Coord y,
117 static Evas_Object *_imageslider_add_obj(Widget_Data * wd);
119 static void _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left);
121 static void _imageslider_obj_move(Widget_Data * wd, Evas_Coord step);
123 static Eina_Bool _icon_to_image(void *data);
125 static int _check_drag(int state, void *data);
127 static void _check_zoom(void *data);
129 static void _anim(Widget_Data * wd);
131 static Eina_Bool _timer_cb(void *data);
133 //static void _signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
134 static void ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj,
136 static void ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj,
138 static void ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj,
141 // Whenever the Image Slider item is deleted, Call this funtion.
143 _del_hook(Evas_Object *obj)
149 wd = elm_widget_data_get(obj);
154 for (i = 0; i < BLOCK_MAX; i++)
156 evas_object_del(wd->ly[i]);
161 eina_list_free(wd->its);
167 ecore_idler_del(wd->queue_idler);
168 wd->queue_idler = NULL;
173 ecore_timer_del(wd->anim_timer);
174 wd->anim_timer = NULL;
182 // Whenever require processing theme, Call this function
184 _theme_hook(Evas_Object *obj)
190 wd = elm_widget_data_get(obj);
197 for (i = 0; i < BLOCK_MAX; i++)
199 wd->ly[i] = elm_layout_add(obj);
200 _elm_theme_object_set(obj, wd->ly[i], "imageslider", "base", "default");
201 elm_widget_resize_object_set(obj, wd->ly[i]);
202 evas_object_show(wd->ly[i]);
208 // Resize Image Slider item.
210 _sizing_eval(Evas_Object *obj)
214 Widget_Data *wd = elm_widget_data_get(obj);
221 e = evas_object_evas_get(wd->obj);
223 _imageslider_move(obj, e, obj, NULL);
224 _imageslider_resize(obj, e, obj, NULL);
228 // Whenever MOVE event occurs, Call this function.
230 _imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info)
241 wd = elm_widget_data_get((Evas_Object *) data);
247 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
250 evas_object_move(wd->clip, x, y);
252 _imageslider_update_pos(wd, wd->x, wd->y, wd->w);
256 // Whenever RESIZE event occurs, Call this fucntion.
258 _imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info)
271 wd = elm_widget_data_get((Evas_Object *) data);
277 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
278 fprintf(stderr, "%d %d -resize\n", w, h);
282 for (i = 0; i < BLOCK_MAX; i++)
284 evas_object_resize(wd->ly[i], w, h);
287 evas_object_resize(wd->clip, w, h);
289 _imageslider_update_pos(wd, wd->x, wd->y, wd->w);
293 // Whenever SHOW event occurs, Call this function.
295 _imageslider_show(void *data, Evas * e, Evas_Object *obj, void *event_info)
304 wd = elm_widget_data_get((Evas_Object *) data);
310 evas_object_show(wd->clip);
313 // Whenever HIDE event occurs, Call this function.
315 _imageslider_hide(void *data, Evas * e, Evas_Object *obj, void *event_info)
324 wd = elm_widget_data_get((Evas_Object *) data);
329 evas_object_hide(wd->clip);
332 // Delete all Image Slider items.
334 _imageslider_del_all(Widget_Data * wd)
344 for (i = 0; i < BLOCK_MAX; i++)
346 evas_object_del(wd->ly[i]);
350 // Update Image Slider item position.
352 _imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y,
355 evas_object_move(wd->ly[BLOCK_LEFT], x - (w + INTERVAL_WIDTH), y);
356 evas_object_move(wd->ly[BLOCK_CENTER], x, y);
357 evas_object_move(wd->ly[BLOCK_RIGHT], x + (w + INTERVAL_WIDTH), y);
358 evas_render_idle_flush(evas_object_evas_get(wd->obj));
361 // Update the center position of Image Slider item.
363 _imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my,
364 Evas_Coord y, Evas_Coord w)
368 Evas_Coord ix, iy, iw, ih;
371 edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]),
373 evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
375 if ((ix > 0) || (ix + iw < wd->w))
377 edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]),
378 "block.on", "block");
379 _imageslider_update_pos(wd, x, y, w);
380 wd->on_zoom = EINA_FALSE;
384 // Add previous/next Image Slider item.
386 _imageslider_add_obj(Widget_Data * wd)
390 eo = elm_layout_add(wd->obj);
391 elm_layout_theme_set(eo, "imageslider", "base", "default");
392 elm_widget_resize_object_set(wd->obj, eo);
393 //evas_object_smart_member_add(eo, wd->obj);
395 //edje_object_signal_callback_add(elm_layout_edje_get(eo), "elm,photo,clicked", "", _signal_clicked, wd->obj);
396 evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN,
397 ev_imageslider_down_cb, wd);
398 evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP,
399 ev_imageslider_up_cb, wd);
400 evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE,
401 ev_imageslider_move_cb, wd);
402 evas_object_resize(eo, wd->w, wd->h);
403 evas_object_move(eo, wd->w + INTERVAL_WIDTH, wd->y);
404 evas_object_clip_set(eo, wd->clip);
405 evas_object_show(eo);
410 // Shift next/previous Image Slider item in layouts.
412 _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left)
416 if (wd->ly[BLOCK_LEFT])
418 evas_object_del(wd->ly[BLOCK_LEFT]);
419 wd->ly[BLOCK_LEFT] = NULL;
422 wd->ly[BLOCK_LEFT] = wd->ly[BLOCK_CENTER];
423 wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_RIGHT];
424 wd->ly[BLOCK_RIGHT] = _imageslider_add_obj(wd);
428 if (wd->ly[BLOCK_RIGHT])
430 evas_object_del(wd->ly[BLOCK_RIGHT]);
431 wd->ly[BLOCK_RIGHT] = NULL;
434 wd->ly[BLOCK_RIGHT] = wd->ly[BLOCK_CENTER];
435 wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_LEFT];
436 wd->ly[BLOCK_LEFT] = _imageslider_add_obj(wd);
440 // Move the current Image Slider item and update.
442 _imageslider_obj_move(Widget_Data * wd, Evas_Coord step)
446 wd->cur = eina_list_next(wd->cur);
449 wd->cur = eina_list_last(wd->its);
454 wd->step = -ANI_STEP;
456 _imageslider_obj_shift(wd, 0);
462 wd->cur = eina_list_prev(wd->cur);
466 wd->step = -ANI_STEP;
472 _imageslider_obj_shift(wd, 1);
481 wd->step = -ANI_STEP;
485 _imageslider_update(wd);
488 // Whenever MOUSE DOWN event occurs, Call this function.
490 ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj,
493 Widget_Data *wd = data;
495 Evas_Event_Mouse_Down *ev = event_info;
497 Evas_Coord ix, iy, iw, ih;
499 Evas_Object *eo = NULL;
504 wd->down_pos = ev->canvas;
505 wd->timestamp = ev->timestamp;
506 wd->move_cnt = MOVE_STEP;
508 wd->dx = ev->canvas.x;
509 wd->dy = ev->canvas.y;
510 wd->mx = ev->canvas.x;
511 wd->my = ev->canvas.y;
516 eo = edje_object_part_swallow_get(elm_layout_edje_get(obj), "swl.photo");
518 evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
522 wd->on_zoom = EINA_TRUE;
523 edje_object_signal_emit(elm_layout_edje_get(obj), "block.off", "block");
529 // Whenever MOUSE UP event occurs, Call this function.
530 // And make Click Event also.
532 ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
534 Widget_Data *wd = data;
536 Evas_Event_Mouse_Up *ev = event_info;
550 step = wd->down_pos.x - ev->canvas.x;
551 interval = ev->timestamp - wd->timestamp;
552 if (step == 0 || interval == 0)
554 fprintf(stderr, "[[[ DEBUG ]]]: case1: emit CLICK event\n");
555 evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
558 if (interval < CLICK_TIME_MAX)
560 if (step < CLICK_WIDTH_MIN && step > CLICK_WIDTH_MIN)
562 fprintf(stderr, "[[[ DEBUG ]]]: case2: emit CLICK event\n");
563 evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
568 if (interval < FLICK_TIME_MAX)
571 if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN)
574 "[[[ DEBUG ]]]:ev_imageslider_up_cb-black zone (1)\n");
576 _imageslider_obj_move(wd, 0);
581 "[[[ DEBUG ]]]:ev_imageslider_up_cb-black zone (2)\n");
583 _imageslider_obj_move(wd, step);
589 step = (wd->x - wd->move_x) << 1;
590 if (step <= wd->w && step >= -(wd->w))
593 "[[[ DEBUG ]]]:ev_imageslider_up_cb-white zone (1)\n");
595 _imageslider_obj_move(wd, 0);
600 "[[[ DEBUG ]]]:ev_imageslider_up_cb-white zone (2)\n");
602 _imageslider_obj_move(wd, step);
609 // Whenever MOUSE MOVE event occurs, Call this API.
611 ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj,
620 Widget_Data *wd = data;
622 Evas_Event_Mouse_Move *ev = event_info;
624 Elm_Imageslider_Item *it;
629 if (wd->move_cnt == MOVE_STEP)
631 if (wd->on_hold == EINA_FALSE)
637 step = ev->cur.canvas.x - wd->down_pos.x;
643 wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x));
644 wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y));
648 _imageslider_update_center_pos(wd, wd->move_x,
649 wd->move_y, wd->y, wd->w);
653 _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
659 wd->mx = ev->cur.canvas.x;
660 wd->my = ev->cur.canvas.y;
663 sqrt((wd->mx - wd->mmx) * (wd->mx - wd->mmx) +
664 (wd->my - wd->mmy) * (wd->my - wd->mmy));
667 edje_object_part_swallow_get(elm_layout_edje_get(obj),
671 it = eina_list_data_get(wd->cur);
672 if (((it->w * wd->ratio / wd->dratio) / it->ow) <
675 edje_object_part_unswallow(elm_layout_edje_get(obj), eo);
676 evas_object_resize(eo, it->w * wd->ratio / wd->dratio,
677 it->h * wd->ratio / wd->dratio);
678 evas_object_size_hint_min_set(eo,
683 edje_object_part_swallow(elm_layout_edje_get(obj),
695 // Whenever CLICK event occurs, Call this API
696 // But, DONOT emit CLICK event.
697 // DO NOT use this callback function. Remove later.
699 _signal_clicked(void *data, Evas_Object *obj, const char *emission,
703 "[[[ DEBUG ]]]: Call the callback function about Click event!, But DONOT emit CLICK event in the callback function!\n");
708 time_get(Evas_Coord x, Evas_Coord w)
712 time = (-sin(x / w) + 1) / 500;
721 _icon_to_image(void *data)
723 Widget_Data *wd = data;
726 _imageslider_update(wd);
730 ecore_idler_del(wd->queue_idler);
731 wd->queue_idler = NULL;
733 return ECORE_CALLBACK_CANCEL;
737 _check_drag(int state, void *data)
739 Widget_Data *wd = data;
741 Elm_Imageslider_Item *it;
743 Evas_Coord ix, iy, iw, ih;
747 Eina_List *l[BLOCK_MAX];
749 Evas_Object *eo = NULL;
751 l[BLOCK_LEFT] = eina_list_prev(wd->cur);
752 l[BLOCK_CENTER] = wd->cur;
753 l[BLOCK_RIGHT] = eina_list_next(wd->cur);
755 it = eina_list_data_get(l[state]);
758 edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[state]),
761 evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
762 evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
763 edje_object_part_drag_value_get(elm_layout_edje_get(wd->ly[state]),
764 "swl.photo", &dx, &dy);
766 if ((iw != wd->w) || ((dx != 0) || (dy != 0)))
770 evas_object_del(wd->ly[state]);
771 wd->ly[state] = NULL;
773 wd->ly[state] = _imageslider_add_obj(wd);
784 _check_zoom(void *data)
786 Widget_Data *wd = data;
788 Elm_Imageslider_Item *it;
790 Evas_Coord ix, iy, iw, ih;
794 Evas_Object *eo = NULL;
796 it = eina_list_data_get(wd->cur);
799 edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]),
802 evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
803 evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
804 edje_object_part_drag_value_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]),
805 "swl.photo", &dx, &dy);
807 if ((iw != wd->w) || ((dx != 0) || (dy != 0)))
809 wd->on_zoom = EINA_TRUE;
810 edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]),
811 "block.off", "block");
816 wd->on_zoom = EINA_FALSE;
817 edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]),
818 "block.on", "block");
824 _timer_cb(void *data)
828 Elm_Imageslider_Item *it;
837 if (wd->ani_lock == 0)
840 gettimeofday(&tv, NULL);
842 t = (tv.tv_sec - wd->tv.tv_sec) * 1000 + (tv.tv_usec -
843 wd->tv.tv_usec) / 1000;
844 gettimeofday(&wd->tv, NULL);
846 t = t / ANI_TIME_MSEC;
847 if (t <= STEP_WEIGHT_MIN)
849 else if (t > STEP_WEIGHT_MAX)
852 wd->move_x += (wd->step) * t;
854 if (wd->step < 0 && wd->move_x < wd->x)
856 else if (wd->step > 0 && wd->move_x > wd->x)
859 _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
861 if (wd->move_x == wd->x)
866 it = eina_list_data_get(wd->cur);
868 it->func(it->data, wd->obj, it);
872 it = eina_list_data_get(wd->cur);
873 evas_object_smart_callback_call(wd->obj, "changed", it);
876 ret = _check_drag(BLOCK_LEFT, wd);
877 ret = _check_drag(BLOCK_RIGHT, wd);
880 if (!wd->queue_idler)
881 wd->queue_idler = ecore_idler_add(_icon_to_image, wd);
885 ecore_timer_del(wd->anim_timer);
886 wd->anim_timer = NULL;
889 return ECORE_CALLBACK_CANCEL;
892 return ECORE_CALLBACK_RENEW;
896 _anim(Widget_Data * wd)
900 if (wd->x == wd->move_x)
902 _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
909 gettimeofday(&wd->tv, NULL);
913 wd->anim_timer = ecore_timer_add(ANI_TIME, _timer_cb, wd);
917 // Update Image Slider Items.
919 _imageslider_update(Widget_Data * wd)
923 Eina_List *l[BLOCK_MAX];
925 Elm_Imageslider_Item *it;
936 _imageslider_del_all(wd);
940 l[BLOCK_LEFT] = eina_list_prev(wd->cur);
941 l[BLOCK_CENTER] = wd->cur;
942 l[BLOCK_RIGHT] = eina_list_next(wd->cur);
944 for (i = 0; i < BLOCK_MAX; i++)
947 edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[i]),
951 elm_layout_content_set(wd->ly[i], "swl.photo", NULL);
956 it = eina_list_data_get(l[i]);
962 eo = elm_image_add(wd->obj);
963 elm_layout_content_set(wd->ly[i], "swl.photo", eo);
964 elm_image_prescale_set(eo, wd->w);
965 elm_image_file_set(eo, it->photo_file, NULL);
966 elm_image_object_size_get(eo, &it->w, &it->h);
967 evas_object_geometry_get(eo, &it->ox, &it->oy, &it->ow,
973 if (wd->moving != it->moving)
975 it->moving = wd->moving;
978 elm_image_prescale_set(eo, MOVING_IMAGE_SIZE);
982 elm_image_prescale_set(eo,
983 it->w > it->h ? it->w : it->h);
994 * Add an Image Slider widget
996 * @param parent The parent object
997 * @return The new Image slider object or NULL if it cannot be created
999 * @ingroup Imageslider
1002 elm_imageslider_add(Evas_Object *parent)
1006 Evas_Object *obj = NULL;
1008 Widget_Data *wd = NULL;
1017 wd = ELM_NEW(Widget_Data);
1018 e = evas_object_evas_get(parent);
1024 obj = elm_widget_add(e);
1025 ELM_SET_WIDTYPE(widtype, "imageslider");
1026 elm_widget_type_set(obj, "imageslider");
1027 elm_widget_sub_object_add(parent, obj);
1028 elm_widget_data_set(obj, wd);
1029 //wd->parent = parent;
1030 elm_widget_del_hook_set(obj, _del_hook);
1031 elm_widget_theme_hook_set(obj, _theme_hook);
1033 wd->clip = evas_object_rectangle_add(e);
1035 for (i = 0; i < BLOCK_MAX; i++)
1037 wd->ly[i] = elm_layout_add(obj);
1038 elm_layout_theme_set(wd->ly[i], "imageslider", "base", "default");
1039 elm_widget_resize_object_set(obj, wd->ly[i]);
1040 evas_object_smart_member_add(wd->ly[i], obj);
1042 //edje_object_signal_callback_add(elm_layout_edje_get(wd->ly[i]), "elm,photo,clicked", "", _signal_clicked, obj);
1043 evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_DOWN,
1044 ev_imageslider_down_cb, wd);
1045 evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_UP,
1046 ev_imageslider_up_cb, wd);
1047 evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_MOVE,
1048 ev_imageslider_move_cb, wd);
1049 evas_object_clip_set(wd->ly[i], wd->clip);
1050 evas_object_show(wd->ly[i]);
1055 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1056 _imageslider_resize, obj);
1057 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _imageslider_move,
1059 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _imageslider_show,
1061 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _imageslider_hide,
1070 * Append an Image Slider item
1072 * @param obj The Image Slider object
1073 * @param photo_file photo file path
1074 * @param func callback function
1075 * @param data callback data
1076 * @return The Image Slider item handle or NULL
1078 * @ingroup Imageslider
1080 EAPI Elm_Imageslider_Item *
1081 elm_imageslider_item_append(Evas_Object *obj, const char *photo_file,
1082 Elm_Imageslider_Cb func, void *data)
1084 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1087 Elm_Imageslider_Item *it;
1089 if (!obj || !(wd = elm_widget_data_get(obj)))
1094 it = (Elm_Imageslider_Item *) calloc(1, sizeof(Elm_Imageslider_Item));
1097 it->photo_file = eina_stringshare_add(photo_file);
1101 wd->its = eina_list_append(wd->its, it);
1106 _imageslider_update(wd);
1112 * Insert an Image Slider item into the Image Slider Widget by using the given index.
1114 * @param obj The Image Slider object
1115 * @param photo_file photo file path
1116 * @param func callback function
1117 * @param index required position
1118 * @param data callback data
1119 * @return The Image Slider item handle or NULL
1121 * @ingroup Imageslider
1123 EAPI Elm_Imageslider_Item *
1124 elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file,
1125 Elm_Imageslider_Cb func,
1126 unsigned int index, void *data)
1128 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1131 Elm_Imageslider_Item *it;
1134 "[[[ DEBUG ]]]:: New elm_imageslider_item_append_relative()\n");
1136 if (!obj || !(wd = elm_widget_data_get(obj)))
1141 it = (Elm_Imageslider_Item *) calloc(1, sizeof(Elm_Imageslider_Item));
1146 it->photo_file = eina_stringshare_add(photo_file);
1151 eina_list_append_relative(wd->its, it, eina_list_nth(wd->its, index - 2));
1156 _imageslider_update(wd);
1162 * Prepend Image Slider item
1164 * @param obj The Image Slider object
1165 * @param photo_file photo file path
1166 * @param func callback function
1167 * @param data callback data
1168 * @return The imageslider item handle or NULL
1170 * @ingroup Imageslider
1172 EAPI Elm_Imageslider_Item *
1173 elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file,
1174 Elm_Imageslider_Cb func, void *data)
1176 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1179 Elm_Imageslider_Item *it;
1181 if (!obj || !(wd = elm_widget_data_get(obj)))
1186 it = (Elm_Imageslider_Item *) calloc(1, sizeof(Elm_Imageslider_Item));
1187 it->photo_file = eina_stringshare_add(photo_file);
1191 wd->its = eina_list_prepend(wd->its, it);
1196 _imageslider_update(wd);
1202 * Delete the selected Image Slider item
1204 * @param it The selected Image Slider item handle
1206 * @ingroup Imageslider
1209 elm_imageslider_item_del(Elm_Imageslider_Item * it)
1213 Elm_Imageslider_Item *_it;
1217 if (!it || !(wd = elm_widget_data_get(it->obj)))
1222 EINA_LIST_FOREACH(wd->its, l, _it)
1227 wd->cur = eina_list_prev(wd->cur);
1228 wd->its = eina_list_remove(wd->its, it);
1235 _imageslider_update(wd);
1240 * Get the selected Image Slider item
1242 * @param obj The Image Slider object
1243 * @return The selected Image Slider item or NULL
1245 * @ingroup Imageslider
1247 EAPI Elm_Imageslider_Item *
1248 elm_imageslider_selected_item_get(Evas_Object *obj)
1250 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1253 if (!obj || (!(wd = elm_widget_data_get(obj))))
1261 return eina_list_data_get(wd->cur);
1265 * Get whether an Image Slider item is selected or not
1267 * @param it the selected Image Slider item
1268 * @return EINA_TRUE or EINA_FALSE
1270 * @ingroup Imageslider
1273 elm_imageslider_item_selected_get(Elm_Imageslider_Item * it)
1277 if (!it || !it->obj || (!(wd = elm_widget_data_get(it->obj))))
1285 if (eina_list_data_get(wd->cur) == it)
1293 * Set the selected Image Slider item
1295 * @param it The Imaga Slider item
1297 * @ingroup Imageslider
1300 elm_imageslider_item_selected_set(Elm_Imageslider_Item * it)
1306 Elm_Imageslider_Item *_it;
1312 if (!it || !it->obj || (!(wd = elm_widget_data_get(it->obj))))
1317 EINA_LIST_FOREACH(wd->its, l, _it)
1325 for (i = 0; i < BLOCK_MAX; i++)
1328 edje_object_part_swallow_get(elm_layout_edje_get(wd->ly[i]),
1332 elm_layout_content_set(wd->ly[i], "swl.photo", NULL);
1333 evas_object_del(eo);
1337 _imageslider_update(wd);
1342 * Get the photo file path of given Image Slider item
1344 * @param it The Image Slider item
1345 * @return The photo file path or NULL;
1347 * @ingroup Imageslider
1350 elm_imageslider_item_photo_file_get(Elm_Imageslider_Item * it)
1357 return it->photo_file;
1361 * Get the previous Image Slider item
1363 * @param it The Image Slider item
1364 * @return The previous Image Slider item or NULL
1366 * @ingroup Imageslider
1368 EAPI Elm_Imageslider_Item *
1369 elm_imageslider_item_prev(Elm_Imageslider_Item * it)
1373 Elm_Imageslider_Item *_it;
1377 if (!it || (!(wd = elm_widget_data_get(it->obj))))
1382 EINA_LIST_FOREACH(wd->its, l, _it)
1386 l = eina_list_prev(l);
1389 return eina_list_data_get(l);
1397 * Get the next Image Slider item
1399 * @param it The Image Slider item
1400 * @return The next Image Slider item or NULL
1402 * @ingroup Imageslider
1404 EAPI Elm_Imageslider_Item *
1405 elm_imageslider_item_next(Elm_Imageslider_Item * it)
1409 Elm_Imageslider_Item *_it;
1413 if (!it || (!(wd = elm_widget_data_get(it->obj))))
1418 EINA_LIST_FOREACH(wd->its, l, _it)
1422 l = eina_list_next(l);
1425 return eina_list_data_get(l);
1433 * Move to the previous Image Slider item
1435 * @param obj The Image Slider object
1437 * @ingroup Imageslider
1440 elm_imageslider_prev(Evas_Object *obj)
1442 ELM_CHECK_WIDTYPE(obj, widtype);
1445 if (!obj || (!(wd = elm_widget_data_get(obj))))
1453 _imageslider_obj_move(wd, -1);
1457 * Move to the next Image Slider item
1459 * @param obj The Image Slider object
1461 * @ingroup Imageslider
1464 elm_imageslider_next(Evas_Object * obj)
1466 ELM_CHECK_WIDTYPE(obj, widtype);
1469 if (!obj || (!(wd = elm_widget_data_get(obj))))
1477 _imageslider_obj_move(wd, 1);