[Hoversel] fix calculation to make items fit to dropdown box 84/76484/4
authorSungtaek Hong <sth253.hong@samsung.com>
Fri, 24 Jun 2016 05:33:17 +0000 (14:33 +0900)
committerSungtaek Hong <sth253.hong@samsung.com>
Tue, 28 Jun 2016 06:40:16 +0000 (23:40 -0700)
    Summary:
    While applying scroller on hoversel, several lines for item size
    calculation were added, but they failed to have item get proper size.
    Now redundant codes are removed and some are fixed, and hoversel will
    be shown more well-ordered.

Change-Id: Id6375a2ccce5fa11ec1b7644dba2cd681f6cfde1
Signed-off-by: Sungtaek Hong <sth253.hong@samsung.com>
origin: upstream

src/lib/elc_hoversel.c

index 314dcc5041c48ed841c177b662130166d97a58dc..6e232ecb3a58148b4a8f21fb30bd672b67ea0bf7 100644 (file)
@@ -176,9 +176,13 @@ _create_scroller(Evas_Object *obj, Elm_Hoversel_Data *sd)
 {
    //table
    sd->tbl = elm_table_add(obj);
+   evas_object_size_hint_align_set(sd->tbl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   evas_object_size_hint_weight_set(sd->tbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
    //spacer
    sd->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
+   evas_object_size_hint_align_set(sd->spacer, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   evas_object_size_hint_weight_set(sd->spacer, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_color_set(sd->spacer, 0, 0, 0, 0);
    elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1);
 
@@ -211,40 +215,17 @@ _resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
    int max_size = 0;
    char buf[128];
    Evas_Coord box_w = -1, box_h = -1;
-   Evas_Coord x, y, w, h, xx, yy, ww, hh, vw = 0, vh = 0;
-   double align_x;
-   Eina_List *l;
-   Evas_Object *it;
-   Evas_Coord obj_x, obj_y, obj_w, obj_h, it_w, it_h;
+   Evas_Coord x, y, w, h, xx, yy, ww, hh;
+   Evas_Coord obj_x, obj_y, obj_w;
 
    if (sd->scr)
      bx = elm_object_content_get(sd->scr);
 
    if ((!sd->expanded) || (!bx)) return;
 
-   edje_object_size_min_calc(elm_layout_edje_get(sd->scr), &vw, &vh);
-   evas_object_geometry_get(obj, &obj_x, &obj_y, &obj_w, &obj_h);
-
-   evas_object_size_hint_align_get(obj, &align_x, NULL);
-   if (!sd->horizontal && align_x == EVAS_HINT_FILL)
-     {
-        l = elm_box_children_get(bx);
-        EINA_LIST_FREE(l, it)
-          {
-             edje_object_size_min_calc(elm_layout_edje_get(it), &it_w, &it_h);
-             if ((obj_w - vw) > it_w)
-               evas_object_size_hint_min_set(it, (obj_w - vw), it_h);
-             else
-               evas_object_size_hint_min_set(it, it_w, it_h);
-          }
-     }
-
    elm_box_recalculate(bx);
    evas_object_size_hint_min_get(bx, &box_w, &box_h);
 
-   box_w += vw;
-   box_h += vh;
-
    max_size_str = edje_object_data_get(elm_layout_edje_get(sd->hover), "max_size");
    if (max_size_str)
      max_size = (int)(atoi(max_size_str)
@@ -285,6 +266,8 @@ _resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
    xx += x;
    yy += y;
 
+   evas_object_geometry_get(obj, &obj_x, &obj_y, &obj_w, NULL);
+
    if (sd->horizontal)
      {
         if (xx < obj_x)
@@ -398,6 +381,8 @@ _activate(Evas_Object *obj)
    bx = elm_box_add(sd->hover);
    elm_box_homogeneous_set(bx, EINA_TRUE);
    elm_box_horizontal_set(bx, sd->horizontal);
+   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
    if (sd->horizontal)
      snprintf(buf, sizeof(buf), "hoversel_horizontal_entry/%s",