forked from enlightenment/efl
list: Check disabled status of an item in nearest visible item.
Also added a test for it.
This commit is contained in:
parent
9930b6ef43
commit
e79bbb2fb5
|
@ -1367,6 +1367,13 @@ _sel_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
timer = ecore_timer_add(1.5, _select_timer_cb, data);
|
timer = ecore_timer_add(1.5, _select_timer_cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_dis_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
elm_object_item_disabled_set(data, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
_focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
|
@ -1378,10 +1385,10 @@ static void
|
||||||
_test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
_test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *li, *btn, *bx, *bx2, *fr, *bx_opt, *chk, *bx_btn;
|
Evas_Object *win, *li, *btn, *bx, *bx2, *fr, *bx_opt, *chk, *bx_btn;
|
||||||
Evas_Object *btn_focus, *btn_sel, *bx_mv, *rd, *rdg;
|
Evas_Object *btn_focus, *btn_sel, *btn_dis, *bx_mv, *rd, *rdg;
|
||||||
unsigned int lhand, rhand, idx;
|
unsigned int lhand, rhand, idx;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
Elm_Object_Item *it = NULL, *it_3 = NULL;
|
Elm_Object_Item *it = NULL, *it_0 = NULL, *it_3 = NULL;
|
||||||
|
|
||||||
win = elm_win_util_standard_add(name, title);
|
win = elm_win_util_standard_add(name, title);
|
||||||
elm_win_autodel_set(win, EINA_TRUE);
|
elm_win_autodel_set(win, EINA_TRUE);
|
||||||
|
@ -1550,6 +1557,13 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
||||||
elm_box_pack_end(bx_btn, btn_sel);
|
elm_box_pack_end(bx_btn, btn_sel);
|
||||||
evas_object_show(btn_sel);
|
evas_object_show(btn_sel);
|
||||||
|
|
||||||
|
btn_dis = elm_button_add(bx_btn);
|
||||||
|
elm_object_text_set(btn_dis, "Disable 1st Item.");
|
||||||
|
evas_object_size_hint_weight_set(btn_dis, 0.0, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(btn_dis, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(bx_btn, btn_dis);
|
||||||
|
evas_object_show(btn_dis);
|
||||||
|
|
||||||
for (idx = 0; _list_focus_combo[idx] >= 0; idx++)
|
for (idx = 0; _list_focus_combo[idx] >= 0; idx++)
|
||||||
{
|
{
|
||||||
lhand = _list_focus_combo[idx] / 10;
|
lhand = _list_focus_combo[idx] / 10;
|
||||||
|
@ -1565,6 +1579,8 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
||||||
test_list_focus_content_get(li, lhand, horiz),
|
test_list_focus_content_get(li, lhand, horiz),
|
||||||
test_list_focus_content_get(li, rhand, horiz),
|
test_list_focus_content_get(li, rhand, horiz),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
if (idx == 0)
|
||||||
|
it_0 = it;
|
||||||
if (idx == 4)
|
if (idx == 4)
|
||||||
elm_object_item_disabled_set(it, EINA_TRUE);
|
elm_object_item_disabled_set(it, EINA_TRUE);
|
||||||
if (idx == 2)
|
if (idx == 2)
|
||||||
|
@ -1573,6 +1589,7 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
||||||
|
|
||||||
evas_object_smart_callback_add(btn_focus, "clicked", _focus_btn_cb, it_3);
|
evas_object_smart_callback_add(btn_focus, "clicked", _focus_btn_cb, it_3);
|
||||||
evas_object_smart_callback_add(btn_sel, "clicked", _sel_btn_cb, it_3);
|
evas_object_smart_callback_add(btn_sel, "clicked", _sel_btn_cb, it_3);
|
||||||
|
evas_object_smart_callback_add(btn_dis, "clicked", _dis_btn_cb, it_0);
|
||||||
|
|
||||||
elm_list_go(li);
|
elm_list_go(li);
|
||||||
evas_object_show(li);
|
evas_object_show(li);
|
||||||
|
|
|
@ -1084,25 +1084,33 @@ _elm_list_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *it)
|
||||||
Eina_List *item_list = NULL;
|
Eina_List *item_list = NULL;
|
||||||
Elm_Object_Item *item = NULL;
|
Elm_Object_Item *item = NULL;
|
||||||
ELM_LIST_DATA_GET(obj, sd);
|
ELM_LIST_DATA_GET(obj, sd);
|
||||||
|
Eina_Bool search_next = EINA_FALSE;
|
||||||
|
|
||||||
if (!it) return NULL;
|
if (!it) return NULL;
|
||||||
|
|
||||||
evas_object_geometry_get(obj, &vx, &vy, &vw, &vh);
|
evas_object_geometry_get(obj, &vx, &vy, &vw, &vh);
|
||||||
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
||||||
|
|
||||||
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
|
|
||||||
return it;
|
|
||||||
|
|
||||||
item_list = eina_list_data_find_list(sd->items, it);
|
item_list = eina_list_data_find_list(sd->items, it);
|
||||||
|
|
||||||
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
|
||||||
|
{
|
||||||
|
if (!elm_object_item_disabled_get(it))
|
||||||
|
return it;
|
||||||
|
else
|
||||||
|
search_next = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if ((!sd->h_mode && (iy < vy)) ||
|
if ((!sd->h_mode && (iy < vy)) ||
|
||||||
(sd->h_mode && (iw < vw)))
|
(sd->h_mode && (iw < vw)) ||
|
||||||
|
search_next)
|
||||||
{
|
{
|
||||||
while ((item_list = eina_list_next(item_list)))
|
while ((item_list = eina_list_next(item_list)))
|
||||||
{
|
{
|
||||||
item = eina_list_data_get(item_list);
|
item = eina_list_data_get(item_list);
|
||||||
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
||||||
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch))
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
||||||
|
!elm_object_item_disabled_get(item))
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1120,8 @@ _elm_list_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *it)
|
||||||
{
|
{
|
||||||
item = eina_list_data_get(item_list);
|
item = eina_list_data_get(item_list);
|
||||||
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
||||||
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch))
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
||||||
|
!elm_object_item_disabled_get(item))
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue