Eina_Bool show : 1;
Eina_Bool edit : 1;
Eina_Bool edje : 1;
- Eina_Bool aspect_ratio_retained: 1;
+ Eina_Bool aspect_fixed: 1;
Elm_Image_Orient orient;
};
pclip = evas_object_clip_get(sd->obj);
if (sd->obj) sd->prev = sd->obj;
sd->obj = evas_object_image_add(evas_object_evas_get(obj));
+ evas_object_image_load_orientation_set(sd->obj, EINA_TRUE);
evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED,
_preloaded, sd);
evas_object_smart_member_add(sd->obj, obj);
}
void
-_els_smart_icon_aspect_ratio_retained_set(Evas_Object *obj, Eina_Bool retained)
+_els_smart_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
- retained = !!retained;
- if (sd->aspect_ratio_retained == retained) return;
- sd->aspect_ratio_retained = retained;
+ fixed = !!fixed;
+ if (sd->aspect_fixed == fixed) return;
+ sd->aspect_fixed = fixed;
_smart_reconfigure(sd);
}
Eina_Bool
-_els_smart_icon_aspect_ratio_retained_get(const Evas_Object *obj)
+_els_smart_icon_aspect_fixed_get(const Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return EINA_FALSE;
- return sd->aspect_ratio_retained;
+ return sd->aspect_fixed;
}
/* local subsystem globals */
else
{
int iw = 0, ih = 0;
+ double alignh = 0.5, alignv = 0.5;
+ Evas_Object *parent;
evas_object_image_size_get(sd->obj, &iw, &ih);
if (iw < 1) iw = 1;
if (ih < 1) ih = 1;
- if (sd->aspect_ratio_retained)
+ if (sd->aspect_fixed)
{
h = ((double)ih * w) / (double)iw;
if (sd->fill_inside)
if (w < iw) w = iw;
if (h < ih) h = ih;
}
- x = sd->x + ((sd->w - w) / 2);
- y = sd->y + ((sd->h - h) / 2);
+ parent = elm_widget_parent_widget_get(sd->obj);
+ if (parent)
+ evas_object_size_hint_align_get(parent, &alignh, &alignv);
+ if (alignh == EVAS_HINT_FILL) alignh = 0.5;
+ if (alignv == EVAS_HINT_FILL) alignv = 0.5;
+ x = sd->x + ((sd->w - w) * alignh);
+ y = sd->y + ((sd->h - h) * alignv);
evas_object_move(sd->obj, x, y);
evas_object_image_fill_set(sd->obj, 0, 0, w, h);
evas_object_resize(sd->obj, w, h);
sd->fill_inside = EINA_TRUE;
sd->scale_up = EINA_TRUE;
sd->scale_down = EINA_TRUE;
- sd->aspect_ratio_retained = EINA_TRUE;
+ sd->aspect_fixed = EINA_TRUE;
sd->size = 64;
sd->scale = 1.0;
evas_object_smart_member_add(sd->obj, obj);