1 #include <Elementary.h>
6 #define NON_EXISTING (void *)-1
7 static const char *icon_theme = NULL;
10 typedef struct _Widget_Data Widget_Data;
16 Elm_Icon_Lookup_Order lookup_order;
18 #ifdef HAVE_ELEMENTARY_ETHUMB
27 Ethumb_Exists *exists;
29 Ecore_Event_Handler *eeh;
31 Ethumb_Thumb_Format format;
43 Eina_Bool scale_up : 1;
44 Eina_Bool scale_down : 1;
46 Eina_Bool fill_outside : 1;
47 Eina_Bool no_scale : 1;
49 /* for animation feature */
59 #ifdef HAVE_ELEMENTARY_ETHUMB
60 static Eina_List *_elm_icon_retry = NULL;
61 static int _icon_pending_request = 0;
63 static void _icon_thumb_exists(Ethumb_Client *client __UNUSED__, Ethumb_Exists *thread, Eina_Bool exists, void *data);
66 static const char *widtype = NULL;
67 static void _del_hook(Evas_Object *obj);
68 static void _theme_hook(Evas_Object *obj);
69 static void _sizing_eval(Evas_Object *obj);
70 static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
72 static Eina_Bool _icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name);
73 static Eina_Bool _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size);
75 static const char SIG_CLICKED[] = "clicked";
77 static const Evas_Smart_Cb_Description _signals[] = {
83 //FIXME: move this code to ecore
86 _path_is_absolute(const char *path)
88 //TODO: Check if this works with all absolute paths in windows
89 return ((isalpha (*path)) && (*(path + 1) == ':') && ((*(path + 2) == '\\') || (*(path + 2) == '/')));
93 _path_is_absolute(const char *path)
95 return (*path == '/');
100 _icon_size_min_get(Evas_Object *icon)
103 _els_smart_icon_size_get(icon, &size, NULL);
104 return (size < 32) ? 32 : size;
107 #ifdef HAVE_ELEMENTARY_ETHUMB
109 _icon_thumb_stop(Widget_Data *wd, void *ethumbd)
111 if (wd->thumb.id >= 0)
113 ethumb_client_generate_cancel(ethumbd, wd->thumb.id, NULL, NULL, NULL);
115 _icon_pending_request--;
118 if (wd->thumb.exists)
120 ethumb_client_thumb_exists_cancel(wd->thumb.exists, _icon_thumb_exists, wd);
121 wd->thumb.exists = NULL;
122 _icon_pending_request--;
127 _elm_icon_retry = eina_list_remove(_elm_icon_retry, wd);
128 wd->thumb.retry = EINA_FALSE;
133 _icon_thumb_display(Widget_Data *wd)
135 Eina_Bool ret = EINA_FALSE;
137 if (wd->thumb.format == ETHUMB_THUMB_EET)
139 static const char *extensions[] = {
140 ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL
142 const char **ext, *ptr;
144 Eina_Bool video = EINA_FALSE;
146 prefix_size = eina_stringshare_strlen(wd->thumb.file.path) - 4;
147 if (prefix_size >= 0)
149 ptr = wd->thumb.file.path + prefix_size;
150 for (ext = extensions; *ext; ++ext)
151 if (!strcasecmp(ptr, *ext))
159 ret = _els_smart_icon_file_edje_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key);
163 ret = _els_smart_icon_file_key_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key);
169 _icon_thumb_retry(Widget_Data *wd)
171 return _icon_thumb_display(wd);
175 _icon_thumb_cleanup(Ethumb_Client *ethumbd)
180 EINA_LIST_FOREACH_SAFE(_elm_icon_retry, l, ll, wd)
181 if (_icon_thumb_retry(wd))
183 _elm_icon_retry = eina_list_remove_list(_elm_icon_retry, l);
184 wd->thumb.retry = EINA_FALSE;
187 if (_icon_pending_request == 0)
188 EINA_LIST_FREE(_elm_icon_retry, wd)
189 _icon_thumb_stop(wd, ethumbd);
193 _icon_thumb_finish(Widget_Data *wd, Ethumb_Client *ethumbd)
195 const char *file = NULL, *group = NULL;
198 _els_smart_icon_file_get(wd->img, &file, &group);
199 file = eina_stringshare_ref(file);
200 group = eina_stringshare_ref(group);
202 ret = _icon_thumb_display(wd);
208 if (!wd->thumb.retry)
210 _elm_icon_retry = eina_list_append(_elm_icon_retry, wd);
211 wd->thumb.retry = EINA_TRUE;
214 /* Back to previous image */
215 if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
216 _els_smart_icon_file_edje_set(wd->img, file, group);
218 _els_smart_icon_file_key_set(wd->img, file, group);
221 _icon_thumb_cleanup(ethumbd);
223 eina_stringshare_del(file);
224 eina_stringshare_del(group);
228 _icon_thumb_cb(void *data,
229 Ethumb_Client *ethumbd,
231 const char *file __UNUSED__,
232 const char *key __UNUSED__,
233 const char *thumb_path,
234 const char *thumb_key,
237 Widget_Data *wd = data;
239 EINA_SAFETY_ON_FALSE_RETURN(wd->thumb.id == id);
242 _icon_pending_request--;
246 eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path);
247 eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key);
248 wd->thumb.format = ethumb_client_format_get(ethumbd);
250 _icon_thumb_finish(wd, ethumbd);
254 ERR("could not generate thumbnail for %s (key: %s)", file, key);
255 _icon_thumb_cleanup(ethumbd);
260 _icon_thumb_exists(Ethumb_Client *client __UNUSED__, Ethumb_Exists *thread, Eina_Bool exists, void *data)
262 Widget_Data *wd = data;
263 Ethumb_Client *ethumbd;
265 if (ethumb_client_thumb_exists_check(thread))
268 wd->thumb.exists = NULL;
270 ethumbd = elm_thumb_ethumb_client_get();
274 const char *thumb_path, *thumb_key;
276 _icon_pending_request--;
277 ethumb_client_thumb_path_get(ethumbd, &thumb_path, &thumb_key);
278 eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path);
279 eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key);
280 wd->thumb.format = ethumb_client_format_get(ethumbd);
282 _icon_thumb_finish(wd, ethumbd);
284 else if ((wd->thumb.id = ethumb_client_generate(ethumbd, _icon_thumb_cb, wd, NULL)) == -1)
286 ERR("Generate was unable to start !");
287 /* Failed to generate thumbnail */
288 _icon_pending_request--;
293 _icon_thumb_apply(Widget_Data *wd)
295 Ethumb_Client *ethumbd;
297 ethumbd = elm_thumb_ethumb_client_get();
299 _icon_thumb_stop(wd, ethumbd);
301 if (!wd->thumb.file.path) return ;
303 _icon_pending_request++;
304 if (!ethumb_client_file_set(ethumbd, wd->thumb.file.path, wd->thumb.file.key)) return ;
305 ethumb_client_size_set(ethumbd, _icon_size_min_get(wd->img), _icon_size_min_get(wd->img));
306 wd->thumb.exists = ethumb_client_thumb_exists(ethumbd, _icon_thumb_exists, wd);
310 _icon_thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__)
312 Widget_Data *wd = data;
314 _icon_thumb_apply(wd);
315 return ECORE_CALLBACK_RENEW;
320 _del_hook(Evas_Object *obj)
322 Widget_Data *wd = elm_widget_data_get(obj);
324 #ifdef HAVE_ELEMENTARY_ETHUMB
325 Ethumb_Client *ethumbd;
329 if (wd->stdicon) eina_stringshare_del(wd->stdicon);
331 #ifdef HAVE_ELEMENTARY_ETHUMB
332 ethumbd = elm_thumb_ethumb_client_get();
333 _icon_thumb_stop(wd, ethumbd);
335 eina_stringshare_del(wd->thumb.file.path);
336 eina_stringshare_del(wd->thumb.file.key);
337 eina_stringshare_del(wd->thumb.thumb.path);
338 eina_stringshare_del(wd->thumb.thumb.key);
341 ecore_event_handler_del(wd->thumb.eeh);
345 ecore_timer_del(wd->timer);
350 _theme_hook(Evas_Object *obj)
352 Widget_Data *wd = elm_widget_data_get(obj);
355 _elm_theme_object_icon_set(obj, wd->img, wd->stdicon, elm_widget_style_get(obj));
360 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
362 Widget_Data *wd = elm_widget_data_get(obj);
364 Evas_Object *icon_edje;
365 icon_edje = _els_smart_icon_edje_get(wd->img);
366 if (!icon_edje) return;
367 edje_object_signal_emit(icon_edje, emission, source);
371 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
373 Widget_Data *wd = elm_widget_data_get(obj);
375 Evas_Object *icon_edje;
376 icon_edje = _els_smart_icon_edje_get(wd->img);
377 if (!icon_edje) return;
378 edje_object_signal_callback_add(icon_edje, emission, source, func_cb, data);
382 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
384 Widget_Data *wd = elm_widget_data_get(obj);
386 Evas_Object *icon_edje;
387 icon_edje = _els_smart_icon_edje_get(wd->img);
388 if (!icon_edje) return;
389 edje_object_signal_callback_del_full(icon_edje, emission, source, func_cb,
394 _sizing_eval(Evas_Object *obj)
396 Widget_Data *wd = elm_widget_data_get(obj);
398 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
401 _els_smart_icon_size_get(wd->img, &w, &h);
403 if ((wd->freedesktop.use) && (!((w - wd->freedesktop.requested_size) % 16)))
405 /* This icon has been set to a freedesktop icon, and the requested
406 appears to have a different size than the requested size, so try to
407 request another, higher resolution, icon.
408 FIXME: Find a better heuristic to determine if there should be
409 an icon with a different resolution. */
410 _icon_freedesktop_set(wd, obj, wd->stdicon, w);
413 _els_smart_icon_scale_up_set(wd->img, wd->scale_up);
414 _els_smart_icon_scale_down_set(wd->img, wd->scale_down);
415 _els_smart_icon_smooth_scale_set(wd->img, wd->smooth);
416 _els_smart_icon_fill_inside_set(wd->img, !(wd->fill_outside));
417 if (wd->no_scale) _els_smart_icon_scale_set(wd->img, 1.0);
420 _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) *
422 _els_smart_icon_size_get(wd->img, &w, &h);
434 evas_object_size_hint_min_set(obj, minw, minh);
435 evas_object_size_hint_max_set(obj, maxw, maxh);
439 _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
441 Evas_Event_Mouse_Up *ev = event_info;
442 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
443 evas_object_smart_callback_call(data, SIG_CLICKED, event_info);
447 _elm_icon_animate_cb(void *data)
449 Widget_Data *wd = data;
450 Evas_Object *img_obj;
452 if (!wd) return ECORE_CALLBACK_CANCEL;
453 if (!wd->anim) return ECORE_CALLBACK_CANCEL;
455 img_obj = _els_smart_icon_object_get(wd->img);
457 if (wd->cur_frame > wd->frame_count)
458 wd->cur_frame = wd->cur_frame % wd->frame_count;
459 evas_object_image_animated_frame_set(img_obj, wd->cur_frame);
461 wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0);
463 if (wd->duration > 0)
464 ecore_timer_interval_set(wd->timer, wd->duration);
465 return ECORE_CALLBACK_RENEW;
469 elm_icon_add(Evas_Object *parent)
475 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
477 ELM_SET_WIDTYPE(widtype, "icon");
478 elm_widget_type_set(obj, "icon");
479 elm_widget_can_focus_set(obj, EINA_FALSE);
480 elm_widget_sub_object_add(parent, obj);
481 elm_widget_data_set(obj, wd);
482 elm_widget_del_hook_set(obj, _del_hook);
483 elm_widget_theme_hook_set(obj, _theme_hook);
484 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
485 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
486 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
488 wd->lookup_order = ELM_ICON_LOOKUP_THEME_FDO;
489 wd->img = _els_smart_icon_add(e);
490 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
492 evas_object_repeat_events_set(wd->img, EINA_TRUE);
493 elm_widget_resize_object_set(obj, wd->img);
495 evas_object_smart_callbacks_descriptions_set(obj, _signals);
497 #ifdef HAVE_ELEMENTARY_ETHUMB
501 wd->smooth = EINA_TRUE;
502 wd->scale_up = EINA_TRUE;
503 wd->scale_down = EINA_TRUE;
510 elm_icon_file_set(Evas_Object *obj, const char *file, const char *group)
512 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
513 Widget_Data *wd = elm_widget_data_get(obj);
517 if (!wd) return EINA_FALSE;
518 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
519 if (wd->stdicon) eina_stringshare_del(wd->stdicon);
521 if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
522 ret = _els_smart_icon_file_edje_set(wd->img, file, group);
524 ret = _els_smart_icon_file_key_set(wd->img, file, group);
530 elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group)
532 ELM_CHECK_WIDTYPE(obj, widtype);
533 Widget_Data *wd = elm_widget_data_get(obj);
535 _els_smart_icon_file_get(wd->img, file, group);
539 elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group)
541 ELM_CHECK_WIDTYPE(obj, widtype);
542 Widget_Data *wd = elm_widget_data_get(obj);
545 #ifdef HAVE_ELEMENTARY_ETHUMB
546 eina_stringshare_replace(&wd->thumb.file.path, file);
547 eina_stringshare_replace(&wd->thumb.file.key, group);
549 if (elm_thumb_ethumb_client_connected())
551 _icon_thumb_apply(wd);
557 wd->thumb.eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, _icon_thumb_apply_cb, wd);
567 elm_icon_animated_available_get(const Evas_Object *obj)
569 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
570 Evas_Object *img_obj ;
571 Widget_Data *wd = elm_widget_data_get(obj);
572 if (!wd) return EINA_FALSE;
574 img_obj = _els_smart_icon_object_get(wd->img);
576 return evas_object_image_animated_get(img_obj);
580 elm_icon_animated_set(Evas_Object *obj, Eina_Bool anim)
582 ELM_CHECK_WIDTYPE(obj, widtype);
583 Evas_Object *img_obj ;
584 Widget_Data *wd = elm_widget_data_get(obj);
586 if (wd->anim == anim) return;
588 img_obj = _els_smart_icon_object_get(wd->img);
589 if (!evas_object_image_animated_get(img_obj)) return;
592 wd->frame_count = evas_object_image_animated_frame_count_get(img_obj);
594 wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0);
595 evas_object_image_animated_frame_set(img_obj, wd->cur_frame);
599 wd->frame_count = -1;
608 elm_icon_animated_get(const Evas_Object *obj)
610 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
611 Widget_Data *wd = elm_widget_data_get(obj);
612 if (!wd) return EINA_FALSE;
617 elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play)
619 ELM_CHECK_WIDTYPE(obj, widtype);
620 Widget_Data *wd = elm_widget_data_get(obj);
622 if (!wd->anim) return;
623 if (wd->play == play) return;
627 wd->timer = ecore_timer_add(wd->duration, _elm_icon_animate_cb, wd);
633 ecore_timer_del(wd->timer);
642 elm_icon_animated_play_get(const Evas_Object *obj)
644 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
645 Widget_Data *wd = elm_widget_data_get(obj);
646 if (!wd) return EINA_FALSE;
650 /* compatibility code to prevent ABI break */
652 elm_icon_anim_available_get(const Evas_Object *obj)
654 return elm_icon_animated_available_get(obj);
658 elm_icon_anim_set(Evas_Object *obj, Eina_Bool anim)
660 elm_icon_animated_set(obj, anim);
664 elm_icon_anim_get(const Evas_Object *obj)
666 return elm_icon_animated_get(obj);
670 elm_icon_anim_play_set(Evas_Object *obj, Eina_Bool play)
672 elm_icon_animated_play_set(obj, play);
676 elm_icon_anim_play_get(const Evas_Object *obj)
678 return elm_icon_animated_play_get(obj);
682 _icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name)
684 if (_elm_theme_object_icon_set(obj, wd->img, name, "default"))
687 /* TODO: elm_unneed_efreet() */
688 wd->freedesktop.use = EINA_FALSE;
696 _icon_file_set(Widget_Data *wd, Evas_Object *obj, const char *path)
698 if (elm_icon_file_set(obj, path, NULL))
701 /* TODO: elm_unneed_efreet() */
702 wd->freedesktop.use = EINA_FALSE;
710 _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size)
716 if (icon_theme == NON_EXISTING) return EINA_FALSE;
719 Efreet_Icon_Theme *theme;
720 /* TODO: Listen for EFREET_EVENT_ICON_CACHE_UPDATE */
721 theme = efreet_icon_theme_find(getenv("E_ICON_THEME"));
725 static const char *themes[] = {
726 "gnome", "Human", "oxygen", "hicolor", NULL
728 for (itr = themes; *itr; itr++)
730 theme = efreet_icon_theme_find(*itr);
737 icon_theme = NON_EXISTING;
741 icon_theme = eina_stringshare_add(theme->name.internal);
743 path = efreet_icon_path_find(icon_theme, name, size);
744 wd->freedesktop.use = !!path;
745 if (wd->freedesktop.use)
747 wd->freedesktop.requested_size = size;
748 elm_icon_file_set(obj, path, NULL);
756 _elm_icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name, Eina_Bool *fdo)
761 /* try locating the icon using the specified lookup order */
762 switch (wd->lookup_order)
764 case ELM_ICON_LOOKUP_FDO:
765 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
766 if (ret && fdo) *fdo = EINA_TRUE;
768 case ELM_ICON_LOOKUP_THEME:
769 ret = _icon_standard_set(wd, obj, name);
771 case ELM_ICON_LOOKUP_THEME_FDO:
772 ret = _icon_standard_set(wd, obj, name);
775 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
776 if (ret && fdo) *fdo = EINA_TRUE;
779 case ELM_ICON_LOOKUP_FDO_THEME:
781 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
783 ret = _icon_standard_set(wd, obj, name);
791 eina_stringshare_replace(&wd->stdicon, name);
796 if (_path_is_absolute(name))
797 return _icon_file_set(wd, obj, name);
799 /* if that fails, see if icon name is in the format size/name. if so,
800 try locating a fallback without the size specification */
801 if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
803 if (*tmp) return elm_icon_standard_set(obj, tmp);
809 _elm_icon_standard_resize(void *data,
812 void *event_info __UNUSED__)
814 Widget_Data *wd = data;
815 const char *refup = eina_stringshare_ref(wd->stdicon);
816 Eina_Bool fdo = EINA_FALSE;
818 if (!_elm_icon_standard_set(wd, obj, wd->stdicon, &fdo) || (!fdo))
819 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
820 _elm_icon_standard_resize, wd);
821 #ifdef HAVE_ELEMENTARY_ETHUMB
822 if (wd->thumb.file.path)
823 elm_icon_thumb_set(obj, wd->thumb.file.path, wd->thumb.file.key);
826 eina_stringshare_del(refup);
830 elm_icon_standard_set(Evas_Object *obj, const char *name)
832 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
833 Widget_Data *wd = elm_widget_data_get(obj);
834 Eina_Bool fdo = EINA_FALSE;
837 if ((!wd) || (!name)) return EINA_FALSE;
839 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
840 _elm_icon_standard_resize, wd);
842 ret = _elm_icon_standard_set(wd, obj, name, &fdo);
845 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
846 _elm_icon_standard_resize, wd);
852 elm_icon_standard_get(const Evas_Object *obj)
854 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
855 Widget_Data *wd = elm_widget_data_get(obj);
856 if (!wd) return NULL;
861 elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order)
863 ELM_CHECK_WIDTYPE(obj, widtype);
864 Widget_Data *wd = elm_widget_data_get(obj);
865 if (wd) wd->lookup_order = order;
868 EAPI Elm_Icon_Lookup_Order
869 elm_icon_order_lookup_get(const Evas_Object *obj)
871 ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO;
872 Widget_Data *wd = elm_widget_data_get(obj);
873 if (!wd) return ELM_ICON_LOOKUP_THEME_FDO;
874 return wd->lookup_order;
878 elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth)
880 ELM_CHECK_WIDTYPE(obj, widtype);
881 Widget_Data *wd = elm_widget_data_get(obj);
889 elm_icon_smooth_get(const Evas_Object *obj)
891 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
892 Widget_Data *wd = elm_widget_data_get(obj);
894 if (!wd) return EINA_FALSE;
899 elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale)
901 ELM_CHECK_WIDTYPE(obj, widtype);
902 Widget_Data *wd = elm_widget_data_get(obj);
905 wd->no_scale = no_scale;
910 elm_icon_no_scale_get(const Evas_Object *obj)
912 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
913 Widget_Data *wd = elm_widget_data_get(obj);
914 if (!wd) return EINA_FALSE;
919 elm_icon_scale_set(Evas_Object *obj, Eina_Bool scale_up, Eina_Bool scale_down)
921 ELM_CHECK_WIDTYPE(obj, widtype);
922 Widget_Data *wd = elm_widget_data_get(obj);
925 wd->scale_up = scale_up;
926 wd->scale_down = scale_down;
931 elm_icon_scale_get(const Evas_Object *obj, Eina_Bool *scale_up, Eina_Bool *scale_down)
933 ELM_CHECK_WIDTYPE(obj, widtype);
934 Widget_Data *wd = elm_widget_data_get(obj);
936 if (scale_up) *scale_up = wd->scale_up;
937 if (scale_down) *scale_down = wd->scale_down;
941 elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside)
943 ELM_CHECK_WIDTYPE(obj, widtype);
944 Widget_Data *wd = elm_widget_data_get(obj);
947 wd->fill_outside = fill_outside;
952 elm_icon_fill_outside_get(const Evas_Object *obj)
954 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
955 Widget_Data *wd = elm_widget_data_get(obj);
957 if (!wd) return EINA_FALSE;
958 return wd->fill_outside;
962 elm_icon_prescale_set(Evas_Object *obj, int size)
964 ELM_CHECK_WIDTYPE(obj, widtype);
965 Widget_Data *wd = elm_widget_data_get(obj);
968 _els_smart_icon_scale_size_set(wd->img, size);
972 elm_icon_prescale_get(const Evas_Object *obj)
974 ELM_CHECK_WIDTYPE(obj, widtype) 0;
975 Widget_Data *wd = elm_widget_data_get(obj);
978 return _els_smart_icon_scale_size_get(wd->img);