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
26 Ecore_Event_Handler *eeh;
28 Ethumb_Thumb_Format format;
30 Ethumb_Client_Async *request;
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 */
58 #ifdef HAVE_ELEMENTARY_ETHUMB
59 static Eina_List *_elm_icon_retry = NULL;
60 static int _icon_pending_request = 0;
63 static const char *widtype = NULL;
64 static void _del_hook(Evas_Object *obj);
65 static void _theme_hook(Evas_Object *obj);
66 static void _sizing_eval(Evas_Object *obj);
67 static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
69 static Eina_Bool _icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name);
70 static Eina_Bool _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size);
72 static const char SIG_CLICKED[] = "clicked";
74 static const Evas_Smart_Cb_Description _signals[] = {
80 //FIXME: move this code to ecore
83 _path_is_absolute(const char *path)
85 //TODO: Check if this works with all absolute paths in windows
86 return ((isalpha (*path)) && (*(path + 1) == ':') && ((*(path + 2) == '\\') || (*(path + 2) == '/')));
90 _path_is_absolute(const char *path)
92 return (*path == '/');
97 _icon_size_min_get(Evas_Object *icon)
100 _els_smart_icon_size_get(icon, &size, NULL);
101 return (size < 16) ? 16 : size;
104 #ifdef HAVE_ELEMENTARY_ETHUMB
106 _icon_thumb_stop(Widget_Data *wd, void *ethumbd)
108 if (wd->thumb.request)
110 ethumb_client_thumb_async_cancel(ethumbd, wd->thumb.request);
111 wd->thumb.request = NULL;
112 _icon_pending_request--;
117 _elm_icon_retry = eina_list_remove(_elm_icon_retry, wd);
118 wd->thumb.retry = EINA_FALSE;
123 _icon_thumb_display(Widget_Data *wd)
125 Eina_Bool ret = EINA_FALSE;
127 if (wd->thumb.format == ETHUMB_THUMB_EET)
129 static const char *extensions[] = {
130 ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL
132 const char **ext, *ptr;
134 Eina_Bool video = EINA_FALSE;
136 prefix_size = eina_stringshare_strlen(wd->thumb.file.path) - 4;
137 if (prefix_size >= 0)
139 ptr = wd->thumb.file.path + prefix_size;
140 for (ext = extensions; *ext; ++ext)
141 if (!strcasecmp(ptr, *ext))
149 ret = _els_smart_icon_file_edje_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key);
153 ret = _els_smart_icon_file_key_set(wd->img, wd->thumb.thumb.path, wd->thumb.thumb.key);
159 _icon_thumb_retry(Widget_Data *wd)
161 return _icon_thumb_display(wd);
165 _icon_thumb_cleanup(Ethumb_Client *ethumbd)
170 EINA_LIST_FOREACH_SAFE(_elm_icon_retry, l, ll, wd)
171 if (_icon_thumb_retry(wd))
173 _elm_icon_retry = eina_list_remove_list(_elm_icon_retry, l);
174 wd->thumb.retry = EINA_FALSE;
177 if (_icon_pending_request == 0)
178 EINA_LIST_FREE(_elm_icon_retry, wd)
179 _icon_thumb_stop(wd, ethumbd);
183 _icon_thumb_finish(Widget_Data *wd, Ethumb_Client *ethumbd)
185 const char *file = NULL, *group = NULL;
188 _els_smart_icon_file_get(wd->img, &file, &group);
189 file = eina_stringshare_ref(file);
190 group = eina_stringshare_ref(group);
192 ret = _icon_thumb_display(wd);
198 if (!wd->thumb.retry)
200 _elm_icon_retry = eina_list_append(_elm_icon_retry, wd);
201 wd->thumb.retry = EINA_TRUE;
204 /* Back to previous image */
205 if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
206 _els_smart_icon_file_edje_set(wd->img, file, group);
208 _els_smart_icon_file_key_set(wd->img, file, group);
211 _icon_thumb_cleanup(ethumbd);
213 eina_stringshare_del(file);
214 eina_stringshare_del(group);
218 _icon_thumb_done(Ethumb_Client *client, const char *thumb_path, const char *thumb_key, void *data)
220 Widget_Data *wd = data;
222 assert(wd->thumb.request);
224 _icon_pending_request--;
225 wd->thumb.request = NULL;
227 eina_stringshare_replace(&wd->thumb.thumb.path, thumb_path);
228 eina_stringshare_replace(&wd->thumb.thumb.key, thumb_key);
229 wd->thumb.format = ethumb_client_format_get(client);
231 _icon_thumb_finish(wd, client);
235 _icon_thumb_error(Ethumb_Client *client, void *data)
237 Widget_Data *wd = data;
239 assert(wd->thumb.request);
241 _icon_pending_request--;
242 wd->thumb.request = NULL;
244 ERR("could not generate thumbnail for %s (key: %s)", wd->thumb.file.path, wd->thumb.file.key);
245 _icon_thumb_cleanup(client);
249 _icon_thumb_apply(Widget_Data *wd)
251 Ethumb_Client *ethumbd;
253 ethumbd = elm_thumb_ethumb_client_get();
255 _icon_thumb_stop(wd, ethumbd);
257 if (!wd->thumb.file.path) return ;
259 _icon_pending_request++;
260 if (!ethumb_client_file_set(ethumbd, wd->thumb.file.path, wd->thumb.file.key)) return ;
261 ethumb_client_size_set(ethumbd, _icon_size_min_get(wd->img), _icon_size_min_get(wd->img));
262 wd->thumb.request = ethumb_client_thumb_async_get(ethumbd, _icon_thumb_done, _icon_thumb_error, wd);
266 _icon_thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__)
268 Widget_Data *wd = data;
270 _icon_thumb_apply(wd);
271 return ECORE_CALLBACK_RENEW;
276 _del_hook(Evas_Object *obj)
278 Widget_Data *wd = elm_widget_data_get(obj);
279 #ifdef HAVE_ELEMENTARY_ETHUMB
280 Ethumb_Client *ethumbd;
284 if (wd->stdicon) eina_stringshare_del(wd->stdicon);
286 #ifdef HAVE_ELEMENTARY_ETHUMB
287 ethumbd = elm_thumb_ethumb_client_get();
288 _icon_thumb_stop(wd, ethumbd);
290 eina_stringshare_del(wd->thumb.file.path);
291 eina_stringshare_del(wd->thumb.file.key);
292 eina_stringshare_del(wd->thumb.thumb.path);
293 eina_stringshare_del(wd->thumb.thumb.key);
296 ecore_event_handler_del(wd->thumb.eeh);
300 ecore_timer_del(wd->timer);
305 _theme_hook(Evas_Object *obj)
307 Widget_Data *wd = elm_widget_data_get(obj);
310 _elm_theme_object_icon_set(obj, wd->img, wd->stdicon, elm_widget_style_get(obj));
315 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
317 Widget_Data *wd = elm_widget_data_get(obj);
319 Evas_Object *icon_edje;
320 icon_edje = _els_smart_icon_edje_get(wd->img);
321 if (!icon_edje) return;
322 edje_object_signal_emit(icon_edje, emission, source);
326 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
328 Widget_Data *wd = elm_widget_data_get(obj);
330 Evas_Object *icon_edje;
331 icon_edje = _els_smart_icon_edje_get(wd->img);
332 if (!icon_edje) return;
333 edje_object_signal_callback_add(icon_edje, emission, source, func_cb, data);
337 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
339 Widget_Data *wd = elm_widget_data_get(obj);
341 Evas_Object *icon_edje;
342 icon_edje = _els_smart_icon_edje_get(wd->img);
343 if (!icon_edje) return;
344 edje_object_signal_callback_del_full(icon_edje, emission, source, func_cb,
349 _sizing_eval(Evas_Object *obj)
351 Widget_Data *wd = elm_widget_data_get(obj);
353 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
357 _els_smart_icon_size_get(wd->img, &w, &h);
359 if (wd->freedesktop.use && wd->stdicon)
362 /* This icon has been set to a freedesktop icon, and the requested
363 appears to have a different size than the requested size, so try to
364 request another, higher resolution, icon.
365 FIXME: Find a better heuristic to determine if there should be
366 an icon with a different resolution. */
367 size = ((w / 16) + 1) * 16;
368 _icon_freedesktop_set(wd, obj, wd->stdicon, size);
371 _els_smart_icon_scale_up_set(wd->img, wd->scale_up);
372 _els_smart_icon_scale_down_set(wd->img, wd->scale_down);
373 _els_smart_icon_smooth_scale_set(wd->img, wd->smooth);
374 _els_smart_icon_fill_inside_set(wd->img, !(wd->fill_outside));
375 if (wd->no_scale) _els_smart_icon_scale_set(wd->img, 1.0);
378 _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) *
380 _els_smart_icon_size_get(wd->img, &w, &h);
392 evas_object_size_hint_min_set(obj, minw, minh);
393 evas_object_size_hint_max_set(obj, maxw, maxh);
398 _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
400 Evas_Event_Mouse_Up *ev = event_info;
401 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
402 evas_object_smart_callback_call(data, SIG_CLICKED, event_info);
406 _elm_icon_animate_cb(void *data)
408 Widget_Data *wd = data;
409 Evas_Object *img_obj;
411 if (!wd) return ECORE_CALLBACK_CANCEL;
412 if (!wd->anim) return ECORE_CALLBACK_CANCEL;
414 img_obj = _els_smart_icon_object_get(wd->img);
416 if (wd->cur_frame > wd->frame_count)
417 wd->cur_frame = wd->cur_frame % wd->frame_count;
418 evas_object_image_animated_frame_set(img_obj, wd->cur_frame);
420 wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0);
422 if (wd->duration > 0)
423 ecore_timer_interval_set(wd->timer, wd->duration);
424 return ECORE_CALLBACK_RENEW;
428 _icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name)
430 if (_elm_theme_object_icon_set(obj, wd->img, name, "default"))
433 /* TODO: elm_unneed_efreet() */
434 wd->freedesktop.use = EINA_FALSE;
443 _icon_file_set(Widget_Data *wd, Evas_Object *obj, const char *path)
445 _icon_file_set(Widget_Data *wd __UNUSED__, Evas_Object *obj, const char *path)
448 if (elm_icon_file_set(obj, path, NULL))
451 /* TODO: elm_unneed_efreet() */
452 wd->freedesktop.use = EINA_FALSE;
461 _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int size)
463 _icon_freedesktop_set(Widget_Data *wd __UNUSED__, Evas_Object *obj __UNUSED__, const char *name __UNUSED__, int size __UNUSED__)
470 if (icon_theme == NON_EXISTING) return EINA_FALSE;
473 Efreet_Icon_Theme *theme;
474 /* TODO: Listen for EFREET_EVENT_ICON_CACHE_UPDATE */
475 theme = efreet_icon_theme_find(getenv("E_ICON_THEME"));
479 static const char *themes[] = {
480 "gnome", "Human", "oxygen", "hicolor", NULL
482 for (itr = themes; *itr; itr++)
484 theme = efreet_icon_theme_find(*itr);
491 icon_theme = NON_EXISTING;
495 icon_theme = eina_stringshare_add(theme->name.internal);
497 path = efreet_icon_path_find(icon_theme, name, size);
498 wd->freedesktop.use = !!path;
499 if (wd->freedesktop.use)
501 wd->freedesktop.requested_size = size;
502 elm_icon_file_set(obj, path, NULL);
510 _elm_icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name, Eina_Bool *fdo)
515 /* try locating the icon using the specified lookup order */
516 switch (wd->lookup_order)
518 case ELM_ICON_LOOKUP_FDO:
519 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
520 if (ret && fdo) *fdo = EINA_TRUE;
522 case ELM_ICON_LOOKUP_THEME:
523 ret = _icon_standard_set(wd, obj, name);
525 case ELM_ICON_LOOKUP_THEME_FDO:
526 ret = _icon_standard_set(wd, obj, name);
529 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
530 if (ret && fdo) *fdo = EINA_TRUE;
533 case ELM_ICON_LOOKUP_FDO_THEME:
535 ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
537 ret = _icon_standard_set(wd, obj, name);
545 eina_stringshare_replace(&wd->stdicon, name);
546 if (!wd->in_eval) _sizing_eval(obj);
550 if (_path_is_absolute(name))
551 return _icon_file_set(wd, obj, name);
553 /* if that fails, see if icon name is in the format size/name. if so,
554 try locating a fallback without the size specification */
555 if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
557 if (*tmp) return elm_icon_standard_set(obj, tmp);
563 _elm_icon_standard_resize(void *data,
566 void *event_info __UNUSED__)
568 Widget_Data *wd = data;
569 const char *refup = eina_stringshare_ref(wd->stdicon);
570 Eina_Bool fdo = EINA_FALSE;
572 if (!_elm_icon_standard_set(wd, obj, wd->stdicon, &fdo) || (!fdo))
573 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
574 _elm_icon_standard_resize, wd);
575 eina_stringshare_del(refup);
578 #ifdef HAVE_ELEMENTARY_ETHUMB
580 _elm_icon_thumb_resize(void *data,
583 void *event_info __UNUSED__)
585 Widget_Data *wd = data;
587 if (wd->thumb.file.path)
588 elm_icon_thumb_set(obj, wd->thumb.file.path, wd->thumb.file.key);
593 elm_icon_add(Evas_Object *parent)
599 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
601 ELM_SET_WIDTYPE(widtype, "icon");
602 elm_widget_type_set(obj, "icon");
603 elm_widget_can_focus_set(obj, EINA_FALSE);
604 elm_widget_sub_object_add(parent, obj);
605 elm_widget_data_set(obj, wd);
606 elm_widget_del_hook_set(obj, _del_hook);
607 elm_widget_theme_hook_set(obj, _theme_hook);
608 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
609 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
610 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
612 wd->lookup_order = ELM_ICON_LOOKUP_THEME_FDO;
613 wd->img = _els_smart_icon_add(e);
614 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
616 evas_object_repeat_events_set(wd->img, EINA_TRUE);
617 elm_widget_resize_object_set(obj, wd->img);
619 evas_object_smart_callbacks_descriptions_set(obj, _signals);
621 #ifdef HAVE_ELEMENTARY_ETHUMB
622 wd->thumb.request = NULL;
625 wd->smooth = EINA_TRUE;
626 wd->scale_up = EINA_TRUE;
627 wd->scale_down = EINA_TRUE;
634 elm_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key)
636 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
637 Widget_Data *wd = elm_widget_data_get(obj);
640 if (!wd) return EINA_FALSE;
641 EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
642 EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE);
643 eina_stringshare_del(wd->stdicon);
645 ret = _els_smart_icon_memfile_set(wd->img, img, size, format, key);
646 if (!wd->in_eval) _sizing_eval(obj);
651 elm_icon_file_set(Evas_Object *obj, const char *file, const char *group)
653 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
654 Widget_Data *wd = elm_widget_data_get(obj);
657 if (!wd) return EINA_FALSE;
658 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
661 if (!wd->freedesktop.use)
663 if (wd->stdicon) eina_stringshare_del(wd->stdicon);
667 if (eina_str_has_extension(file, ".edj"))
668 ret = _els_smart_icon_file_edje_set(wd->img, file, group);
670 ret = _els_smart_icon_file_key_set(wd->img, file, group);
671 if (!wd->in_eval) _sizing_eval(obj);
676 elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group)
678 ELM_CHECK_WIDTYPE(obj, widtype);
679 Widget_Data *wd = elm_widget_data_get(obj);
681 _els_smart_icon_file_get(wd->img, file, group);
685 elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group)
687 ELM_CHECK_WIDTYPE(obj, widtype);
688 Widget_Data *wd = elm_widget_data_get(obj);
691 #ifdef HAVE_ELEMENTARY_ETHUMB
692 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
693 _elm_icon_standard_resize, wd);
694 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
695 _elm_icon_thumb_resize, wd);
697 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
698 _elm_icon_thumb_resize, wd);
700 eina_stringshare_replace(&wd->thumb.file.path, file);
701 eina_stringshare_replace(&wd->thumb.file.key, group);
703 if (elm_thumb_ethumb_client_connected())
705 _icon_thumb_apply(wd);
711 wd->thumb.eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, _icon_thumb_apply_cb, wd);
721 elm_icon_animated_available_get(const Evas_Object *obj)
723 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
724 Evas_Object *img_obj ;
725 Widget_Data *wd = elm_widget_data_get(obj);
726 if (!wd) return EINA_FALSE;
728 img_obj = _els_smart_icon_object_get(wd->img);
730 return evas_object_image_animated_get(img_obj);
734 elm_icon_animated_set(Evas_Object *obj, Eina_Bool anim)
736 ELM_CHECK_WIDTYPE(obj, widtype);
737 Evas_Object *img_obj ;
738 Widget_Data *wd = elm_widget_data_get(obj);
740 if (wd->anim == anim) return;
742 img_obj = _els_smart_icon_object_get(wd->img);
743 if (!evas_object_image_animated_get(img_obj)) return;
746 wd->frame_count = evas_object_image_animated_frame_count_get(img_obj);
748 wd->duration = evas_object_image_animated_frame_duration_get(img_obj, wd->cur_frame, 0);
749 evas_object_image_animated_frame_set(img_obj, wd->cur_frame);
753 wd->frame_count = -1;
762 elm_icon_animated_get(const Evas_Object *obj)
764 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
765 Widget_Data *wd = elm_widget_data_get(obj);
766 if (!wd) return EINA_FALSE;
771 elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play)
773 ELM_CHECK_WIDTYPE(obj, widtype);
774 Widget_Data *wd = elm_widget_data_get(obj);
776 if (!wd->anim) return;
777 if (wd->play == play) return;
781 wd->timer = ecore_timer_add(wd->duration, _elm_icon_animate_cb, wd);
787 ecore_timer_del(wd->timer);
796 elm_icon_animated_play_get(const Evas_Object *obj)
798 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
799 Widget_Data *wd = elm_widget_data_get(obj);
800 if (!wd) return EINA_FALSE;
805 elm_icon_standard_set(Evas_Object *obj, const char *name)
807 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
808 Widget_Data *wd = elm_widget_data_get(obj);
809 Eina_Bool fdo = EINA_FALSE;
812 if ((!wd) || (!name)) return EINA_FALSE;
814 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
815 _elm_icon_standard_resize, wd);
817 ret = _elm_icon_standard_set(wd, obj, name, &fdo);
820 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
821 _elm_icon_standard_resize, wd);
827 elm_icon_standard_get(const Evas_Object *obj)
829 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
830 Widget_Data *wd = elm_widget_data_get(obj);
831 if (!wd) return NULL;
836 elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order)
838 ELM_CHECK_WIDTYPE(obj, widtype);
839 Widget_Data *wd = elm_widget_data_get(obj);
840 if (wd) wd->lookup_order = order;
843 EAPI Elm_Icon_Lookup_Order
844 elm_icon_order_lookup_get(const Evas_Object *obj)
846 ELM_CHECK_WIDTYPE(obj, widtype) ELM_ICON_LOOKUP_THEME_FDO;
847 Widget_Data *wd = elm_widget_data_get(obj);
848 if (!wd) return ELM_ICON_LOOKUP_THEME_FDO;
849 return wd->lookup_order;
853 elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth)
855 ELM_CHECK_WIDTYPE(obj, widtype);
856 Widget_Data *wd = elm_widget_data_get(obj);
860 if (!wd->in_eval) _sizing_eval(obj);
864 elm_icon_smooth_get(const Evas_Object *obj)
866 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
867 Widget_Data *wd = elm_widget_data_get(obj);
869 if (!wd) return EINA_FALSE;
874 elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale)
876 ELM_CHECK_WIDTYPE(obj, widtype);
877 Widget_Data *wd = elm_widget_data_get(obj);
880 wd->no_scale = no_scale;
881 if (!wd->in_eval) _sizing_eval(obj);
885 elm_icon_no_scale_get(const Evas_Object *obj)
887 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
888 Widget_Data *wd = elm_widget_data_get(obj);
889 if (!wd) return EINA_FALSE;
894 elm_icon_scale_set(Evas_Object *obj, Eina_Bool scale_up, Eina_Bool scale_down)
896 ELM_CHECK_WIDTYPE(obj, widtype);
897 Widget_Data *wd = elm_widget_data_get(obj);
900 wd->scale_up = scale_up;
901 wd->scale_down = scale_down;
902 if (!wd->in_eval) _sizing_eval(obj);
906 elm_icon_scale_get(const Evas_Object *obj, Eina_Bool *scale_up, Eina_Bool *scale_down)
908 ELM_CHECK_WIDTYPE(obj, widtype);
909 Widget_Data *wd = elm_widget_data_get(obj);
911 if (scale_up) *scale_up = wd->scale_up;
912 if (scale_down) *scale_down = wd->scale_down;
916 elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside)
918 ELM_CHECK_WIDTYPE(obj, widtype);
919 Widget_Data *wd = elm_widget_data_get(obj);
922 wd->fill_outside = fill_outside;
923 if (!wd->in_eval) _sizing_eval(obj);
927 elm_icon_size_get(const Evas_Object *obj, int *w, int *h)
929 ELM_CHECK_WIDTYPE(obj, widtype);
930 Widget_Data *wd = elm_widget_data_get(obj);
933 _els_smart_icon_size_get(wd->img, w, h);
937 elm_icon_fill_outside_get(const Evas_Object *obj)
939 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
940 Widget_Data *wd = elm_widget_data_get(obj);
942 if (!wd) return EINA_FALSE;
943 return wd->fill_outside;
947 elm_icon_prescale_set(Evas_Object *obj, int size)
949 ELM_CHECK_WIDTYPE(obj, widtype);
950 Widget_Data *wd = elm_widget_data_get(obj);
953 _els_smart_icon_scale_size_set(wd->img, size);
957 elm_icon_prescale_get(const Evas_Object *obj)
959 ELM_CHECK_WIDTYPE(obj, widtype) 0;
960 Widget_Data *wd = elm_widget_data_get(obj);
963 return _els_smart_icon_scale_size_get(wd->img);
967 elm_icon_object_get(Evas_Object *obj)
969 ELM_CHECK_WIDTYPE(obj, widtype) 0;
970 Widget_Data *wd = elm_widget_data_get(obj);
972 if (!wd) return NULL;
973 return _els_smart_icon_object_get(wd->img);
977 elm_icon_preload_set(Evas_Object *obj, Eina_Bool disable)
979 ELM_CHECK_WIDTYPE(obj, widtype);
980 Widget_Data *wd = elm_widget_data_get(obj);
983 _els_smart_icon_preload_set(wd->img, disable);