void
test_conformant(void *data, Evas_Object *obj, void *event)
{
- Evas_Object *win, *bg, *conform, *btn, *bx, *sc, *en;
+ Evas_Object *win, *bg, *conform, *btn, *bx, *en;
win = elm_win_add(NULL, "conformant", ELM_WIN_BASIC);
elm_win_title_set(win, "Conformant");
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
- sc = elm_scroller_add(win);
- elm_scroller_content_min_limit(sc, 0, 1);
- elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_scroller_bounce_set(sc, 1, 0);
- evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, sc);
-
- en = elm_entry_add(win);
- elm_entry_single_line_set(en, 1);
- elm_entry_entry_set(en, "This is the top entry here");
+ en = elm_scrolled_entry_add(win);
+ elm_scrolled_entry_single_line_set(en, 1);
+ elm_scrolled_entry_bounce_set(en, 1, 0);
+ elm_scrolled_entry_entry_set(en, "This is the top entry here");
evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
- elm_scroller_content_set(sc, en);
evas_object_show(en);
+ elm_box_pack_end(bx, en);
- evas_object_show(sc);
-
btn = elm_button_add(win);
elm_button_label_set(btn, "Test Conformant");
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx, btn);
evas_object_show(btn);
- sc = elm_scroller_add(win);
- elm_scroller_content_min_limit(sc, 0, 1);
- elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_scroller_bounce_set(sc, 1, 0);
- evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, sc);
-
- en = elm_entry_add(win);
- elm_entry_single_line_set(en, 1);
- elm_entry_entry_set(en, "This is the middle entry here");
+ en = elm_scrolled_entry_add(win);
+ elm_scrolled_entry_single_line_set(en, 1);
+ elm_scrolled_entry_bounce_set(en, 1, 0);
+ elm_scrolled_entry_entry_set(en, "This is the middle entry here");
evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
- elm_scroller_content_set(sc, en);
evas_object_show(en);
+ elm_box_pack_end(bx, en);
- evas_object_show(sc);
-
btn = elm_button_add(win);
elm_button_label_set(btn, "Test Conformant");
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, btn);
evas_object_show(btn);
- sc = elm_scroller_add(win);
- elm_scroller_content_min_limit(sc, 0, 0);
- elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_scroller_bounce_set(sc, 0, 1);
- evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, sc);
-
- en = elm_entry_add(win);
- elm_entry_entry_set(en,
+ en = elm_scrolled_entry_add(win);
+ elm_scrolled_entry_bounce_set(en, 0, 1);
+ elm_scrolled_entry_entry_set(en,
"This is a multi-line entry at the bottom<br>"
"This can contain more than 1 line of text and be "
"scrolled around to allow for entering of lots of "
"it is enabled.");
evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_scroller_content_set(sc, en);
evas_object_show(en);
+ elm_box_pack_end(bx, en);
- evas_object_show(sc);
-
elm_conformant_content_set(conform, bx);
evas_object_show(bx);
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Coord minw, minh;
- evas_object_size_hint_min_set(obj, -1, -1);
+ if (!wd) return;
+ evas_object_size_hint_min_get(wd->scroller, &minw, &minh);
+ evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
if (!wd) return;
elm_entry_single_line_set(wd->entry, single_line);
if (single_line)
- elm_scroller_policy_set(wd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ {
+ elm_scroller_policy_set(wd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_scroller_content_min_limit(wd->scroller, 0, 1);
+ }
else
- elm_scroller_policy_set(wd->scroller, wd->policy_h, wd->policy_v);
+ {
+ elm_scroller_policy_set(wd->scroller, wd->policy_h, wd->policy_v);
+ elm_scroller_content_min_limit(wd->scroller, 0, 0);
+ }
}
EAPI void
wd->policy_v = v;
elm_scroller_policy_set(wd->scroller, h, v);
}
+
+EAPI void
+elm_scrolled_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_scroller_bounce_set(wd->scroller, h_bounce, v_bounce);
+}