@property
min
@parameters
- [width] [height]
+ [width] [height] or SOURCE
@effect
The minimum size of the state.
+
+ When min is defined to SOURCE, it will look at the original
+ image size and enforce it minimal size to match at least the
+ original one. The part must be an IMAGE part.
@endproperty
*/
static void
st_collections_group_parts_part_description_min(void)
{
- check_arg_count(2);
+ check_min_arg_count(1);
- current_desc->min.w = parse_float_range(0, 0, 0x7fffffff);
- current_desc->min.h = parse_float_range(1, 0, 0x7fffffff);
+ if (is_param(1)) {
+ current_desc->min.w = parse_float_range(0, 0, 0x7fffffff);
+ current_desc->min.h = parse_float_range(1, 0, 0x7fffffff);
+ } else {
+ Edje_Part_Description_Image *desc;
+ char *tmp;
+
+ tmp = parse_str(0);
+ if (current_part->type != EDJE_PART_TYPE_IMAGE ||
+ !tmp || strcmp(tmp, "SOURCE") != 0)
+ {
+ ERR("%s: Error. parse error %s:%i. "
+ "Only IMAGE part can have a min: SOURCE; defined",
+ progname, file_in, line - 1);
+ exit(-1);
+ }
+
+ desc = (Edje_Part_Description_Image *) current_desc;
+ desc->image.min.limit = EINA_TRUE;
+ }
}
/**
@property
max
@parameters
- [width] [height]
+ [width] [height] or SOURCE
@effect
The maximum size of the state. A size of -1.0 means that it will be ignored in one direction.
+
+ When max is set to SOURCE, edje will enforce the part to be
+ not more than the original image size. The part must be an
+ IMAGE part.
@endproperty
*/
static void
st_collections_group_parts_part_description_max(void)
{
- check_arg_count(2);
+ check_min_arg_count(1);
- current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff);
- current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff);
+ if (is_param(1)) {
+ current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff);
+ current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff);
+ } else {
+ Edje_Part_Description_Image *desc;
+ char *tmp;
+
+ tmp = parse_str(0);
+ if (current_part->type != EDJE_PART_TYPE_IMAGE ||
+ !tmp || strcmp(tmp, "SOURCE") != 0)
+ {
+ ERR("%s: Error. parse error %s:%i. "
+ "Only IMAGE part can have a max: SOURCE; defined",
+ progname, file_in, line - 1);
+ exit(-1);
+ }
+
+ desc = (Edje_Part_Description_Image *) current_desc;
+ desc->image.max.limit = EINA_TRUE;
+ }
}
/**
}
}
-
/* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
if ((ep->swallow_params.max.h <= 0) ||
(ep->swallow_params.max.h == EDJE_INF_MAX_H))
if (lminh > minh) minh = lminh;
}
}
+ else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
+ ((((Edje_Part_Description_Image *)chosen_desc)->image.min.limit) ||
+ (((Edje_Part_Description_Image *)chosen_desc)->image.max.limit)))
+ {
+ Evas_Coord w, h;
+
+ /* We only need pos to find the right image that would be displayed */
+ /* Yes, if someone set aspect preference to SOURCE and also max,min
+ to SOURCE, it will be under efficient, but who cares at the
+ moment. */
+ _edje_real_part_image_set(ed, ep, pos);
+ evas_object_image_size_get(ep->object, &w, &h);
+
+ if (((Edje_Part_Description_Image *)chosen_desc)->image.min.limit)
+ {
+ if (w > minw) minw = w;
+ if (h > minh) minh = h;
+ }
+ if (((Edje_Part_Description_Image *)chosen_desc)->image.max.limit)
+ {
+ if (w < maxw) maxw = w;
+ if (h < maxh) maxh = h;
+ }
+ }
/* remember what our size is BEFORE we go limit it */
params->req.x = params->x;