summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/themes/edc/elm/popup.edc1
-rw-r--r--data/themes/edc/elm/scroller.edc23
-rw-r--r--src/lib/elc_popup.c102
3 files changed, 86 insertions, 40 deletions
diff --git a/data/themes/edc/elm/popup.edc b/data/themes/edc/elm/popup.edc
index 8193189..298c470 100644
--- a/data/themes/edc/elm/popup.edc
+++ b/data/themes/edc/elm/popup.edc
@@ -369,6 +369,7 @@ group { name: "elm/popup/content/popup/default";
369 parts { 369 parts {
370 part { name:"elm.swallow.content"; type: SWALLOW; 370 part { name:"elm.swallow.content"; type: SWALLOW;
371 description { state: "default" 0.0; 371 description { state: "default" 0.0;
372 min: 240 0;
372 } 373 }
373 } 374 }
374 } 375 }
diff --git a/data/themes/edc/elm/scroller.edc b/data/themes/edc/elm/scroller.edc
index d70be40..4e19b0b 100644
--- a/data/themes/edc/elm/scroller.edc
+++ b/data/themes/edc/elm/scroller.edc
@@ -1304,3 +1304,26 @@ group { name: "elm/scroller/contents/default";
1304 } 1304 }
1305 } 1305 }
1306} 1306}
1307
1308group { name: "elm/scroller/base/popup/no_inset_shadow";
1309 inherit: "elm/scroller/base/default";
1310 parts {
1311 part { name: "elm.swallow.content";
1312 type: SWALLOW;
1313 description { state: "default" 0.0;
1314 rel1.offset: 0 0;
1315 rel2.offset: 0 0;
1316 }
1317 }
1318 part { name: "inset";
1319 description { state: "default" 0.0;
1320 visible: 0;
1321 }
1322 }
1323 part { name: "shadow";
1324 description { state: "default" 0.0;
1325 visible: 0;
1326 }
1327 }
1328 }
1329}
diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c
index 64de119..d5d8bd0 100644
--- a/src/lib/elc_popup.c
+++ b/src/lib/elc_popup.c
@@ -132,8 +132,6 @@ _scroller_size_calc(Evas_Object *obj)
132 132
133 ELM_POPUP_DATA_GET(obj, sd); 133 ELM_POPUP_DATA_GET(obj, sd);
134 134
135 if (!sd->items) return;
136
137 sd->scr_size_recalc = EINA_FALSE; 135 sd->scr_size_recalc = EINA_FALSE;
138 sd->max_sc_h = -1; 136 sd->max_sc_h = -1;
139 sd->max_sc_w = -1; 137 sd->max_sc_w = -1;
@@ -345,7 +343,6 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd)
345 elm_layout_edje_get(VIEW(it))); 343 elm_layout_edje_get(VIEW(it)));
346 } 344 }
347 } 345 }
348 _scroller_size_calc(obj);
349 } 346 }
350 if (sd->title_text) 347 if (sd->title_text)
351 { 348 {
@@ -356,6 +353,7 @@ _elm_popup_elm_widget_theme_apply(Eo *obj, Elm_Popup_Data *sd)
356 elm_layout_signal_emit(sd->main_layout, "elm,state,title,icon,visible", "elm"); 353 elm_layout_signal_emit(sd->main_layout, "elm,state,title,icon,visible", "elm");
357 354
358 _visuals_set(obj); 355 _visuals_set(obj);
356 _scroller_size_calc(obj);
359 elm_layout_sizing_eval(obj); 357 elm_layout_sizing_eval(obj);
360 358
361 /* access */ 359 /* access */
@@ -399,11 +397,31 @@ _elm_popup_elm_layout_sizing_eval(Eo *obj, Elm_Popup_Data *sd)
399 evas_object_size_hint_min_get(sd->scr, &minw, &minh); 397 evas_object_size_hint_min_get(sd->scr, &minw, &minh);
400 evas_object_size_hint_max_get(sd->scr, &minw, &minh); 398 evas_object_size_hint_max_get(sd->scr, &minw, &minh);
401 } 399 }
400 else if (sd->content || sd->text_content_obj)
401 {
402 double horizontal, vertical;
403 Evas_Coord w, h;
404
405 edje_object_message_signal_process(elm_layout_edje_get(sd->content_area));
406
407 elm_popup_align_get(obj, &horizontal, &vertical);
408 evas_object_geometry_get(elm_widget_parent_get(obj), NULL, NULL, &w, &h);
409
410 if (horizontal == ELM_NOTIFY_ALIGN_FILL)
411 minw = w;
402 412
403 edje_object_size_min_calc(elm_layout_edje_get(sd->main_layout), &minw, &minh); 413 if (vertical == ELM_NOTIFY_ALIGN_FILL)
414 minh = h;
404 415
405 evas_object_size_hint_min_set(obj, minw, minh); 416 edje_object_size_min_restricted_calc(elm_layout_edje_get(sd->content_area),
406 evas_object_size_hint_max_set(obj, -1, -1); 417 &minw, &minh, minw, minh);
418 evas_object_size_hint_min_set(sd->content_area, minw, minh);
419
420 if (minh > sd->max_sc_h)
421 evas_object_size_hint_min_set(sd->spacer, minw, sd->max_sc_h);
422 else
423 evas_object_size_hint_min_set(sd->spacer, minw, minh);
424 }
407} 425}
408 426
409EOLIAN static Eina_Bool 427EOLIAN static Eina_Bool
@@ -560,36 +578,8 @@ _layout_change_cb(void *data EINA_UNUSED,
560static void 578static void
561_list_add(Evas_Object *obj) 579_list_add(Evas_Object *obj)
562{ 580{
563 char style[1024];
564
565 ELM_POPUP_DATA_GET(obj, sd); 581 ELM_POPUP_DATA_GET(obj, sd);
566 582
567 //Table
568 sd->tbl = elm_table_add(sd->main_layout);
569 evas_object_event_callback_add(sd->tbl, EVAS_CALLBACK_DEL,
570 _on_table_del, obj);
571 eo_do(sd->main_layout, elm_obj_container_content_set(CONTENT_PART, sd->tbl));
572 evas_object_show(sd->tbl);
573
574 //Spacer
575 sd->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
576 evas_object_color_set(sd->spacer, 0, 0, 0, 0);
577 elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1);
578
579 //Scroller
580 snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
581 sd->scr = elm_scroller_add(sd->tbl);
582 elm_widget_style_set(sd->scr, style);
583 elm_scroller_content_min_limit(sd->scr, EINA_TRUE, EINA_FALSE);
584 elm_scroller_bounce_set(sd->scr, EINA_FALSE, EINA_TRUE);
585 evas_object_size_hint_weight_set(sd->scr,
586 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
587 evas_object_size_hint_align_set(sd->scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
588 evas_object_event_callback_add(sd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
589 _size_hints_changed_cb, sd->main_layout);
590 elm_table_pack(sd->tbl, sd->scr, 0, 0, 1, 1);
591 evas_object_show(sd->scr);
592
593 //Box 583 //Box
594 sd->box = elm_box_add(sd->scr); 584 sd->box = elm_box_add(sd->scr);
595 evas_object_size_hint_weight_set(sd->box, EVAS_HINT_EXPAND, 0.0); 585 evas_object_size_hint_weight_set(sd->box, EVAS_HINT_EXPAND, 0.0);
@@ -864,6 +854,7 @@ _title_text_set(Evas_Object *obj,
864 if (title_visibility_old != title_visibility_current) 854 if (title_visibility_old != title_visibility_current)
865 _visuals_set(obj); 855 _visuals_set(obj);
866 856
857 _scroller_size_calc(obj);
867 elm_layout_sizing_eval(obj); 858 elm_layout_sizing_eval(obj);
868 859
869 return EINA_TRUE; 860 return EINA_TRUE;
@@ -883,7 +874,7 @@ _content_text_set(Evas_Object *obj,
883 _items_remove(sd); 874 _items_remove(sd);
884 _list_del(sd); 875 _list_del(sd);
885 } 876 }
886 else eo_do(sd->main_layout, elm_obj_container_content_set(CONTENT_PART, sd->content_area)); 877 else elm_object_content_set(sd->scr, sd->content_area);
887 if (!text) goto end; 878 if (!text) goto end;
888 879
889 if (sd->text_content_obj) 880 if (sd->text_content_obj)
@@ -927,6 +918,7 @@ _content_text_set(Evas_Object *obj,
927 } 918 }
928 919
929end: 920end:
921 _scroller_size_calc(obj);
930 elm_layout_sizing_eval(obj); 922 elm_layout_sizing_eval(obj);
931 923
932 return EINA_TRUE; 924 return EINA_TRUE;
@@ -1022,8 +1014,7 @@ _content_set(Evas_Object *obj,
1022 sd->content = content; 1014 sd->content = content;
1023 if (content) 1015 if (content)
1024 { 1016 {
1025 eo_do(sd->main_layout, elm_obj_container_content_set 1017 elm_object_content_set(sd->scr, sd->content_area);
1026 (CONTENT_PART, sd->content_area));
1027 1018
1028 eo_do(sd->content_area, elm_obj_container_content_set 1019 eo_do(sd->content_area, elm_obj_container_content_set
1029 (CONTENT_PART, content)); 1020 (CONTENT_PART, content));
@@ -1097,8 +1088,7 @@ _action_button_set(Evas_Object *obj,
1097 elm_object_part_content_set 1088 elm_object_part_content_set
1098 (sd->action_area, buf, sd->buttons[idx]->btn); 1089 (sd->action_area, buf, sd->buttons[idx]->btn);
1099 1090
1100 if (sd->items) _scroller_size_calc(obj); 1091 _scroller_size_calc(obj);
1101
1102 elm_layout_sizing_eval(obj); 1092 elm_layout_sizing_eval(obj);
1103} 1093}
1104 1094
@@ -1368,6 +1358,35 @@ _elm_popup_elm_widget_event(Eo *obj, Elm_Popup_Data *_pd EINA_UNUSED, Evas_Objec
1368 return EINA_TRUE; 1358 return EINA_TRUE;
1369} 1359}
1370 1360
1361static void
1362_create_scroller(Evas_Object *obj)
1363{
1364 ELM_POPUP_DATA_GET(obj, sd);
1365
1366 //table
1367 sd->tbl = elm_table_add(sd->main_layout);
1368 evas_object_event_callback_add(sd->tbl, EVAS_CALLBACK_DEL,
1369 _on_table_del, obj);
1370
1371 //spacer
1372 sd->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
1373 evas_object_color_set(sd->spacer, 0, 0, 0, 0);
1374 elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1);
1375
1376 //Scroller
1377 sd->scr = elm_scroller_add(sd->tbl);
1378 elm_object_style_set(sd->scr, "popup/no_inset_shadow");
1379 evas_object_size_hint_weight_set(sd->scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1380 evas_object_size_hint_align_set(sd->scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1381 elm_scroller_policy_set(sd->scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
1382 elm_scroller_content_min_limit(sd->scr, EINA_TRUE, EINA_FALSE);
1383 elm_scroller_bounce_set(sd->scr, EINA_FALSE, EINA_TRUE);
1384 evas_object_event_callback_add(sd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1385 _size_hints_changed_cb, obj);
1386 elm_table_pack(sd->tbl, sd->scr, 0, 0, 1, 1);
1387 evas_object_show(sd->scr);
1388}
1389
1371EOLIAN static void 1390EOLIAN static void
1372_elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv) 1391_elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv)
1373{ 1392{
@@ -1393,6 +1412,9 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv)
1393 elm_widget_style_get(obj))) 1412 elm_widget_style_get(obj)))
1394 CRI("Failed to set layout!"); 1413 CRI("Failed to set layout!");
1395 1414
1415 _create_scroller(obj);
1416 elm_layout_content_set(priv->main_layout, "elm.swallow.content", priv->tbl);
1417
1396 elm_object_content_set(priv->notify, priv->main_layout); 1418 elm_object_content_set(priv->notify, priv->main_layout);
1397 1419
1398 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL); 1420 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
@@ -1412,7 +1434,7 @@ _elm_popup_evas_object_smart_add(Eo *obj, Elm_Popup_Data *priv)
1412 else 1434 else
1413 evas_object_event_callback_add 1435 evas_object_event_callback_add
1414 (priv->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, 1436 (priv->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1415 _size_hints_changed_cb, priv->main_layout); 1437 _size_hints_changed_cb, obj);
1416 1438
1417 priv->content_text_wrap_type = ELM_WRAP_MIXED; 1439 priv->content_text_wrap_type = ELM_WRAP_MIXED;
1418 evas_object_smart_callback_add 1440 evas_object_smart_callback_add