*
* @ingroup Icon
*/
-EAPI Eina_Bool
-elm_icon_standard_set(Evas_Object *obj, const char *name)
+static Eina_Bool
+_elm_icon_standard_set(Widget_Data *wd, Evas_Object *obj, const char *name)
{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
char *tmp;
Eina_Bool ret;
- if ((!wd) || (!name)) return EINA_FALSE;
-
/* try locating the icon using the specified lookup order */
switch (wd->lookup_order)
{
if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
++tmp;
if (*tmp) return elm_icon_standard_set(obj, tmp);
-
/* give up */
return EINA_FALSE;
}
+static void
+_elm_icon_standard_resize(void *data,
+ Evas *e __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ Widget_Data *wd = data;
+
+ if (!_elm_icon_standard_set(wd, obj, wd->stdicon))
+ evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
+ _elm_icon_standard_resize, wd);
+}
+
+EAPI Eina_Bool
+elm_icon_standard_set(Evas_Object *obj, const char *name)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if ((!wd) || (!name)) return EINA_FALSE;
+
+ evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
+ _elm_icon_standard_resize, wd);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
+ _elm_icon_standard_resize, wd);
+
+ return _elm_icon_standard_set(wd, obj, name);
+}
+
/**
* Get the theme, as standard, for an icon
*
{
Smart_Data *sd;
int tw, th;
+ int cw, ch;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
edje_object_size_min_get(sd->obj, &tw, &th);
else
evas_object_image_size_get(sd->obj, &tw, &th);
+ evas_object_geometry_get(sd->obj, NULL, NULL, &cw, &ch);
+ tw = tw > cw ? tw : cw;
+ th = th > ch ? th : ch;
tw = ((double)tw) * sd->scale;
th = ((double)th) * sd->scale;
if (w) *w = tw;