summaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/elc_hoversel.c45
1 files changed, 13 insertions, 32 deletions
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 {