elm list: Fixed list separator size bug. Patch by Thiep Ha <thiep.ha@samsung.com>

On Sun, Dec 9, 2012 at 11:11 AM, thiep ha <thiep.ha@samsung.com> wrote:

    Dear All,

    In elementary list, the separator is not correctly set.
    I would like to send a patch to correct the list with separator.
    I also add an example named "List Separator" to test it.

    Please review this patch.

    Best Regards,
    Thiep Ha

SVN revision: 82040
This commit is contained in:
Daniel Juyung Seo 2013-01-03 06:23:33 +00:00
parent 443d838758
commit f4e8c92f0d
5 changed files with 156 additions and 33 deletions

View File

@ -870,3 +870,7 @@
2013-01-03 JaeHyun Jo (jae_hyun@cho@naver.com)
* Fix the naviframe item part text to be set properly.
2013-01-03 Thiep Ha
* Fix list separator size bug.

View File

@ -108,6 +108,7 @@ Fixes:
* Fix bug where genlist would delete items added during selection callback if a clear was queued
* Tooltips now correctly set NETWM tooltip window type
* Fix the naviframe item part text to be set properly.
* Fix list separator size bug.
Removals:

View File

@ -74,6 +74,7 @@ void test_list4(void *data, Evas_Object *obj, void *event_info);
void test_list5(void *data, Evas_Object *obj, void *event_info);
void test_list6(void *data, Evas_Object *obj, void *event_info);
void test_list7(void *data, Evas_Object *obj, void *event_info);
void test_list_separator(void *data, Evas_Object *obj, void *event_info);
void test_inwin(void *data, Evas_Object *obj, void *event_info);
void test_inwin2(void *data, Evas_Object *obj, void *event_info);
void test_scaling(void *data, Evas_Object *obj, void *event_info);
@ -579,6 +580,7 @@ add_tests:
ADD_TEST(NULL, "Lists", "List 5", test_list5);
ADD_TEST(NULL, "Lists", "List 6", test_list6);
ADD_TEST(NULL, "Lists", "List 7", test_list7);
ADD_TEST(NULL, "Lists", "List Separator", test_list_separator);
ADD_TEST(NULL, "Lists", "Genlist", test_genlist);
ADD_TEST(NULL, "Lists", "Genlist 2", test_genlist2);
ADD_TEST(NULL, "Lists", "Genlist 3", test_genlist3);

View File

@ -1226,4 +1226,114 @@ test_list7(void *data __UNUSED__,
evas_object_show(win);
}
void
test_list_separator(void *data __UNUSED__,
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *win, *li, *ic, *ic2, *bx, *bxx;
char buf[PATH_MAX];
Elm_Object_Item *list_it_sep;
win = elm_win_util_standard_add("list", "List Separator");
elm_win_autodel_set(win, EINA_TRUE);
bxx = elm_box_add(win);
evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bxx);
evas_object_show(bxx);
li = elm_list_add(win);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(bxx, li);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_image_file_set(ic, buf, NULL);
elm_image_resizable_set(ic, 1, 1);
elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_image_resizable_set(ic, 0, 0);
elm_image_file_set(ic, buf, NULL);
elm_list_item_append(li, "world", ic, NULL, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
ic = elm_icon_add(win);
elm_icon_standard_set(ic, "edit");
elm_image_resizable_set(ic, 0, 0);
elm_list_item_append(li, ".", ic, NULL, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
ic = elm_icon_add(win);
elm_icon_standard_set(ic, "delete");
elm_image_resizable_set(ic, 0, 0);
ic2 = elm_icon_add(win);
elm_icon_standard_set(ic2, "clock");
elm_image_resizable_set(ic2, 0, 0);
elm_list_item_append(li, "How", ic, ic2, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
bx = elm_box_add(win);
elm_box_horizontal_set(bx, EINA_TRUE);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_image_file_set(ic, buf, NULL);
elm_image_resizable_set(ic, 0, 0);
evas_object_size_hint_align_set(ic, 0.5, 0.5);
elm_box_pack_end(bx, ic);
evas_object_show(ic);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_image_file_set(ic, buf, NULL);
elm_image_resizable_set(ic, 0, 0);
evas_object_size_hint_align_set(ic, 0.5, 0.0);
elm_box_pack_end(bx, ic);
evas_object_show(ic);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_image_file_set(ic, buf, NULL);
elm_image_resizable_set(ic, 0, 0);
evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, ic);
evas_object_show(ic);
elm_list_item_append(li, "are", bx, NULL, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
elm_list_item_append(li, "you", NULL, NULL, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
elm_list_item_append(li, "doing", NULL, NULL, NULL, NULL);
list_it_sep = elm_list_item_append(li, NULL, NULL, NULL, NULL, NULL);
elm_list_item_separator_set(list_it_sep, EINA_TRUE);
elm_list_item_append(li, "?", NULL, NULL, NULL, NULL);
elm_list_go(li);
evas_object_show(li);
evas_object_resize(win, 320, 300);
evas_object_show(win);
}
#endif

View File

@ -584,7 +584,6 @@ _items_fix(Evas_Object *obj)
{
const char *stacking;
/* FIXME: separators' themes seem to be b0rked */
if (it->is_separator)
elm_widget_theme_object_set
(obj, VIEW(it), "separator", sd->h_mode ?
@ -615,36 +614,40 @@ _items_fix(Evas_Object *obj)
else if (!strcmp(stacking, "above"))
evas_object_raise(VIEW(it));
}
edje_object_part_text_escaped_set
(VIEW(it), "elm.text", it->label);
if ((!it->icon) && (minh[0] > 0))
if (!it->is_separator)
{
it->icon = evas_object_rectangle_add
(evas_object_evas_get(VIEW(it)));
evas_object_color_set(it->icon, 0, 0, 0, 0);
it->dummy_icon = EINA_TRUE;
}
if ((!it->end) && (minh[1] > 0))
{
it->end = evas_object_rectangle_add
(evas_object_evas_get(VIEW(it)));
evas_object_color_set(it->end, 0, 0, 0, 0);
it->dummy_end = EINA_TRUE;
}
if (it->icon)
{
evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
evas_object_size_hint_max_set(it->icon, 99999, 99999);
edje_object_part_swallow
(VIEW(it), "elm.swallow.icon", it->icon);
}
if (it->end)
{
evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
evas_object_size_hint_max_set(it->end, 99999, 99999);
edje_object_part_swallow
(VIEW(it), "elm.swallow.end", it->end);
edje_object_part_text_escaped_set
(VIEW(it), "elm.text", it->label);
if ((!it->icon) && (minh[0] > 0))
{
it->icon = evas_object_rectangle_add
(evas_object_evas_get(VIEW(it)));
evas_object_color_set(it->icon, 0, 0, 0, 0);
it->dummy_icon = EINA_TRUE;
}
if ((!it->end) && (minh[1] > 0))
{
it->end = evas_object_rectangle_add
(evas_object_evas_get(VIEW(it)));
evas_object_color_set(it->end, 0, 0, 0, 0);
it->dummy_end = EINA_TRUE;
}
if (it->icon)
{
evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
evas_object_size_hint_max_set(it->icon, 99999, 99999);
edje_object_part_swallow
(VIEW(it), "elm.swallow.icon", it->icon);
}
if (it->end)
{
evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
evas_object_size_hint_max_set(it->end, 99999, 99999);
edje_object_part_swallow
(VIEW(it), "elm.swallow.end", it->end);
}
}
if (!it->fixed)
{
@ -655,10 +658,12 @@ _items_fix(Evas_Object *obj)
if (it->deleted)
continue;
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
if (!it->is_separator)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc
(VIEW(it), &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
if (!it->is_separator)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_min_set(VIEW(it), mw, mh);
evas_object_show(VIEW(it));
}
@ -684,7 +689,9 @@ _items_fix(Evas_Object *obj)
it->fixed = EINA_TRUE;
it->is_even = it->even;
}
i++;
if (!it->is_separator)
i++;
}
_elm_list_mode_set_internal(obj);
@ -1613,7 +1620,6 @@ _elm_list_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
eo_do(obj, elm_scrollable_interface_bounce_allow_set(EINA_FALSE, _elm_config->thumbscroll_bounce_enable));
priv->box = elm_box_add(obj);
elm_box_homogeneous_set(priv->box, EINA_TRUE);
evas_object_size_hint_weight_set(priv->box, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(priv->box, EVAS_HINT_FILL, 0.0);