X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Felm_imageslider.c;h=3f22bc244adde3858f818ef80d8dd501f8246aa5;hb=02542407a2de3884ea39ef5e63d362c5e176308a;hp=0650a391ce7456af69277b98e54f0b83143f536e;hpb=fd700eaf15c6d9c11b28127f7bd782db70982f9f;p=framework%2Fuifw%2Felementary.git diff --git a/src/lib/elm_imageslider.c b/src/lib/elm_imageslider.c index 0650a39..3f22bc2 100644 --- a/src/lib/elm_imageslider.c +++ b/src/lib/elm_imageslider.c @@ -1,20 +1,8 @@ -/* -* -* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 -*/ #include #include #include #include "elm_priv.h" -/** -* @defgroup Imageslider Imageslider -* @ingroup Elementary -* -* By flicking images on the screen, -* you can see the images in specific path. -*/ - typedef struct _Widget_Data Widget_Data; #define ANI_STEP (14 * elm_scale_get()) @@ -49,9 +37,6 @@ 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; }; // Image Slider Widget Data. @@ -76,13 +61,6 @@ struct _Widget_Data int move_cnt; int ani_lock:1; 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; - int ratio; }; // Global value declaration. @@ -104,7 +82,6 @@ static void _imageslider_hide(void *data, Evas * e, Evas_Object *obj, void *even 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 void _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left); @@ -114,13 +91,10 @@ static Eina_Bool _icon_to_image(void *data); static int _check_drag(int state, void *data); -static void _check_zoom(void *data); - 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); @@ -129,20 +103,11 @@ static void _ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void static void _del_hook(Evas_Object *obj) { - int i; - Widget_Data *wd; wd = elm_widget_data_get(obj); - if (!wd) - return; - - for (i = 0; i < BLOCK_MAX; i++) - { - elm_widget_sub_object_del(wd->obj, wd->ly[i]); - evas_object_del(wd->ly[i]); - } + if (!wd) return; if (wd->its) { @@ -162,31 +127,26 @@ _del_hook(Evas_Object *obj) wd->anim_timer = NULL; } - if (wd) - free(wd); - + if (wd) free(wd); } // Whenever require processing theme, Call this function 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"); + 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); } @@ -205,12 +165,11 @@ _sizing_eval(Evas_Object *obj) _imageslider_move(obj, e, obj, NULL); _imageslider_resize(obj, e, obj, NULL); - } // 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; @@ -228,12 +187,11 @@ _imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info) wd->y = y; _imageslider_update_pos(wd, wd->x, wd->y, wd->w); - } // 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; @@ -245,11 +203,11 @@ _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); - fprintf(stderr, "%d %d -resize\n", w, h); + DBG("%d %d -resize\n", w, h); wd->w = w; wd->h = h; @@ -264,7 +222,7 @@ _imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info) // 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; @@ -281,7 +239,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; @@ -296,29 +254,9 @@ _imageslider_hide(void *data, Evas * e, Evas_Object *obj, void *event_info) 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) -{ - Evas_Coord ix, iy, iw, ih; - const Evas_Object *eo = elm_layout_content_get((const Evas_Object*)(wd->ly[BLOCK_CENTER]), "swl.photo"); - 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"); - _imageslider_update_pos(wd, x, y, w); - wd->on_zoom = EINA_FALSE; - } } // Shift next/previous Image Slider item in layouts. @@ -332,7 +270,7 @@ _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left) wd->ly[BLOCK_LEFT] = wd->ly[BLOCK_CENTER]; wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_RIGHT]; wd->ly[BLOCK_RIGHT] = ly_temp; - elm_layout_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL); + elm_object_part_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL); } else { @@ -341,7 +279,7 @@ _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left) wd->ly[BLOCK_RIGHT] = wd->ly[BLOCK_CENTER]; wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_LEFT]; wd->ly[BLOCK_LEFT] = ly_temp; - elm_layout_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL); + elm_object_part_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL); } } @@ -361,9 +299,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) { @@ -377,9 +315,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 { @@ -387,7 +325,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); @@ -395,47 +333,23 @@ _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 __UNUSED__, void *event_info) { Widget_Data *wd = data; - Evas_Event_Mouse_Down *ev = event_info; - Evas_Coord ix, iy, iw, ih; - - Evas_Object *eo = NULL; - if (wd->ani_lock) return; wd->down_pos = ev->canvas; wd->timestamp = ev->timestamp; wd->move_cnt = MOVE_STEP; - - wd->dx = ev->canvas.x; - wd->dy = ev->canvas.y; - wd->mx = ev->canvas.x; - wd->my = ev->canvas.y; - - wd->dratio = 1; - wd->ratio = 1; - - 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) - { - 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; @@ -445,150 +359,88 @@ _ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info) int interval; - if (wd->ani_lock) - return; + if (wd->ani_lock) return; - if (wd->on_zoom) + step = wd->down_pos.x - ev->canvas.x; + interval = ev->timestamp - wd->timestamp; + if (step == 0 || interval == 0) { + DBG("case1: emit CLICK event\n"); + evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL); + return; } - else + if (interval < CLICK_TIME_MAX) { - step = wd->down_pos.x - ev->canvas.x; - interval = ev->timestamp - wd->timestamp; - if (step == 0 || interval == 0) + if (step < CLICK_WIDTH_MIN && step > CLICK_WIDTH_MIN) { - fprintf(stderr, "[[[ DEBUG ]]]: case1: emit CLICK event\n"); + DBG("case2: emit CLICK event\n"); evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL); return; } - if (interval < CLICK_TIME_MAX) + } + + if (interval < FLICK_TIME_MAX) + { + if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN) { - if (step < CLICK_WIDTH_MIN && step > CLICK_WIDTH_MIN) - { - fprintf(stderr, "[[[ DEBUG ]]]: case2: emit CLICK event\n"); - evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL); - return; - } - } + DBG("ev_imageslider_up_cb-black zone (1)\n"); - if (interval < FLICK_TIME_MAX) + _imageslider_obj_move(wd, 0); + } + else { - if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN) - { - fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-black zone (1)\n"); + DBG("ev_imageslider_up_cb-black zone (2)\n"); - _imageslider_obj_move(wd, 0); - } - else - { - fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-black zone (2)\n"); + _imageslider_obj_move(wd, step); + } - _imageslider_obj_move(wd, step); - } + } + else + { + step = (wd->x - wd->move_x) << 1; + if (step <= wd->w && step >= -(wd->w)) + { + DBG("ev_imageslider_up_cb-white zone (1)\n"); + _imageslider_obj_move(wd, 0); } else { - 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"); - - _imageslider_obj_move(wd, 0); - } - else - { - fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-white zone (2)\n"); + DBG("ev_imageslider_up_cb-white zone (2)\n"); - _imageslider_obj_move(wd, step); - } + _imageslider_obj_move(wd, step); } } - } -// 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 __UNUSED__, void *event_info) { - int idx; - - Evas_Object *eo; - + int idx = 0; Evas_Coord step; - Widget_Data *wd = data; - Evas_Event_Mouse_Move *ev = event_info; - Elm_Imageslider_Item *it; - - if (wd->ani_lock) - return; - + if (wd->ani_lock) return; if (wd->move_cnt == MOVE_STEP) { - if (wd->on_hold == EINA_FALSE) - { - wd->move_cnt = 0; + 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)); - - 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; - - wd->ratio = - sqrt((wd->mx - wd->mmx) * (wd->mx - wd->mmx) + (wd->my - wd->mmy) * (wd->my - wd->mmy)); - - eo = (Evas_Object*)elm_layout_content_get((const Evas_Object*)obj, "swl.photo"); - if (eo) - { - 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); - elm_layout_content_set(obj, "swl.photo", eo); - } - } + 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)); + _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w); } } wd->move_cnt++; - -} - -#if 0 -// Whenever CLICK event occurs, Call this API -// But, DONOT emit CLICK event. -// DO NOT use this callback function. Remove later. -static void -_signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) -{ - fprintf(stderr, "[[[ DEBUG ]]]: Call the callback function about Click event!, But DONOT emit CLICK event in the callback function!\n"); } -#endif static inline double time_get(Evas_Coord x, Evas_Coord w) @@ -612,10 +464,7 @@ _icon_to_image(void *data) _imageslider_update(wd); if (wd->queue_idler) - { - ecore_idler_del(wd->queue_idler); - wd->queue_idler = NULL; - } + wd->queue_idler = NULL; return ECORE_CALLBACK_CANCEL; } @@ -626,9 +475,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]; @@ -640,14 +489,14 @@ _check_drag(int state, void *data) it = eina_list_data_get(l[state]); - eo = (Evas_Object*)elm_layout_content_get(wd->ly[state], "swl.photo"); + eo = elm_object_part_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))) { - elm_layout_content_set(wd->ly[state], "swl.photo", NULL); + elm_object_part_content_set(wd->ly[state], "swl.photo", NULL); } else return 1; @@ -655,39 +504,6 @@ _check_drag(int state, void *data) return 0; } -static void -_check_zoom(void *data) -{ - Widget_Data *wd = data; - - Elm_Imageslider_Item *it; - - Evas_Coord ix, iy, iw, ih; - - double dx, dy = 0; - - Evas_Object *eo = NULL; - - it = eina_list_data_get(wd->cur); - - 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"); - } - else - { - wd->on_zoom = EINA_FALSE; - edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.on", "block"); - } -} - static Eina_Bool _timer_cb(void *data) { @@ -697,14 +513,16 @@ _timer_cb(void *data) struct timeval tv; - int t; - - int ret; + int t = 0; + int ret = 0; wd = data; - if (wd->ani_lock == 0) - return 0; - + if (!wd->ani_lock) + { + if (wd->anim_timer) + wd->anim_timer = NULL; + return ECORE_CALLBACK_CANCEL; + } gettimeofday(&tv, NULL); t = (tv.tv_sec - wd->tv.tv_sec) * 1000 + (tv.tv_usec - wd->tv.tv_usec) / 1000; @@ -727,7 +545,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); @@ -742,16 +560,12 @@ _timer_cb(void *data) ret = _check_drag(BLOCK_LEFT, wd); ret = _check_drag(BLOCK_RIGHT, wd); - _check_zoom(wd); if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_icon_to_image, wd); if (wd->anim_timer) - { - ecore_timer_del(wd->anim_timer); - wd->anim_timer = NULL; - } + wd->anim_timer = NULL; return ECORE_CALLBACK_CANCEL; } @@ -770,7 +584,7 @@ _anim(Widget_Data * wd) return; } - wd->ani_lock = 1; + wd->ani_lock = EINA_TRUE; w = wd->move_x; gettimeofday(&wd->tv, NULL); @@ -791,8 +605,7 @@ _imageslider_update(Widget_Data * wd) Evas_Object *eo; - if (!wd) - return; + if (!wd) return; if (!wd->cur) return; @@ -802,10 +615,10 @@ _imageslider_update(Widget_Data * wd) for (i = 0; i < BLOCK_MAX; i++) { - eo = (Evas_Object*)elm_layout_content_get((const Evas_Object*)wd->ly[i], "swl.photo"); + eo = elm_object_part_content_get((const Evas_Object*)wd->ly[i], "swl.photo"); if (!l[i]) { - elm_layout_content_set(wd->ly[i], "swl.photo", NULL); + elm_object_part_content_set(wd->ly[i], "swl.photo", NULL); } else { @@ -816,61 +629,26 @@ _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); - } - - if (wd->moving != it->moving) - { - it->moving = wd->moving; - if (wd->moving) - { - //elm_image_prescale_set(eo, MOVING_IMAGE_SIZE); - } - else - { - //elm_image_prescale_set(eo, it->w > it->h ? it->w : it->h); - } + elm_object_part_content_set(wd->ly[i], "swl.photo", eo); } } } - _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 -*/ 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); @@ -879,6 +657,7 @@ 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++) @@ -888,7 +667,6 @@ elm_imageslider_add(Evas_Object *parent) 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); @@ -897,28 +675,15 @@ elm_imageslider_add(Evas_Object *parent) } wd->obj = obj; - evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _imageslider_resize, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _imageslider_move, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _imageslider_show, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _imageslider_hide, obj); _sizing_eval(obj); - 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 -*/ EAPI Elm_Imageslider_Item * elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data) { @@ -941,24 +706,10 @@ elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Images if (!wd->cur) wd->cur = wd->its; - _imageslider_update(wd); - return it; } -/** -* 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 -* -* @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) { @@ -967,7 +718,7 @@ elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, E Elm_Imageslider_Item *it; - fprintf(stderr, "[[[ DEBUG ]]]:: New elm_imageslider_item_append_relative()\n"); + DBG("New elm_imageslider_item_append_relative()\n"); if (!obj || !(wd = elm_widget_data_get(obj))) return NULL; @@ -981,28 +732,15 @@ elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, E it->func = func; it->data = data; - wd->its = - eina_list_append_relative(wd->its, it, eina_list_nth(wd->its, index - 2)); + wd->its = eina_list_append_relative(wd->its, it, eina_list_nth(wd->its, + index - 2)); if (!wd->cur) wd->cur = wd->its; - _imageslider_update(wd); - 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 -*/ EAPI Elm_Imageslider_Item * elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data) { @@ -1020,22 +758,12 @@ elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Image it->data = data; it->obj = obj; wd->its = eina_list_prepend(wd->its, it); - if (!wd->cur) wd->cur = wd->its; - _imageslider_update(wd); - return it; } -/** -* Delete the selected Image Slider item -* -* @param it The selected Image Slider item handle -* -* @ingroup Imageslider -*/ EAPI void elm_imageslider_item_del(Elm_Imageslider_Item * it) { @@ -1060,19 +788,9 @@ elm_imageslider_item_del(Elm_Imageslider_Item * it) break; } } - _imageslider_update(wd); - } -/** -* Get the selected Image Slider item -* -* @param obj The Image Slider object -* @return The selected Image Slider item or NULL -* -* @ingroup Imageslider -*/ EAPI Elm_Imageslider_Item * elm_imageslider_selected_item_get(Evas_Object *obj) { @@ -1088,14 +806,6 @@ elm_imageslider_selected_item_get(Evas_Object *obj) return eina_list_data_get(wd->cur); } -/** -* Get whether an Image Slider item is selected or not -* -* @param it the selected Image Slider item -* @return EINA_TRUE or EINA_FALSE -* -* @ingroup Imageslider -*/ EAPI Eina_Bool elm_imageslider_item_selected_get(Elm_Imageslider_Item * it) { @@ -1111,16 +821,8 @@ elm_imageslider_item_selected_get(Elm_Imageslider_Item * it) return EINA_TRUE; else return EINA_FALSE; - } -/** -* Set the selected Image Slider item -* -* @param it The Imaga Slider item -* -* @ingroup Imageslider -*/ EAPI void elm_imageslider_item_selected_set(Elm_Imageslider_Item * it) { @@ -1145,25 +847,13 @@ elm_imageslider_item_selected_set(Elm_Imageslider_Item * it) for (i = 0; i < BLOCK_MAX; i++) { - eo = (Evas_Object*)elm_layout_content_get(wd->ly[i], "swl.photo"); + eo = elm_object_part_content_get(wd->ly[i], "swl.photo"); if (eo) - { - elm_layout_content_set(wd->ly[i], "swl.photo", NULL); - } + elm_object_part_content_set(wd->ly[i], "swl.photo", NULL); } - _imageslider_update(wd); - } -/** -* Get the photo file path of given Image Slider item -* -* @param it The Image Slider item -* @return The photo file path or NULL; -* -* @ingroup Imageslider -*/ EAPI const char * elm_imageslider_item_photo_file_get(Elm_Imageslider_Item * it) { @@ -1172,14 +862,6 @@ elm_imageslider_item_photo_file_get(Elm_Imageslider_Item * it) 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) { @@ -1193,14 +875,6 @@ elm_imageslider_item_photo_file_set(Elm_Imageslider_Item *it, const char *photo_ } } -/** -* Get the previous Image Slider item -* -* @param it The Image Slider item -* @return The previous Image Slider item or NULL -* -* @ingroup Imageslider -*/ EAPI Elm_Imageslider_Item * elm_imageslider_item_prev(Elm_Imageslider_Item * it) { @@ -1223,18 +897,9 @@ elm_imageslider_item_prev(Elm_Imageslider_Item * it) return eina_list_data_get(l); } } - return NULL; } -/** -* Get the next Image Slider item -* -* @param it The Image Slider item -* @return The next Image Slider item or NULL -* -* @ingroup Imageslider -*/ EAPI Elm_Imageslider_Item * elm_imageslider_item_next(Elm_Imageslider_Item * it) { @@ -1257,17 +922,9 @@ elm_imageslider_item_next(Elm_Imageslider_Item * it) return eina_list_data_get(l); } } - return NULL; } -/** -* Move to the previous Image Slider item -* -* @param obj The Image Slider object -* -* @ingroup Imageslider -*/ EAPI void elm_imageslider_prev(Evas_Object *obj) { @@ -1276,20 +933,11 @@ elm_imageslider_prev(Evas_Object *obj) if (!obj || (!(wd = elm_widget_data_get(obj)))) return; - if (wd->ani_lock) return; - _imageslider_obj_move(wd, -1); } -/** -* Move to the next Image Slider item -* -* @param obj The Image Slider object -* -* @ingroup Imageslider -*/ EAPI void elm_imageslider_next(Evas_Object * obj) { @@ -1298,36 +946,25 @@ elm_imageslider_next(Evas_Object * obj) if (!obj || (!(wd = elm_widget_data_get(obj)))) return; - if (wd->ani_lock) return; - _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; - int i = 0; if (!it || (!(wd = elm_widget_data_get(it->obj)))) return; ELM_CHECK_WIDTYPE(it->obj, widtype); + if (wd->ani_lock) return; if (it == eina_list_data_get(eina_list_prev(wd->cur))) - elm_layout_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL); + elm_object_part_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_prev(wd->cur))) - elm_layout_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL); - + elm_object_part_content_set(wd->ly[BLOCK_CENTER], "swl.photo", NULL); + else if (it == eina_list_data_get(eina_list_next(wd->cur))) + elm_object_part_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL); _imageslider_update(wd); }