diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index b21daf67ac..a88c1c1920 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -187,6 +187,7 @@ static void st_collections_group_parts_part_description_gradient_rel2_offset(voi static void st_collections_group_parts_part_description_box_layout(void); static void st_collections_group_parts_part_description_box_align(void); static void st_collections_group_parts_part_description_box_padding(void); +static void st_collections_group_parts_part_description_box_min(void); static void st_collections_group_parts_part_description_table_homogeneous(void); static void st_collections_group_parts_part_description_table_align(void); static void st_collections_group_parts_part_description_table_padding(void); @@ -382,6 +383,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.box.layout", st_collections_group_parts_part_description_box_layout}, {"collections.group.parts.part.description.box.align", st_collections_group_parts_part_description_box_align}, {"collections.group.parts.part.description.box.padding", st_collections_group_parts_part_description_box_padding}, + {"collections.group.parts.part.description.box.min", st_collections_group_parts_part_description_box_min}, {"collections.group.parts.part.description.table.homogeneous", st_collections_group_parts_part_description_table_homogeneous}, {"collections.group.parts.part.description.table.align", st_collections_group_parts_part_description_table_align}, {"collections.group.parts.part.description.table.padding", st_collections_group_parts_part_description_table_padding}, @@ -5047,6 +5049,7 @@ st_collections_group_parts_part_description_gradient_rel2_offset(void) layout: "vertical"; padding: 0 2; align: 0.5 0.5; + min: 0 0; } .. } @@ -5094,6 +5097,16 @@ st_collections_group_parts_part_description_gradient_rel2_offset(void) @effect Sets the space between cells in pixels. Defaults to 0 0. @endproperty + + @property + min + @parameters + [horizontal] [vertical] + @effect + When any of the parameters is enabled (1) it forces the minimum size of + the box to be equal to the minimum size of the items. The default + value is "0 0". + @endproperty */ static void st_collections_group_parts_part_description_box_layout(void) { @@ -5171,6 +5184,32 @@ static void st_collections_group_parts_part_description_box_padding(void) ed->box.padding.y = parse_int_range(1, 0, 0x7fffffff); } +static void +st_collections_group_parts_part_description_box_min(void) +{ + Edje_Part_Collection *pc; + Edje_Part *ep; + Edje_Part_Description *ed; + + check_arg_count(2); + + pc = eina_list_data_get(eina_list_last(edje_collections)); + ep = eina_list_data_get(eina_list_last(pc->parts)); + + if (ep->type != EDJE_PART_TYPE_BOX) + { + fprintf(stderr, "%s: Error. parse error %s:%i. " + "box attributes in non-BOX part.\n", + progname, file_in, line - 1); + exit(-1); + } + + ed = ep->default_desc; + if (ep->other_desc) ed = eina_list_data_get(eina_list_last(ep->other_desc)); + ed->box.min.h = parse_bool(0); + ed->box.min.v = parse_bool(1); +} + /** @page edcref diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index 1abc50d4dc..0accfafb07 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c @@ -1219,6 +1219,7 @@ _edje_box_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_ Evas_Object_Box_Layout layout; void (*free_data)(void *data); void *data; + int min_w, min_h; if (!_edje_box_layout_find(chosen_desc->box.layout, &layout, &data, &free_data)) { @@ -1236,6 +1237,13 @@ _edje_box_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_ evas_object_box_layout_set(ep->object, layout, data, free_data); evas_object_box_align_set(ep->object, chosen_desc->box.align.x, chosen_desc->box.align.y); evas_object_box_padding_set(ep->object, chosen_desc->box.padding.x, chosen_desc->box.padding.y); + + evas_object_smart_calculate(ep->object); + evas_object_size_hint_min_get(ep->object, &min_w, &min_h); + if (chosen_desc->box.min.h) + p3->w = min_w; + if (chosen_desc->box.min.v) + p3->h = min_h; } static void diff --git a/legacy/edje/src/lib/edje_data.c b/legacy/edje/src/lib/edje_data.c index e238f10463..760cc63130 100644 --- a/legacy/edje/src/lib/edje_data.c +++ b/legacy/edje/src/lib/edje_data.c @@ -369,6 +369,8 @@ _edje_edd_setup(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.align.y", box.align.y, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.padding.x", box.padding.x, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.padding.y", box.padding.y, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.min.h", box.min.h, EET_T_UCHAR); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.min.v", box.min.v, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.homogeneous", table.homogeneous, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.align.x", table.align.x, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.align.y", table.align.y, EET_T_DOUBLE); diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 4e10cbd6c1..abc31a9af9 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -586,6 +586,9 @@ struct _Edje_Part_Description struct { int x, y; } padding; + struct { + Eina_Bool h, v; + } min; } box; struct { unsigned char homogeneous;