elementary: fix clip and smart child issue with elm_icon.
[framework/uifw/elementary.git] / src / lib / els_icon.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 typedef struct _Smart_Data Smart_Data;
5
6 struct _Smart_Data
7 {
8    Evas_Coord   x, y, w, h;
9    Evas_Object *obj;
10    Evas_Object *prev;
11    int          size;
12    double       scale;
13    Eina_Bool fill_inside : 1;
14    Eina_Bool scale_up : 1;
15    Eina_Bool scale_down : 1;
16    Eina_Bool preloading : 1;
17    Eina_Bool show : 1;
18    Eina_Bool edit : 1;
19    Eina_Bool edje : 1;
20    Eina_Bool aspect_ratio_retained: 1;
21    Elm_Image_Orient orient;
22 };
23
24 /* local subsystem functions */
25 static void _smart_reconfigure(Smart_Data *sd);
26 static void _smart_init(void);
27 static void _smart_add(Evas_Object *obj);
28 static void _smart_del(Evas_Object *obj);
29 static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
30 static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
31 static void _smart_show(Evas_Object *obj);
32 static void _smart_hide(Evas_Object *obj);
33 static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
34 static void _smart_clip_set(Evas_Object *obj, Evas_Object * clip);
35 static void _smart_clip_unset(Evas_Object *obj);
36
37 static void _els_smart_icon_flip_horizontal(Smart_Data *sd);
38 static void _els_smart_icon_flip_vertical(Smart_Data *sd);
39 static void _els_smart_icon_rotate_180(Smart_Data *sd);
40 static Eina_Bool _els_smart_icon_dropcb(void *,Evas_Object *, Elm_Selection_Data *);
41
42 /* local subsystem globals */
43 static Evas_Smart *_e_smart = NULL;
44
45 /* externally accessible functions */
46 Evas_Object *
47 _els_smart_icon_add(Evas *evas)
48 {
49    _smart_init();
50    return evas_object_smart_add(evas, _e_smart);
51 }
52
53 static void
54 _preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
55 {
56    Smart_Data *sd = data;
57
58    sd->preloading = EINA_FALSE;
59    if (obj == sd->obj)
60      {
61         if (sd->show)
62           evas_object_show(sd->obj);
63      }
64    if (sd->prev) evas_object_del(sd->prev);
65    sd->prev = NULL;
66 }
67
68 Eina_Bool
69 _els_smart_icon_file_key_set(Evas_Object *obj, const char *file, const char *key)
70 {
71    Smart_Data *sd;
72    Evas_Object *pclip;
73
74    sd = evas_object_smart_data_get(obj);
75    if (!sd) return EINA_FALSE;
76    /* smart code here */
77    if (sd->prev) evas_object_del(sd->prev);
78    pclip = evas_object_clip_get(sd->obj);
79    if (sd->obj) sd->prev = sd->obj;
80    sd->obj = evas_object_image_add(evas_object_evas_get(obj));
81    evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED,
82                                   _preloaded, sd);
83    evas_object_smart_member_add(sd->obj, obj);
84    if (sd->prev) evas_object_smart_member_add(sd->prev, obj);
85    evas_object_image_scale_hint_set(sd->obj, EVAS_IMAGE_SCALE_HINT_STATIC);
86    evas_object_clip_set(sd->obj, pclip);
87
88    sd->edje = EINA_FALSE;
89
90    if (!sd->size)
91      evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
92    evas_object_image_file_set(sd->obj, file, key);
93    sd->preloading = EINA_TRUE;
94    sd->show = EINA_TRUE;
95    evas_object_hide(sd->obj);
96    evas_object_image_preload(sd->obj, EINA_FALSE);
97    if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
98      {
99         ERR("Things are going bad for '%s' (%p)", file, sd->obj);
100         return EINA_FALSE;
101      }
102    _smart_reconfigure(sd);
103    return EINA_TRUE;
104 }
105
106 Eina_Bool
107 _els_smart_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
108 {
109    Smart_Data *sd;
110    Evas_Object *pclip;
111
112    sd = evas_object_smart_data_get(obj);
113    if (!sd) return EINA_FALSE;
114    /* smart code here */
115    if (sd->prev) evas_object_del(sd->prev);
116    sd->prev = NULL;
117
118    if (!sd->edje)
119      {
120         pclip = evas_object_clip_get(sd->obj);
121         if (sd->obj) evas_object_del(sd->obj);
122         sd->obj = edje_object_add(evas_object_evas_get(obj));
123         evas_object_smart_member_add(sd->obj, obj);
124         if (sd->show) evas_object_show(sd->obj);
125         evas_object_clip_set(sd->obj, pclip);
126      }
127    sd->edje = EINA_TRUE;
128    if (!edje_object_file_set(sd->obj, file, part))
129      return EINA_FALSE;
130    _smart_reconfigure(sd);
131    return EINA_TRUE;
132 }
133
134 void
135 _els_smart_icon_file_get(const Evas_Object *obj, const char **file, const char **key)
136 {
137    Smart_Data *sd = evas_object_smart_data_get(obj);
138    if (!sd) return;
139    if (sd->edje)
140      edje_object_file_get(sd->obj, file, key);
141    else
142      evas_object_image_file_get(sd->obj, file, key);
143 }
144
145 void
146 _els_smart_icon_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth)
147 {
148    Smart_Data *sd = evas_object_smart_data_get(obj);
149    if (!sd) return;
150    if (sd->edje)
151      return;
152    evas_object_image_smooth_scale_set(sd->obj, smooth);
153 }
154
155 Eina_Bool
156 _els_smart_icon_smooth_scale_get(const Evas_Object *obj)
157 {
158    Smart_Data *sd = evas_object_smart_data_get(obj);
159    if (!sd) return EINA_FALSE;
160    if (sd->edje)
161      return EINA_FALSE;
162    return evas_object_image_smooth_scale_get(sd->obj);
163 }
164
165 Evas_Object *
166 _els_smart_icon_object_get(const Evas_Object *obj)
167 {
168    Smart_Data *sd = evas_object_smart_data_get(obj);
169    if (!sd) return NULL;
170    return sd->obj;
171 }
172
173 void
174 _els_smart_icon_size_get(const Evas_Object *obj, int *w, int *h)
175 {
176    Smart_Data *sd;
177    int tw, th;
178    int cw, ch;
179
180    sd = evas_object_smart_data_get(obj);
181    if (!sd) return;
182    if (!strcmp(evas_object_type_get(sd->obj), "edje"))
183      edje_object_size_min_get(sd->obj, &tw, &th);
184    else
185      evas_object_image_size_get(sd->obj, &tw, &th);
186    evas_object_geometry_get(sd->obj, NULL, NULL, &cw, &ch);
187    tw = tw > cw ? tw : cw;
188    th = th > ch ? th : ch;
189    tw = ((double)tw) * sd->scale;
190    th = ((double)th) * sd->scale;
191    if (w) *w = tw;
192    if (h) *h = th;
193 }
194
195 void
196 _els_smart_icon_fill_inside_set(Evas_Object *obj, Eina_Bool fill_inside)
197 {
198    Smart_Data *sd;
199
200    sd = evas_object_smart_data_get(obj);
201    if (!sd) return;
202    if (((sd->fill_inside) && (fill_inside)) ||
203        ((!sd->fill_inside) && (!fill_inside))) return;
204    sd->fill_inside = fill_inside;
205    _smart_reconfigure(sd);
206 }
207
208 Eina_Bool
209 _els_smart_icon_fill_inside_get(const Evas_Object *obj)
210 {
211    Smart_Data *sd = evas_object_smart_data_get(obj);
212    if (!sd) return EINA_FALSE;
213    return sd->fill_inside;
214 }
215
216 void
217 _els_smart_icon_scale_up_set(Evas_Object *obj, Eina_Bool scale_up)
218 {
219    Smart_Data *sd;
220
221    sd = evas_object_smart_data_get(obj);
222    if (!sd) return;
223    if (((sd->scale_up) && (scale_up)) ||
224        ((!sd->scale_up) && (!scale_up))) return;
225    sd->scale_up = scale_up;
226    _smart_reconfigure(sd);
227 }
228
229 Eina_Bool
230 _els_smart_icon_scale_up_get(const Evas_Object *obj)
231 {
232    Smart_Data *sd; sd = evas_object_smart_data_get(obj);
233    if (!sd) return EINA_FALSE;
234    return sd->scale_up;
235 }
236
237 void
238 _els_smart_icon_scale_down_set(Evas_Object *obj, Eina_Bool scale_down)
239 {
240    Smart_Data *sd;
241
242    sd = evas_object_smart_data_get(obj);
243    if (!sd) return;
244    if (((sd->scale_down) && (scale_down)) ||
245        ((!sd->scale_down) && (!scale_down))) return;
246    sd->scale_down = scale_down;
247    _smart_reconfigure(sd);
248 }
249
250 Eina_Bool
251 _els_smart_icon_scale_down_get(const Evas_Object *obj)
252 {
253    Smart_Data *sd; sd = evas_object_smart_data_get(obj);
254    if (!sd) return EINA_FALSE;
255    return sd->scale_up;
256 }
257
258 void
259 _els_smart_icon_scale_size_set(Evas_Object *obj, int size)
260 {
261    Smart_Data *sd;
262
263    sd = evas_object_smart_data_get(obj);
264    if (!sd) return;
265    sd->size = size;
266    if (!sd->obj) return;
267    if (sd->edje)
268      return;
269    evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
270 }
271
272 int
273 _els_smart_icon_scale_size_get(const Evas_Object *obj)
274 {
275    Smart_Data *sd; sd = evas_object_smart_data_get(obj);
276    if (!sd) return 0;
277    return sd->size;
278 }
279
280 void
281 _els_smart_icon_scale_set(Evas_Object *obj, double scale)
282 {
283    Smart_Data *sd = evas_object_smart_data_get(obj);
284    if (!sd) return;
285    sd->scale = scale;
286    _smart_reconfigure(sd);
287 }
288
289 double
290 _els_smart_icon_scale_get(const Evas_Object *obj)
291 {
292    Smart_Data *sd; sd = evas_object_smart_data_get(obj);
293    if (!sd) return 0.0;
294    return sd->scale;
295 }
296
297 void
298 _els_smart_icon_orient_set(Evas_Object *obj, Elm_Image_Orient orient)
299 {
300    Smart_Data   *sd;
301    Evas_Object  *tmp;
302    unsigned int *data, *data2, *to, *from;
303    int           x, y, w, hw, iw, ih;
304    const char   *file, *key;
305
306    sd = evas_object_smart_data_get(obj);
307    if (!sd) return;
308    if (sd->edje)
309      return;
310
311    switch (orient)
312      {
313       case ELM_IMAGE_FLIP_HORIZONTAL:
314          _els_smart_icon_flip_horizontal(sd);
315          return;
316       case ELM_IMAGE_FLIP_VERTICAL:
317          _els_smart_icon_flip_vertical(sd);
318          return;
319       case ELM_IMAGE_ROTATE_180_CW:
320          _els_smart_icon_rotate_180(sd);
321          return;
322       default:
323          break;
324      }
325
326    evas_object_image_size_get(sd->obj, &iw, &ih);
327    evas_object_image_file_get(sd->obj, &file, &key);
328    tmp = evas_object_image_add(evas_object_evas_get(sd->obj));
329    evas_object_image_file_set(tmp, file, key);
330    data2 = evas_object_image_data_get(tmp, EINA_FALSE);
331
332    w = ih;
333    ih = iw;
334    iw = w;
335    hw = w * ih;
336
337    evas_object_image_size_set(sd->obj, iw, ih);
338    data = evas_object_image_data_get(sd->obj, EINA_TRUE);
339    switch (orient)
340      {
341       case ELM_IMAGE_FLIP_TRANSPOSE:
342          to = data;
343          hw = -hw + 1;
344          break;
345       case ELM_IMAGE_FLIP_TRANSVERSE:
346          to = data + hw - 1;
347          w = -w;
348          hw = hw - 1;
349          break;
350       case ELM_IMAGE_ROTATE_90_CW:
351          to = data + w - 1;
352          hw = -hw - 1;
353          break;
354       case ELM_IMAGE_ROTATE_90_CCW:
355          to = data + hw - w;
356          w = -w;
357          hw = hw + 1;
358          break;
359       default:
360          ERR("unknown orient %d", orient);
361          evas_object_del(tmp);
362          evas_object_image_data_set(sd->obj, data); // give it back
363          return;
364      }
365    from = data2;
366    for (x = iw; --x >= 0;)
367      {
368         for (y = ih; --y >= 0;)
369           {
370              *to = *from;
371              from++;
372              to += w;
373           }
374         to += hw;
375      }
376    sd->orient = orient;
377    evas_object_del(tmp);
378    evas_object_image_data_set(sd->obj, data);
379    evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih);
380    _smart_reconfigure(sd);
381 }
382
383 Elm_Image_Orient
384 _els_smart_icon_orient_get(const Evas_Object *obj)
385 {
386    Smart_Data *sd; sd = evas_object_smart_data_get(obj);
387    if (!sd) return 0;
388    return sd->orient;
389 }
390
391 /**
392  * Turns on editing through drag and drop and copy and paste.
393  */
394 void
395 _els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool edit, Evas_Object *parent)
396 {
397    Smart_Data   *sd = evas_object_smart_data_get(obj);
398    if (!sd) return;
399
400    if (sd->edje)
401      {
402         printf("No editing edje objects yet (ever)\n");
403         return;
404      }
405
406    /* Unfortunately eina bool is not a bool, but a char */
407    if (edit == sd->edit) return;
408
409    sd->edit = edit;
410
411    if (sd->edit)
412      elm_drop_target_add(obj, ELM_SEL_FORMAT_IMAGE, _els_smart_icon_dropcb,
413                          parent);
414    else
415      elm_drop_target_del(obj);
416 }
417
418 Eina_Bool
419 _els_smart_icon_edit_get(const Evas_Object *obj)
420 {
421    Smart_Data *sd; sd = evas_object_smart_data_get(obj);
422    if (!sd) return EINA_FALSE;
423    return sd->edit;
424 }
425
426 Evas_Object *
427 _els_smart_icon_edje_get(Evas_Object *obj)
428 {
429    Smart_Data *sd = evas_object_smart_data_get(obj);
430    if (!sd) return NULL;
431    if (!sd->edje) return NULL;
432    return sd->obj;
433 }
434
435 void
436 _els_smart_icon_aspect_ratio_retained_set(Evas_Object *obj, Eina_Bool retained)
437 {
438    Smart_Data *sd;
439
440    sd = evas_object_smart_data_get(obj);
441    if (!sd) return;
442
443    retained = !!retained;
444    if (sd->aspect_ratio_retained == retained) return;
445    sd->aspect_ratio_retained = retained;
446    _smart_reconfigure(sd);
447 }
448
449 Eina_Bool
450 _els_smart_icon_aspect_ratio_retained_get(const Evas_Object *obj)
451 {
452    Smart_Data *sd;
453
454    sd = evas_object_smart_data_get(obj);
455    if (!sd) return EINA_FALSE;
456    return sd->aspect_ratio_retained;
457 }
458
459 /* local subsystem globals */
460 static void
461 _smart_reconfigure(Smart_Data *sd)
462 {
463    Evas_Coord x, y, w, h;
464
465    if (!sd->obj) return;
466
467    w = sd->w;
468    h = sd->h;
469
470    if (!strcmp(evas_object_type_get(sd->obj), "edje"))
471      {
472         x = sd->x;
473         y = sd->y;
474         evas_object_move(sd->obj, x, y);
475         evas_object_resize(sd->obj, w, h);
476      }
477    else
478      {
479         int iw = 0, ih = 0;
480
481         evas_object_image_size_get(sd->obj, &iw, &ih);
482
483         iw = ((double)iw) * sd->scale;
484         ih = ((double)ih) * sd->scale;
485
486         if (iw < 1) iw = 1;
487         if (ih < 1) ih = 1;
488
489         if (sd->aspect_ratio_retained)
490           {
491              h = ((double)ih * w) / (double)iw;
492              if (sd->fill_inside)
493                {
494                   if (h > sd->h)
495                     {
496                        h = sd->h;
497                        w = ((double)iw * h) / (double)ih;
498                     }
499                }
500              else
501                {
502                   if (h < sd->h)
503                     {
504                        h = sd->h;
505                        w = ((double)iw * h) / (double)ih;
506                     }
507                }
508           }
509         if (!sd->scale_up)
510           {
511              if (w > iw) w = iw;
512              if (h > ih) h = ih;
513           }
514         if (!sd->scale_down)
515           {
516              if (w < iw) w = iw;
517              if (h < ih) h = ih;
518           }
519         x = sd->x + ((sd->w - w) / 2);
520         y = sd->y + ((sd->h - h) / 2);
521         evas_object_move(sd->obj, x, y);
522         evas_object_image_fill_set(sd->obj, 0, 0, w, h);
523         evas_object_resize(sd->obj, w, h);
524      }
525 }
526
527 static void
528 _smart_init(void)
529 {
530    if (_e_smart) return;
531      {
532         static const Evas_Smart_Class sc =
533           {
534              "e_icon",
535              EVAS_SMART_CLASS_VERSION,
536              _smart_add,
537              _smart_del,
538              _smart_move,
539              _smart_resize,
540              _smart_show,
541              _smart_hide,
542              _smart_color_set,
543              _smart_clip_set,
544              _smart_clip_unset,
545              NULL,
546              NULL,
547              NULL,
548              NULL,
549              NULL,
550              NULL,
551              NULL
552           };
553         _e_smart = evas_smart_class_new(&sc);
554      }
555 }
556
557 static void
558 _smart_add(Evas_Object *obj)
559 {
560    Smart_Data *sd;
561
562    sd = calloc(1, sizeof(Smart_Data));
563    if (!sd) return;
564    sd->obj = evas_object_image_add(evas_object_evas_get(obj));
565    sd->prev = NULL;
566    evas_object_image_scale_hint_set(sd->obj, EVAS_IMAGE_SCALE_HINT_STATIC);
567    sd->x = 0;
568    sd->y = 0;
569    sd->w = 0;
570    sd->h = 0;
571    sd->fill_inside = EINA_TRUE;
572    sd->scale_up = EINA_TRUE;
573    sd->scale_down = EINA_TRUE;
574    sd->aspect_ratio_retained = EINA_TRUE;
575    sd->size = 64;
576    sd->scale = 1.0;
577    evas_object_smart_member_add(sd->obj, obj);
578    evas_object_smart_data_set(obj, sd);
579    evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED,
580                                   _preloaded, sd);
581 }
582
583 static void
584 _smart_del(Evas_Object *obj)
585 {
586    Smart_Data *sd;
587
588    sd = evas_object_smart_data_get(obj);
589    if (!sd) return;
590    evas_object_del(sd->obj);
591    if (sd->prev) evas_object_del(sd->prev);
592    free(sd);
593 }
594
595 static void
596 _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
597 {
598    Smart_Data *sd;
599
600    sd = evas_object_smart_data_get(obj);
601    if (!sd) return;
602    if ((sd->x == x) && (sd->y == y)) return;
603    sd->x = x;
604    sd->y = y;
605    _smart_reconfigure(sd);
606 }
607
608 static void
609 _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
610 {
611    Smart_Data *sd;
612
613    sd = evas_object_smart_data_get(obj);
614    if (!sd) return;
615    if ((sd->w == w) && (sd->h == h)) return;
616    sd->w = w;
617    sd->h = h;
618    _smart_reconfigure(sd);
619 }
620
621 static void
622 _smart_show(Evas_Object *obj)
623 {
624    Smart_Data *sd;
625
626    sd = evas_object_smart_data_get(obj);
627    if (!sd) return;
628    sd->show = EINA_TRUE;
629    if (!sd->preloading)
630      {
631         evas_object_show(sd->obj);
632         if (sd->prev) evas_object_del(sd->prev);
633         sd->prev = NULL;
634      }
635 }
636
637 static void
638 _smart_hide(Evas_Object *obj)
639 {
640    Smart_Data *sd;
641
642    sd = evas_object_smart_data_get(obj);
643    if (!sd) return;
644    sd->show = EINA_FALSE;
645    evas_object_hide(sd->obj);
646    if (sd->prev) evas_object_del(sd->prev);
647    sd->prev = NULL;
648 }
649
650 static void
651 _smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
652 {
653    Smart_Data *sd;
654
655    sd = evas_object_smart_data_get(obj);
656    if (!sd) return;
657    evas_object_color_set(sd->obj, r, g, b, a);
658    if (sd->prev) evas_object_color_set(sd->prev, r, g, b, a);
659 }
660
661 static void
662 _smart_clip_set(Evas_Object *obj, Evas_Object * clip)
663 {
664    Smart_Data *sd;
665
666    sd = evas_object_smart_data_get(obj);
667    if (!sd) return;
668    evas_object_clip_set(sd->obj, clip);
669    if (sd->prev) evas_object_clip_set(sd->prev, clip);
670 }
671
672 static void
673 _smart_clip_unset(Evas_Object *obj)
674 {
675    Smart_Data *sd;
676
677    sd = evas_object_smart_data_get(obj);
678    if (!sd) return;
679    evas_object_clip_unset(sd->obj);
680    if (sd->prev) evas_object_clip_unset(sd->prev);
681 }
682
683 static void
684 _els_smart_icon_flip_horizontal(Smart_Data *sd)
685 {
686    unsigned int   *data;
687    unsigned int   *p1, *p2, tmp;
688    int             x, y, iw, ih;
689
690    evas_object_image_size_get(sd->obj, &iw, &ih);
691    data = evas_object_image_data_get(sd->obj, EINA_TRUE);
692
693    for (y = 0; y < ih; y++)
694      {
695         p1 = data + (y * iw);
696         p2 = data + ((y + 1) * iw) - 1;
697         for (x = 0; x < (iw >> 1); x++)
698           {
699              tmp = *p1;
700              *p1 = *p2;
701              *p2 = tmp;
702              p1++;
703              p2--;
704           }
705      }
706
707    evas_object_image_data_set(sd->obj, data);
708    evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih);
709    _smart_reconfigure(sd);
710 }
711
712 static void
713 _els_smart_icon_flip_vertical(Smart_Data *sd)
714 {
715    unsigned int   *data;
716    unsigned int   *p1, *p2, tmp;
717    int             x, y, iw, ih;
718
719    evas_object_image_size_get(sd->obj, &iw, &ih);
720    data = evas_object_image_data_get(sd->obj, EINA_TRUE);
721
722    for (y = 0; y < (ih >> 1); y++)
723      {
724         p1 = data + (y * iw);
725         p2 = data + ((ih - 1 - y) * iw);
726         for (x = 0; x < iw; x++)
727           {
728              tmp = *p1;
729              *p1 = *p2;
730              *p2 = tmp;
731              p1++;
732              p2++;
733           }
734      }
735
736    evas_object_image_data_set(sd->obj, data);
737    evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih);
738    _smart_reconfigure(sd);
739 }
740
741 static void
742 _els_smart_icon_rotate_180(Smart_Data *sd)
743 {
744    unsigned int   *data;
745    unsigned int   *p1, *p2, tmp;
746    int             x, hw, iw, ih;
747
748    evas_object_image_size_get(sd->obj, &iw, &ih);
749    data = evas_object_image_data_get(sd->obj, 1);
750
751    hw = iw * ih;
752    x = (hw / 2);
753    p1 = data;
754    p2 = data + hw - 1;
755    for (; --x > 0;)
756      {
757         tmp = *p1;
758         *p1 = *p2;
759         *p2 = tmp;
760         p1++;
761         p2--;
762      }
763    evas_object_image_data_set(sd->obj, data);
764    evas_object_image_data_update_add(sd->obj, 0, 0, iw, ih);
765    _smart_reconfigure(sd);
766 }
767
768 static Eina_Bool
769 _els_smart_icon_dropcb(void *elmobj,Evas_Object *obj, Elm_Selection_Data *drop)
770 {
771    _els_smart_icon_file_key_set(obj, drop->data, NULL);
772    evas_object_smart_callback_call(elmobj, "drop", drop->data);
773
774    return EINA_TRUE;
775 }
776 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/