1 #include <Elementary.h>
7 #define NON_EXISTING (void *)-1
8 static const char *icon_theme = NULL;
11 typedef struct _Widget_Data Widget_Data;
17 Elm_Icon_Lookup_Order lookup_order;
19 #ifdef HAVE_ELEMENTARY_ETHUMB
28 Ecore_Event_Handler *eeh;
30 Ethumb_Thumb_Format format;
32 Ethumb_Client_Async *request;
46 Eina_Bool scale_up : 1;
47 Eina_Bool scale_down : 1;
49 Eina_Bool fill_outside : 1;
50 Eina_Bool no_scale : 1;
52 /* for animation feature */
61 #ifdef HAVE_ELEMENTARY_ETHUMB
62 static Eina_List *_elm_icon_retry = NULL;
63 static int _icon_pending_request = 0;
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 < 16) ? 16 : size;
107 #ifdef HAVE_ELEMENTARY_ETHUMB
109 _icon_thumb_stop(Widget_Data *wd, void *ethumbd)
111 if (wd->thumb.request)
113 ethumb_client_thumb_async_cancel(ethumbd, wd->thumb.request);
114 wd->thumb.request = NULL;
115 _icon_pending_request--;
120 _elm_icon_retry = eina_list_remove(_elm_icon_retry, wd);
121 wd->thumb.retry = EINA_FALSE;
126 _icon_thumb_display(Widget_Data *wd)
128 Eina_Bool ret = EINA_FALSE;
130 if (wd->thumb.format == ETHUMB_THUMB_EET)
132 static const char *extensions[] = {
133 ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL
135 const char **ext, *ptr;
137 Eina_Bool video = EINA_FALSE;
139 prefix_size = eina_stringshare_strlen(wd->thumb.file.path) - 4;
140 if (prefix_size >= 0)
142 ptr = wd->thumb.file.path + prefix_size;
143 for (ext = extensions; *ext; ++ext)
144 if (!strcasecmp(ptr, *ext))
152 ret = _els_smart_icon_file_edje_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key);
156 ret = _els_smart_icon_file_key_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key);
162 _icon_thumb_retry(Widget_Data *wd)
164 return _icon_thumb_display(wd);
168 _icon_thumb_cleanup(Ethumb_Client *ethumbd)
173 EINA_LIST_FOREACH_SAFE(_elm_icon_retry, l, ll, wd)
174 if (_icon_thumb_retry(wd))
176 _elm_icon_retry = eina_list_remove_list(_elm_icon_retry, l);
177 wd->thumb.retry = EINA_FALSE;
180 if (_icon_pending_request == 0)
181 EINA_LIST_FREE(_elm_icon_retry, wd)
182 _icon_thumb_stop(wd, ethumbd);
186 _icon_thumb_finish(Widget_Data *wd, Ethumb_Client *ethumbd)
188 const char *file = NULL, *group = NULL;
191 _els_smart_icon_file_get(wd->img, &file, &group);
192 file = eina_stringshare_ref(file);
193 group = eina_stringshare_ref(group);
195 ret = _icon_thumb_display(wd);
201 if (!wd->thumb.retry)
203 _elm_icon_retry = eina_list_append(_elm_icon_retry, wd);
204 wd->thumb.retry = EINA_TRUE;
207 /* Back to previous image */
208 if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
209 _els_smart_icon_file_edje_set(wd->img, file, group);
211 _els_smart_icon_file_key_set(wd->img, file, group);
214 _icon_thumb_cleanup(ethumbd);
216 eina_stringshare_del(file);
217 eina_stringshare_del(group);
221 _icon_thumb_done(Ethumb_Client *client, const char *thumb_path, const char *thumb_key, void *data)
223 Widget_Data *wd = data;
225 assert(wd->thumb.request);
227 _icon_pending_request--;
228 wd->thumb.request = NULL;
230 eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path);
231 eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key);
232 wd->thumb.format = ethumb_client_format_get(client);
234 _icon_thumb_finish(wd, client);
238 _icon_thumb_error(Ethumb_Client *client, void *data)
240 Widget_Data *wd = data;
242 assert(wd->thumb.request);
244 _icon_pending_request--;
245 wd->thumb.request = NULL;
247 ERR("could not generate thumbnail for %s (key: %s)", wd->thumb.file.path, wd->thumb.file.key);
248 _icon_thumb_cleanup(client);
252 _icon_thumb_apply(Widget_Data *wd)
254 Ethumb_Client *ethumbd;
256 ethumbd = elm_thumb_ethumb_client_get();
258 _icon_thumb_stop(wd, ethumbd);
260 if (!wd->thumb.file.path) return ;
262 _icon_pending_request++;
263 if (!ethumb_client_file_set(ethumbd, wd->thumb.file.path, wd->thumb.file.key)) return ;
264 ethumb_client_size_set(ethumbd, _icon_size_min_get(wd->img), _icon_size_min_get(wd->img));
265 wd->thumb.request = ethumb_client_thumb_async_get(ethumbd, _icon_thumb_done, _icon_thumb_error, wd);
269 _icon_thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__)
271 Widget_Data *wd = data;
273 _icon_thumb_apply(wd);
274 return ECORE_CALLBACK_RENEW;
279 _del_hook(Evas_Object *obj)
281 Widget_Data *wd = elm_widget_data_get(obj);
282 #ifdef HAVE_ELEMENTARY_ETHUMB
283 Ethumb_Client *ethumbd;
287 if (wd->stdicon) eina_stringshare_del(wd->stdicon);
289 #ifdef HAVE_ELEMENTARY_ETHUMB
290 ethumbd = elm_thumb_ethumb_client_get();
291 _icon_thumb_stop(wd, ethumbd);
293 eina_stringshare_del(wd->thumb.file.path);
294 eina_stringshare_del(wd->thumb.file.key);
295 eina_stringshare_del(wd->thumb.thumb.path);
296 eina_stringshare_del(wd->thumb.thumb.key);
299 ecore_event_handler_del(wd->thumb.eeh);
303 ecore_timer_del(wd->timer);
308 _theme_hook(Evas_Object *obj)
310 Widget_Data *wd = elm_widget_data_get(obj);
313 _elm_theme_object_icon_set(obj, wd->img, wd->stdicon, elm_widget_style_get(obj));
318 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
320 Widget_Data *wd = elm_widget_data_get(obj);
322 Evas_Object *icon_edje;
323 icon_edje = _els_smart_icon_edje_get(wd->img);
324 if (!icon_edje) return;
325 edje_object_signal_emit(icon_edje, emission, source);
329 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
331 Widget_Data *wd = elm_widget_data_get(obj);
333 Evas_Object *icon_edje;
334 icon_edje = _els_smart_icon_edje_get(wd->img);
335 if (!icon_edje) return;
336 edje_object_signal_callback_add(icon_edje, emission, source, func_cb, data);
340 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
342 Widget_Data *wd = elm_widget_data_get(obj);
344 Evas_Object *icon_edje;
345 icon_edje = _els_smart_icon_edje_get(wd->img);
346 if (!icon_edje) return;
347 edje_object_signal_callback_del_full(icon_edje, emission, source, func_cb,
352 _sizing_eval(Evas_Object *obj)
354 Widget_Data *wd = elm_widget_data_get(obj);
356 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
360 _els_smart_icon_size_get(wd->img, &w, &h);
362 if (wd->freedesktop.use && wd->stdicon)
365 /* This icon has been set to a freedesktop icon, and the requested
366 appears to have a different size than the requested size, so try to
367 request another, higher resolution, icon.
368 FIXME: Find a better heuristic to determine if there should be
369 an icon with a different resolution. */
370 size = ((w / 16) + 1) * 16;
371 _icon_freedesktop_set(wd, obj, wd->stdicon, size);
374 _els_smart_icon_scale_up_set(wd->img, wd->scale_up);
375 _els_smart_icon_scale_down_set(wd->img, wd->scale_down);
376 _els_smart_icon_smooth_scale_set(wd->img, wd->smooth);
377 _els_smart_icon_fill_inside_set(wd->img, !(wd->fill_outside));
379 evas_object_size_hint_min_get(obj, &minw, &minh);
381 if (wd->no_scale) _els_smart_icon_scale_set(wd->img, 1.0);
384 _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) *
386 _els_smart_icon_size_get(wd->img, &w, &h);
398 evas_object_size_hint_min_set(obj, minw, minh);
399 evas_object_size_hint_max_set(obj, maxw, maxh);
404 _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
406 Evas_Event_Mouse_Up *ev = event_info;
407 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
408 evas_object_smart_callback_call(data, SIG_CLICKED, event_info);
412 _elm_icon_animate_cb(void *data)
414 Widget_Data *wd = data;
415 Evas_Object *img_obj;
417 if (!wd) return ECORE_CALLBACK_CANCEL;
418 if (!wd->anim) return ECORE_CALLBACK_CANCEL;
420 img_obj = _els_smart_icon_object_get(wd->img);
422 if (wd->cur_frame > wd->frame_count)
423 wd->cur_frame = wd->cur_frame % wd->frame_count;
424 evas_object_image_animated_frame_set(img_obj, wd->cur_frame);
426 wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0);
428 if (wd->duration > 0)
429 ecore_timer_interval_set(wd->timer, wd->duration);
430 return ECORE_CALLBACK_RENEW;
434 _icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name)
436 if (_elm_theme_object_icon_set(obj, wd->img, name, "default"))
439 /* TODO: elm_unneed_efreet() */
440 wd->freedesktop.use = EINA_FALSE;
449 _icon_file_set(Widget_Data *wd, Evas_Object *obj, const char *path)
451 _icon_file_set(Widget_Data *wd __UNUSED__, Evas_Object *obj, const char *path)
454 if (elm_icon_file_set(obj, path, NULL))
457 /* TODO: elm_unneed_efreet() */
458 wd->freedesktop.use = EINA_FALSE;
467 _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size)
469 _icon_freedesktop_set(Widget_Data *wd __UNUSED__, Evas_Object *obj __UNUSED__, const char *name __UNUSED__, int size __UNUSED__)
476 if (icon_theme == NON_EXISTING) return EINA_FALSE;
479 Efreet_Icon_Theme *theme;
480 /* TODO: Listen for EFREET_EVENT_ICON_CACHE_UPDATE */
481 theme = efreet_icon_theme_find(getenv("E_ICON_THEME"));
485 static const char *themes[] = {
486 "gnome", "Human", "oxygen", "hicolor", NULL
488 for (itr = themes; *itr; itr++)
490 theme = efreet_icon_theme_find(*itr);
497 icon_theme = NON_EXISTING;
501 icon_theme = eina_stringshare_add(theme->name.internal);
503 path = efreet_icon_path_find(icon_theme, name, size);
504 wd->freedesktop.use = !!path;
505 if (wd->freedesktop.use)
507 wd->freedesktop.requested_size = size;
508 elm_icon_file_set(obj, path, NULL);
516 _elm_icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name, Eina_Bool *fdo)
521 /* try locating the icon using the specified lookup order */
522 switch (wd->lookup_order)
524 case ELM_ICON_LOOKUP_FDO:
525 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
526 if (ret && fdo) *fdo = EINA_TRUE;
528 case ELM_ICON_LOOKUP_THEME:
529 ret = _icon_standard_set(wd, obj, name);
531 case ELM_ICON_LOOKUP_THEME_FDO:
532 ret = _icon_standard_set(wd, obj, name);
535 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
536 if (ret && fdo) *fdo = EINA_TRUE;
539 case ELM_ICON_LOOKUP_FDO_THEME:
541 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
543 ret = _icon_standard_set(wd, obj, name);
551 eina_stringshare_replace(&wd->stdicon, name);
552 if (!wd->in_eval) _sizing_eval(obj);
556 if (_path_is_absolute(name))
557 return _icon_file_set(wd, obj, name);
559 /* if that fails, see if icon name is in the format size/name. if so,
560 try locating a fallback without the size specification */
561 if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
563 if (*tmp) return elm_icon_standard_set(obj, tmp);
569 _elm_icon_standard_resize(void *data,
572 void *event_info __UNUSED__)
574 Widget_Data *wd = data;
575 const char *refup = eina_stringshare_ref(wd->stdicon);
576 Eina_Bool fdo = EINA_FALSE;
578 if (!_elm_icon_standard_set(wd, obj, wd->stdicon, &fdo) || (!fdo))
579 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
580 _elm_icon_standard_resize, wd);
581 eina_stringshare_del(refup);
584 #ifdef HAVE_ELEMENTARY_ETHUMB
586 _elm_icon_thumb_resize(void *data,
589 void *event_info __UNUSED__)
591 Widget_Data *wd = data;
593 if (wd->thumb.file.path)
594 elm_icon_thumb_set(obj, wd->thumb.file.path, wd->thumb.file.key);
599 elm_icon_add(Evas_Object *parent)
605 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
607 ELM_SET_WIDTYPE(widtype, "icon");
608 elm_widget_type_set(obj, "icon");
609 elm_widget_can_focus_set(obj, EINA_FALSE);
610 elm_widget_sub_object_add(parent, obj);
611 elm_widget_data_set(obj, wd);
612 elm_widget_del_hook_set(obj, _del_hook);
613 elm_widget_theme_hook_set(obj, _theme_hook);
614 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
615 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
616 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
618 wd->lookup_order = ELM_ICON_LOOKUP_THEME_FDO;
619 wd->img = _els_smart_icon_add(e);
620 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
622 evas_object_repeat_events_set(wd->img, EINA_TRUE);
623 elm_widget_resize_object_set(obj, wd->img);
625 evas_object_smart_callbacks_descriptions_set(obj, _signals);
627 #ifdef HAVE_ELEMENTARY_ETHUMB
628 wd->thumb.request = NULL;
631 wd->smooth = EINA_TRUE;
632 wd->scale_up = EINA_TRUE;
633 wd->scale_down = EINA_TRUE;
640 elm_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key)
642 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
643 Widget_Data *wd = elm_widget_data_get(obj);
646 if (!wd) return EINA_FALSE;
647 EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
648 EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE);
649 eina_stringshare_del(wd->stdicon);
651 ret = _els_smart_icon_memfile_set(wd->img, img, size, format, key);
652 if (!wd->in_eval) _sizing_eval(obj);
657 elm_icon_file_set(Evas_Object *obj, const char *file, const char *group)
659 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
660 Widget_Data *wd = elm_widget_data_get(obj);
663 if (!wd) return EINA_FALSE;
664 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
667 if (!wd->freedesktop.use)
669 if (wd->stdicon) eina_stringshare_del(wd->stdicon);
673 if (eina_str_has_extension(file, ".edj"))
674 ret = _els_smart_icon_file_edje_set(wd->img, file, group);
676 ret = _els_smart_icon_file_key_set(wd->img, file, group);
677 if (!wd->in_eval) _sizing_eval(obj);
682 elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group)
684 ELM_CHECK_WIDTYPE(obj, widtype);
685 Widget_Data *wd = elm_widget_data_get(obj);
687 _els_smart_icon_file_get(wd->img, file, group);
691 elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group)
693 ELM_CHECK_WIDTYPE(obj, widtype);
694 Widget_Data *wd = elm_widget_data_get(obj);
697 #ifdef HAVE_ELEMENTARY_ETHUMB
698 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
699 _elm_icon_standard_resize, wd);
700 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
701 _elm_icon_thumb_resize, wd);
703 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
704 _elm_icon_thumb_resize, wd);
706 eina_stringshare_replace(&wd->thumb.file.path, file);
707 eina_stringshare_replace(&wd->thumb.file.key, group);
709 if (elm_thumb_ethumb_client_connected_get())
711 _icon_thumb_apply(wd);
717 wd->thumb.eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, _icon_thumb_apply_cb, wd);
728 elm_icon_animated_available_get(const Evas_Object *obj)
730 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
731 Evas_Object *img_obj ;
732 Widget_Data *wd = elm_widget_data_get(obj);
733 if (!wd) return EINA_FALSE;
735 img_obj = _els_smart_icon_object_get(wd->img);
737 return evas_object_image_animated_get(img_obj);
741 elm_icon_animated_set(Evas_Object *obj, Eina_Bool anim)
743 ELM_CHECK_WIDTYPE(obj, widtype);
744 Evas_Object *img_obj ;
745 Widget_Data *wd = elm_widget_data_get(obj);
747 if (wd->anim == anim) return;
749 img_obj = _els_smart_icon_object_get(wd->img);
750 if (!evas_object_image_animated_get(img_obj)) return;
753 wd->frame_count = evas_object_image_animated_frame_count_get(img_obj);
755 wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0);
756 evas_object_image_animated_frame_set(img_obj, wd->cur_frame);
760 wd->frame_count = -1;
769 elm_icon_animated_get(const Evas_Object *obj)
771 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
772 Widget_Data *wd = elm_widget_data_get(obj);
773 if (!wd) return EINA_FALSE;
778 elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play)
780 ELM_CHECK_WIDTYPE(obj, widtype);
781 Widget_Data *wd = elm_widget_data_get(obj);
783 if (!wd->anim) return;
784 if (wd->play == play) return;
788 wd->timer = ecore_timer_add(wd->duration, _elm_icon_animate_cb, wd);
794 ecore_timer_del(wd->timer);
803 elm_icon_animated_play_get(const Evas_Object *obj)
805 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
806 Widget_Data *wd = elm_widget_data_get(obj);
807 if (!wd) return EINA_FALSE;
812 elm_icon_standard_set(Evas_Object *obj, const char *name)
814 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
815 Widget_Data *wd = elm_widget_data_get(obj);
816 Eina_Bool fdo = EINA_FALSE;
819 if ((!wd) || (!name)) return EINA_FALSE;
821 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
822 _elm_icon_standard_resize, wd);
824 ret = _elm_icon_standard_set(wd, obj, name, &fdo);
827 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
828 _elm_icon_standard_resize, wd);
834 elm_icon_standard_get(const Evas_Object *obj)
836 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
837 Widget_Data *wd = elm_widget_data_get(obj);
838 if (!wd) return NULL;
843 elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order)
845 ELM_CHECK_WIDTYPE(obj, widtype);
846 Widget_Data *wd = elm_widget_data_get(obj);
847 if (wd) wd->lookup_order = order;
850 EAPI Elm_Icon_Lookup_Order
851 elm_icon_order_lookup_get(const Evas_Object *obj)
853 ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO;
854 Widget_Data *wd = elm_widget_data_get(obj);
855 if (!wd) return ELM_ICON_LOOKUP_THEME_FDO;
856 return wd->lookup_order;
860 elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth)
862 ELM_CHECK_WIDTYPE(obj, widtype);
863 Widget_Data *wd = elm_widget_data_get(obj);
867 if (!wd->in_eval) _sizing_eval(obj);
871 elm_icon_smooth_get(const Evas_Object *obj)
873 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
874 Widget_Data *wd = elm_widget_data_get(obj);
876 if (!wd) return EINA_FALSE;
881 elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale)
883 ELM_CHECK_WIDTYPE(obj, widtype);
884 Widget_Data *wd = elm_widget_data_get(obj);
887 wd->no_scale = no_scale;
888 if (!wd->in_eval) _sizing_eval(obj);
892 elm_icon_no_scale_get(const Evas_Object *obj)
894 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
895 Widget_Data *wd = elm_widget_data_get(obj);
896 if (!wd) return EINA_FALSE;
901 elm_icon_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down)
903 ELM_CHECK_WIDTYPE(obj, widtype);
904 Widget_Data *wd = elm_widget_data_get(obj);
907 wd->scale_up = size_up;
908 wd->scale_down = size_down;
909 if (!wd->in_eval) _sizing_eval(obj);
913 elm_icon_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down)
915 ELM_CHECK_WIDTYPE(obj, widtype);
916 Widget_Data *wd = elm_widget_data_get(obj);
918 if (size_up) *size_up = wd->scale_up;
919 if (size_down) *size_down = wd->scale_down;
923 elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside)
925 ELM_CHECK_WIDTYPE(obj, widtype);
926 Widget_Data *wd = elm_widget_data_get(obj);
929 wd->fill_outside = fill_outside;
930 if (!wd->in_eval) _sizing_eval(obj);
934 elm_icon_size_get(const Evas_Object *obj, int *w, int *h)
936 ELM_CHECK_WIDTYPE(obj, widtype);
937 Widget_Data *wd = elm_widget_data_get(obj);
940 _els_smart_icon_size_get(wd->img, w, h);
944 elm_icon_fill_outside_get(const Evas_Object *obj)
946 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
947 Widget_Data *wd = elm_widget_data_get(obj);
949 if (!wd) return EINA_FALSE;
950 return wd->fill_outside;
954 elm_icon_prescale_set(Evas_Object *obj, int size)
956 ELM_CHECK_WIDTYPE(obj, widtype);
957 Widget_Data *wd = elm_widget_data_get(obj);
960 _els_smart_icon_scale_size_set(wd->img, size);
964 elm_icon_prescale_get(const Evas_Object *obj)
966 ELM_CHECK_WIDTYPE(obj, widtype) 0;
967 Widget_Data *wd = elm_widget_data_get(obj);
970 return _els_smart_icon_scale_size_get(wd->img);
974 elm_icon_object_get(Evas_Object *obj)
976 ELM_CHECK_WIDTYPE(obj, widtype) 0;
977 Widget_Data *wd = elm_widget_data_get(obj);
979 if (!wd) return NULL;
980 return _els_smart_icon_object_get(wd->img);
984 elm_icon_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled)
986 ELM_CHECK_WIDTYPE(obj, widtype);
987 Widget_Data *wd = elm_widget_data_get(obj);
990 _els_smart_icon_preload_set(wd->img, !!disabled);
994 elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
996 ELM_CHECK_WIDTYPE(obj, widtype);
997 Widget_Data *wd = elm_widget_data_get(obj);
999 _els_smart_icon_aspect_fixed_set(wd->img, fixed);
1003 elm_icon_aspect_fixed_get(const Evas_Object *obj)
1005 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1006 Widget_Data *wd = elm_widget_data_get(obj);
1007 if (!wd) return EINA_FALSE;
1008 return _els_smart_icon_aspect_fixed_get(wd->img);