From 69f5027e6698a6cf2f2732b7005381713dc9f6d9 Mon Sep 17 00:00:00 2001 From: discomfitor Date: Thu, 16 Feb 2012 22:48:32 +0000 Subject: [PATCH] port aspect_fixed from image to icon remind me again: why do we have more than one image api here?????????? git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68045 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_icon.c | 18 ++++++++++++++++++ src/lib/elm_icon.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c index 180711d..75bdfc7 100644 --- a/src/lib/elm_icon.c +++ b/src/lib/elm_icon.c @@ -983,3 +983,21 @@ elm_icon_preload_set(Evas_Object *obj, Eina_Bool disable) if (!wd) return; _els_smart_icon_preload_set(wd->img, disable); } + +EAPI void +elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + _els_smart_icon_aspect_fixed_set(wd->img, fixed); +} + +EAPI Eina_Bool +elm_icon_aspect_fixed_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return _els_smart_icon_aspect_fixed_get(wd->img); +} diff --git a/src/lib/elm_icon.h b/src/lib/elm_icon.h index ae24800..fff6092 100644 --- a/src/lib/elm_icon.h +++ b/src/lib/elm_icon.h @@ -531,5 +531,35 @@ EAPI void elm_icon_animated_play_set(Evas_Object *obj, Eina_Boo EAPI Eina_Bool elm_icon_animated_play_get(const Evas_Object *obj); /** + * Set whether the original aspect ratio of the icon should be kept on resize. + * + * @param obj The icon object. + * @param fixed @c EINA_TRUE if the icon should retain the aspect, + * @c EINA_FALSE otherwise. + * + * The original aspect ratio (width / height) of the icon is usually + * distorted to match the object's size. Enabling this option will retain + * this original aspect, and the way that the icon is fit into the object's + * area depends on the option set by elm_icon_fill_outside_set(). + * + * @see elm_icon_aspect_fixed_get() + * @see elm_icon_fill_outside_set() + * + * @ingroup Icon + */ +EAPI void elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed); + +/** + * Get if the object retains the original aspect ratio. + * + * @param obj The icon object. + * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE + * otherwise. + * + * @ingroup Icon + */ +EAPI Eina_Bool elm_icon_aspect_fixed_get(const Evas_Object *obj); + +/** * @} */ -- 2.7.4