summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-01-20 21:29:12 +0900
committerHermet Park <hermet@hermet.pe.kr>2016-01-20 21:29:12 +0900
commit6160e8bcd6d8ad38574bbde9445c6be2cd6bb956 (patch)
treec1d98db1c4809eb75cb0f2c8a9e607efae6eb497
parent163d1c8b88fc613a4700cecc93f83f7136da0873 (diff)
elm_hoversel: fix calculation to make items fit to dropdown box
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. Test Plan: elementary_test hoversel Reviewers: jpeg, raster, cedric Differential Revision: https://phab.enlightenment.org/D3589
-rw-r--r--data/themes/edc/elm/hover.edc10
-rw-r--r--src/lib/elc_hoversel.c45
2 files changed, 20 insertions, 35 deletions
diff --git a/data/themes/edc/elm/hover.edc b/data/themes/edc/elm/hover.edc
index cce316aec..74757f8f4 100644
--- a/data/themes/edc/elm/hover.edc
+++ b/data/themes/edc/elm/hover.edc
@@ -607,7 +607,9 @@ group { name: "elm/hover/base/hoversel_vertical/default";
607 rel1.offset: 0 -1; 607 rel1.offset: 0 -1;
608 rel2.to: "elm.swallow.slot.middle"; 608 rel2.to: "elm.swallow.slot.middle";
609 rel2.relative: 1.0 0.0; 609 rel2.relative: 1.0 0.0;
610 rel2.offset: -1 -1; 610 /* set negative offset along x axis not to make
611 "select_line" part exceed parent's width */
612 rel2.offset: -9 -1;
611 } 613 }
612 description { state: "visible" 0.0; 614 description { state: "visible" 0.0;
613 inherit: "default" 0.0; 615 inherit: "default" 0.0;
@@ -636,10 +638,12 @@ group { name: "elm/hover/base/hoversel_vertical/default";
636 align: 0.0 1.0; 638 align: 0.0 1.0;
637 rel1.to: "elm.swallow.slot.middle"; 639 rel1.to: "elm.swallow.slot.middle";
638 rel1.relative: 0.0 1.0; 640 rel1.relative: 0.0 1.0;
639 rel1.offset: 0 2; 641 rel1.offset: 0 0;
640 rel2.to: "elm.swallow.slot.middle"; 642 rel2.to: "elm.swallow.slot.middle";
641 rel2.relative: 1.0 1.0; 643 rel2.relative: 1.0 1.0;
642 rel2.offset: -1 2; 644 /* set negative offset along x axis not to make
645 "select_line" part exceed parent's width */
646 rel2.offset: -9 2;
643 } 647 }
644 description { state: "visible" 0.0; 648 description { state: "visible" 0.0;
645 inherit: "default" 0.0; 649 inherit: "default" 0.0;
diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index 175e1fb9c..eaa760be9 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.c
@@ -202,9 +202,13 @@ _create_scroller(Evas_Object *obj, Elm_Hoversel_Data *sd)
202{ 202{
203 //table 203 //table
204 sd->tbl = elm_table_add(obj); 204 sd->tbl = elm_table_add(obj);
205 evas_object_size_hint_align_set(sd->tbl, EVAS_HINT_FILL, EVAS_HINT_FILL);
206 evas_object_size_hint_weight_set(sd->tbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
205 207
206 //spacer 208 //spacer
207 sd->spacer = evas_object_rectangle_add(evas_object_evas_get(obj)); 209 sd->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
210 evas_object_size_hint_align_set(sd->spacer, EVAS_HINT_FILL, EVAS_HINT_FILL);
211 evas_object_size_hint_weight_set(sd->spacer, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
208 evas_object_color_set(sd->spacer, 0, 0, 0, 0); 212 evas_object_color_set(sd->spacer, 0, 0, 0, 0);
209 elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1); 213 elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1);
210 214
@@ -232,44 +236,17 @@ _create_scroller(Evas_Object *obj, Elm_Hoversel_Data *sd)
232static void 236static void
233_resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd) 237_resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
234{ 238{
235 Evas_Object *bx = NULL;
236 const char *max_size_str; 239 const char *max_size_str;
237 int max_size = 0; 240 int max_size = 0;
238 char buf[128]; 241 char buf[128];
239 Evas_Coord box_w = -1, box_h = -1; 242 Evas_Coord box_w = -1, box_h = -1;
240 Evas_Coord x, y, w, h, xx, yy, ww, hh, vw = 0, vh = 0; 243 Evas_Coord x, y, w, h, xx, yy, ww, hh;
241 double align_x; 244 Evas_Coord obj_x, obj_y, obj_w;
242 Eina_List *l;
243 Evas_Object *it;
244 Evas_Coord obj_x, obj_y, obj_w, obj_h, it_w, it_h;
245
246 if (sd->scr)
247 bx = elm_object_content_get(sd->scr);
248
249 if ((!sd->expanded) || (!bx)) return;
250
251 edje_object_size_min_calc(elm_layout_edje_get(sd->scr), &vw, &vh);
252 evas_object_geometry_get(obj, &obj_x, &obj_y, &obj_w, &obj_h);
253
254 evas_object_size_hint_align_get(obj, &align_x, NULL);
255 if (!sd->horizontal && align_x == EVAS_HINT_FILL)
256 {
257 l = elm_box_children_get(bx);
258 EINA_LIST_FREE(l, it)
259 {
260 edje_object_size_min_calc(elm_layout_edje_get(it), &it_w, &it_h);
261 if ((obj_w - vw) > it_w)
262 evas_object_size_hint_min_set(it, (obj_w - vw), it_h);
263 else
264 evas_object_size_hint_min_set(it, it_w, it_h);
265 }
266 }
267 245
268 elm_box_recalculate(bx); 246 if ((!sd->expanded) || (!sd->bx)) return;
269 evas_object_size_hint_min_get(bx, &box_w, &box_h);
270 247
271 box_w += vw; 248 elm_box_recalculate(sd->bx);
272 box_h += vh; 249 evas_object_size_hint_min_get(sd->bx, &box_w, &box_h);
273 250
274 max_size_str = elm_layout_data_get(sd->hover, "max_size"); 251 max_size_str = elm_layout_data_get(sd->hover, "max_size");
275 if (max_size_str) 252 if (max_size_str)
@@ -311,6 +288,8 @@ _resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
311 xx += x; 288 xx += x;
312 yy += y; 289 yy += y;
313 290
291 evas_object_geometry_get(obj, &obj_x, &obj_y, &obj_w, NULL);
292
314 if (sd->horizontal) 293 if (sd->horizontal)
315 { 294 {
316 if (xx < obj_x) 295 if (xx < obj_x)
@@ -445,6 +424,8 @@ _activate(Evas_Object *obj)
445 sd->bx = elm_box_add(sd->hover); 424 sd->bx = elm_box_add(sd->hover);
446 elm_box_homogeneous_set(sd->bx, EINA_TRUE); 425 elm_box_homogeneous_set(sd->bx, EINA_TRUE);
447 elm_box_horizontal_set(sd->bx, sd->horizontal); 426 elm_box_horizontal_set(sd->bx, sd->horizontal);
427 evas_object_size_hint_align_set(sd->bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
428 evas_object_size_hint_weight_set(sd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
448 429
449 EINA_LIST_FOREACH(sd->items, l, eo_item) 430 EINA_LIST_FOREACH(sd->items, l, eo_item)
450 { 431 {