summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-24 01:51:37 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-24 01:52:07 +0900
commitc97c6d0d13de5af718e7fd4ee91968fc3447d94f (patch)
tree815a655b78d0a1d960ed17c6ec2e8dc70842d8a5
parente3511916bc90d8774a79b5519273e4067f65f2c3 (diff)
list: Check disabled status of an item in nearest visible item.
Also added a test for it.
-rw-r--r--src/bin/test_list.c21
-rw-r--r--src/lib/elm_list.c21
2 files changed, 34 insertions, 8 deletions
diff --git a/src/bin/test_list.c b/src/bin/test_list.c
index 6bfc5533c..d86486013 100644
--- a/src/bin/test_list.c
+++ b/src/bin/test_list.c
@@ -1368,6 +1368,13 @@ _sel_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
1368} 1368}
1369 1369
1370static void 1370static void
1371_dis_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
1372 void *event_info EINA_UNUSED)
1373{
1374 elm_object_item_disabled_set(data, EINA_TRUE);
1375}
1376
1377static void
1371_focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, 1378_focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
1372 void *event_info EINA_UNUSED) 1379 void *event_info EINA_UNUSED)
1373{ 1380{
@@ -1378,10 +1385,10 @@ static void
1378_test_list_focus(const char *name, const char *title, Eina_Bool horiz) 1385_test_list_focus(const char *name, const char *title, Eina_Bool horiz)
1379{ 1386{
1380 Evas_Object *win, *li, *btn, *bx, *bx2, *fr, *bx_opt, *chk, *bx_btn; 1387 Evas_Object *win, *li, *btn, *bx, *bx2, *fr, *bx_opt, *chk, *bx_btn;
1381 Evas_Object *btn_focus, *btn_sel, *bx_mv, *rd, *rdg; 1388 Evas_Object *btn_focus, *btn_sel, *btn_dis, *bx_mv, *rd, *rdg;
1382 unsigned int lhand, rhand, idx; 1389 unsigned int lhand, rhand, idx;
1383 char buf[256]; 1390 char buf[256];
1384 Elm_Object_Item *it = NULL, *it_3 = NULL; 1391 Elm_Object_Item *it = NULL, *it_0 = NULL, *it_3 = NULL;
1385 1392
1386 win = elm_win_util_standard_add(name, title); 1393 win = elm_win_util_standard_add(name, title);
1387 elm_win_autodel_set(win, EINA_TRUE); 1394 elm_win_autodel_set(win, EINA_TRUE);
@@ -1550,6 +1557,13 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
1550 elm_box_pack_end(bx_btn, btn_sel); 1557 elm_box_pack_end(bx_btn, btn_sel);
1551 evas_object_show(btn_sel); 1558 evas_object_show(btn_sel);
1552 1559
1560 btn_dis = elm_button_add(bx_btn);
1561 elm_object_text_set(btn_dis, "Disable 1st Item.");
1562 evas_object_size_hint_weight_set(btn_dis, 0.0, EVAS_HINT_EXPAND);
1563 evas_object_size_hint_align_set(btn_dis, EVAS_HINT_FILL, EVAS_HINT_FILL);
1564 elm_box_pack_end(bx_btn, btn_dis);
1565 evas_object_show(btn_dis);
1566
1553 for (idx = 0; _list_focus_combo[idx] >= 0; idx++) 1567 for (idx = 0; _list_focus_combo[idx] >= 0; idx++)
1554 { 1568 {
1555 lhand = _list_focus_combo[idx] / 10; 1569 lhand = _list_focus_combo[idx] / 10;
@@ -1565,6 +1579,8 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
1565 test_list_focus_content_get(li, lhand, horiz), 1579 test_list_focus_content_get(li, lhand, horiz),
1566 test_list_focus_content_get(li, rhand, horiz), 1580 test_list_focus_content_get(li, rhand, horiz),
1567 NULL, NULL); 1581 NULL, NULL);
1582 if (idx == 0)
1583 it_0 = it;
1568 if (idx == 4) 1584 if (idx == 4)
1569 elm_object_item_disabled_set(it, EINA_TRUE); 1585 elm_object_item_disabled_set(it, EINA_TRUE);
1570 if (idx == 2) 1586 if (idx == 2)
@@ -1573,6 +1589,7 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
1573 1589
1574 evas_object_smart_callback_add(btn_focus, "clicked", _focus_btn_cb, it_3); 1590 evas_object_smart_callback_add(btn_focus, "clicked", _focus_btn_cb, it_3);
1575 evas_object_smart_callback_add(btn_sel, "clicked", _sel_btn_cb, it_3); 1591 evas_object_smart_callback_add(btn_sel, "clicked", _sel_btn_cb, it_3);
1592 evas_object_smart_callback_add(btn_dis, "clicked", _dis_btn_cb, it_0);
1576 1593
1577 elm_list_go(li); 1594 elm_list_go(li);
1578 evas_object_show(li); 1595 evas_object_show(li);
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index 9b7212a08..aa0367ab0 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -1084,25 +1084,33 @@ _elm_list_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *it)
1084 Eina_List *item_list = NULL; 1084 Eina_List *item_list = NULL;
1085 Elm_Object_Item *item = NULL; 1085 Elm_Object_Item *item = NULL;
1086 ELM_LIST_DATA_GET(obj, sd); 1086 ELM_LIST_DATA_GET(obj, sd);
1087 Eina_Bool search_next = EINA_FALSE;
1087 1088
1088 if (!it) return NULL; 1089 if (!it) return NULL;
1089 1090
1090 evas_object_geometry_get(obj, &vx, &vy, &vw, &vh); 1091 evas_object_geometry_get(obj, &vx, &vy, &vw, &vh);
1091 evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih); 1092 evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
1092 1093
1093 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
1094 return it;
1095
1096 item_list = eina_list_data_find_list(sd->items, it); 1094 item_list = eina_list_data_find_list(sd->items, it);
1097 1095
1096 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
1097 {
1098 if (!elm_object_item_disabled_get(it))
1099 return it;
1100 else
1101 search_next = EINA_TRUE;
1102 }
1103
1098 if ((!sd->h_mode && (iy < vy)) || 1104 if ((!sd->h_mode && (iy < vy)) ||
1099 (sd->h_mode && (iw < vw))) 1105 (sd->h_mode && (iw < vw)) ||
1106 search_next)
1100 { 1107 {
1101 while ((item_list = eina_list_next(item_list))) 1108 while ((item_list = eina_list_next(item_list)))
1102 { 1109 {
1103 item = eina_list_data_get(item_list); 1110 item = eina_list_data_get(item_list);
1104 evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch); 1111 evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
1105 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch)) 1112 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
1113 !elm_object_item_disabled_get(item))
1106 return item; 1114 return item;
1107 } 1115 }
1108 } 1116 }
@@ -1112,7 +1120,8 @@ _elm_list_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *it)
1112 { 1120 {
1113 item = eina_list_data_get(item_list); 1121 item = eina_list_data_get(item_list);
1114 evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch); 1122 evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
1115 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch)) 1123 if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
1124 !elm_object_item_disabled_get(item))
1116 return item; 1125 return item;
1117 } 1126 }
1118 } 1127 }