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