summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-07-06 14:47:03 +0300
committerYossi Kantor <yossi.kantor@samsung.com>2014-08-03 14:50:41 +0300
commit098799231c36a5452ccb747cb0434cd16b3fdc18 (patch)
treede6b48f963cee6fca803e8847639c98c12a05e0b
parentb165ad46cd4b1ac1afbc9f71aaf1fe3aac8aa94a (diff)
Integration of Index item
-rw-r--r--src/lib/Makefile.am7
-rw-r--r--src/lib/elm_index.c324
-rw-r--r--src/lib/elm_index_item.eo48
-rw-r--r--src/lib/elm_widget_index.h29
4 files changed, 262 insertions, 146 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 1b795a5c3..3025c151b 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -792,7 +792,9 @@ BUILT_SOURCES = \
792 elm_menu_item.eo.c \ 792 elm_menu_item.eo.c \
793 elm_menu_item.eo.h \ 793 elm_menu_item.eo.h \
794 elm_ctxpopup_item.eo.c \ 794 elm_ctxpopup_item.eo.c \
795 elm_ctxpopup_item.eo.h 795 elm_ctxpopup_item.eo.h \
796 elm_index_item.eo.c \
797 elm_index_item.eo.h
796 798
797elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 799elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
798elementaryeolianfiles_DATA = \ 800elementaryeolianfiles_DATA = \
@@ -893,7 +895,8 @@ elementaryeolianfiles_DATA = \
893 elm_slideshow_item.eo \ 895 elm_slideshow_item.eo \
894 elm_flipselector_item.eo \ 896 elm_flipselector_item.eo \
895 elm_menu_item.eo \ 897 elm_menu_item.eo \
896 elm_ctxpopup_item.eo 898 elm_ctxpopup_item.eo \
899 elm_index_item.eo
897 900
898EXTRA_DIST += \ 901EXTRA_DIST += \
899 ${elementaryeolianfiles_DATA} 902 ${elementaryeolianfiles_DATA}
diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index 0f32959a0..4517b688a 100644
--- a/src/lib/elm_index.c
+++ b/src/lib/elm_index.c
@@ -36,11 +36,12 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
36}; 36};
37 37
38static void 38static void
39_item_free(Elm_Index_Item *it) 39_item_free(Elm_Widobj_Item *eo_item)
40{ 40{
41 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
41 ELM_INDEX_DATA_GET(WIDGET(it), sd); 42 ELM_INDEX_DATA_GET(WIDGET(it), sd);
42 43
43 sd->items = eina_list_remove(sd->items, it); 44 sd->items = eina_list_remove(sd->items, eo_item);
44 45
45 if (it->omitted) 46 if (it->omitted)
46 it->omitted = eina_list_free(it->omitted); 47 it->omitted = eina_list_free(it->omitted);
@@ -63,14 +64,15 @@ _index_box_clear(Evas_Object *obj,
63 int level) 64 int level)
64{ 65{
65 Eina_List *l; 66 Eina_List *l;
66 Elm_Index_Item *it; 67 Elm_Widobj_Item *eo_item;
67 68
68 ELM_INDEX_DATA_GET(obj, sd); 69 ELM_INDEX_DATA_GET(obj, sd);
69 70
70 if (!sd->level_active[level]) return; 71 if (!sd->level_active[level]) return;
71 72
72 EINA_LIST_FOREACH(sd->items, l, it) 73 EINA_LIST_FOREACH(sd->items, l, eo_item)
73 { 74 {
75 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
74 if (it->level != level) continue; 76 if (it->level != level) continue;
75 ELM_SAFE_FREE(VIEW(it), evas_object_del); 77 ELM_SAFE_FREE(VIEW(it), evas_object_del);
76 } 78 }
@@ -94,9 +96,10 @@ _access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
94{ 96{
95 const char *txt = NULL; 97 const char *txt = NULL;
96 98
97 Elm_Index_Item *it = (Elm_Index_Item *)data; 99 Elm_Widobj_Item *eo_item = (Elm_Widobj_Item *)data;
98 ELM_INDEX_ITEM_CHECK_OR_RETURN(it, NULL); 100 ELM_INDEX_ITEM_CHECK_OR_RETURN(eo_item, NULL);
99 101
102 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
100 txt = elm_widget_access_info_get(obj); 103 txt = elm_widget_access_info_get(obj);
101 if (!txt) txt = it->letter; 104 if (!txt) txt = it->letter;
102 if (txt) return strdup(txt); 105 if (txt) return strdup(txt);
@@ -104,17 +107,20 @@ _access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
104 return NULL; 107 return NULL;
105} 108}
106 109
107static void 110EOLIAN static Evas_Object*
108_access_widget_item_register(Elm_Index_Item *it) 111_elm_index_item_elm_widget_item_access_register(Eo *eo_item, Elm_Index_Item_Data *it)
109{ 112{
110 Elm_Access_Info *ai; 113 Elm_Access_Info *ai;
111 114
112 _elm_access_widget_item_register((Elm_Widget_Item *)it); 115 Evas_Object *ret = NULL;
116 eo_do_super(eo_item, ELM_INDEX_ITEM_CLASS, ret = elm_wdg_item_access_register());
113 117
114 ai = _elm_access_info_get(it->base.access_obj); 118 ai = _elm_access_info_get(it->base->access_obj);
115 119
116 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Index Item")); 120 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Index Item"));
117 _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it); 121 _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, eo_item);
122
123 return ret;
118} 124}
119 125
120static void 126static void
@@ -181,7 +187,7 @@ _index_box_auto_fill(Evas_Object *obj,
181 int i = 0, max_num_of_items = 0, num_of_items = 0, g = 0, skip = 0; 187 int i = 0, max_num_of_items = 0, num_of_items = 0, g = 0, skip = 0;
182 Eina_List *l; 188 Eina_List *l;
183 Eina_Bool rtl; 189 Eina_Bool rtl;
184 Elm_Index_Item *it, *head = NULL; 190 Elm_Widobj_Item *eo_item, *eo_head = NULL;
185 Evas_Coord mw, mh, ih; 191 Evas_Coord mw, mh, ih;
186 Evas_Object *o; 192 Evas_Object *o;
187 Elm_Index_Omit *om; 193 Elm_Index_Omit *om;
@@ -199,8 +205,9 @@ _index_box_auto_fill(Evas_Object *obj,
199 EINA_LIST_FREE(sd->omit, om) 205 EINA_LIST_FREE(sd->omit, om)
200 free(om); 206 free(om);
201 207
202 EINA_LIST_FOREACH(sd->items, l, it) 208 EINA_LIST_FOREACH(sd->items, l, eo_item)
203 { 209 {
210 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
204 if (it->omitted) 211 if (it->omitted)
205 it->omitted = eina_list_free(it->omitted); 212 it->omitted = eina_list_free(it->omitted);
206 if (it->head) it->head = NULL; 213 if (it->head) it->head = NULL;
@@ -216,8 +223,11 @@ _index_box_auto_fill(Evas_Object *obj,
216 223
217 evas_object_del(o); 224 evas_object_del(o);
218 225
219 EINA_LIST_FOREACH(sd->items, l, it) 226 EINA_LIST_FOREACH(sd->items, l, eo_item)
220 if (it->level == level) num_of_items++; 227 {
228 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
229 if (it->level == level) num_of_items++;
230 }
221 231
222 if (mh != 0) 232 if (mh != 0)
223 max_num_of_items = ih / mh; 233 max_num_of_items = ih / mh;
@@ -226,9 +236,10 @@ _index_box_auto_fill(Evas_Object *obj,
226 } 236 }
227 237
228 om = eina_list_nth(sd->omit, g); 238 om = eina_list_nth(sd->omit, g);
229 EINA_LIST_FOREACH(sd->items, l, it) 239 EINA_LIST_FOREACH(sd->items, l, eo_item)
230 { 240 {
231 const char *stacking; 241 const char *stacking;
242 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
232 243
233 if (it->level != level) continue; 244 if (it->level != level) continue;
234 245
@@ -236,22 +247,24 @@ _index_box_auto_fill(Evas_Object *obj,
236 { 247 {
237 skip = om->count; 248 skip = om->count;
238 skip--; 249 skip--;
239 head = it; 250 eo_head = eo_item;
240 it->head = head; 251 it->head = eo_head;
241 head->omitted = eina_list_append(head->omitted, it); 252 ELM_INDEX_ITEM_DATA_GET(eo_head, head);
253 head->omitted = eina_list_append(head->omitted, eo_item);
242 om = eina_list_nth(sd->omit, ++g); 254 om = eina_list_nth(sd->omit, ++g);
243 } 255 }
244 else if (skip > 0) 256 else if (skip > 0)
245 { 257 {
246 skip--; 258 skip--;
247 i++; 259 i++;
248 if (head) 260 if (eo_head)
249 { 261 {
250 it->head = head; 262 it->head = eo_head;
251 head->omitted = eina_list_append(head->omitted, it); 263 ELM_INDEX_ITEM_DATA_GET(eo_head, head);
252 // if it is selected but omitted, send signal to it's head 264 head->omitted = eina_list_append(head->omitted, eo_item);
265 // if item is selected but omitted, send signal to item's head
253 if (it->selected) 266 if (it->selected)
254 edje_object_signal_emit(VIEW(it->head), "elm,state,active", "elm"); 267 edje_object_signal_emit(VIEW(ELM_INDEX_ITEM_DATA(it->head)), "elm,state,active", "elm");
255 } 268 }
256 continue; 269 continue;
257 } 270 }
@@ -308,7 +321,7 @@ _index_box_auto_fill(Evas_Object *obj,
308 // ACCESS 321 // ACCESS
309 if ((it->level == 0) && 322 if ((it->level == 0) &&
310 (_elm_config->access_mode == ELM_ACCESS_MODE_ON)) 323 (_elm_config->access_mode == ELM_ACCESS_MODE_ON))
311 _access_widget_item_register(it); 324 eo_do(eo_item, elm_wdg_item_access_register());
312 } 325 }
313 326
314 evas_object_smart_calculate(sd->bx[level]); 327 evas_object_smart_calculate(sd->bx[level]);
@@ -319,7 +332,7 @@ EOLIAN static Eina_Bool
319_elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data *sd) 332_elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data *sd)
320{ 333{
321 Evas_Coord minw = 0, minh = 0; 334 Evas_Coord minw = 0, minh = 0;
322 Elm_Index_Item *it; 335 Elm_Widobj_Item *eo_item;
323 336
324 Eina_Bool int_ret = EINA_FALSE; 337 Eina_Bool int_ret = EINA_FALSE;
325 338
@@ -383,11 +396,12 @@ _elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data *sd)
383 } 396 }
384 else elm_layout_signal_emit(obj, "elm,state,inactive", "elm"); 397 else elm_layout_signal_emit(obj, "elm,state,inactive", "elm");
385 398
386 it = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); 399 eo_item = (Elm_Widobj_Item *)elm_index_selected_item_get(obj, sd->level);
387 if (it) 400 if (eo_item)
388 { 401 {
402 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
389 if (it->head) 403 if (it->head)
390 edje_object_signal_emit(VIEW(it->head), "elm,state,active", "elm"); 404 edje_object_signal_emit(VIEW(ELM_INDEX_ITEM_DATA(it->head)), "elm,state,active", "elm");
391 else 405 else
392 edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); 406 edje_object_signal_emit(VIEW(it), "elm,state,active", "elm");
393 } 407 }
@@ -410,51 +424,61 @@ _elm_index_elm_layout_sizing_eval(Eo *obj, Elm_Index_Data *_pd EINA_UNUSED)
410 evas_object_size_hint_max_set(obj, -1, -1); 424 evas_object_size_hint_max_set(obj, -1, -1);
411} 425}
412 426
413static Eina_Bool 427EOLIAN static Eina_Bool
414_item_del_pre_hook(Elm_Object_Item *it) 428_elm_index_item_elm_widget_item_del_pre(Eo *eo_item, Elm_Index_Item_Data *it)
415{ 429{
416 ELM_INDEX_DATA_GET(WIDGET(it), sd); 430 ELM_INDEX_DATA_GET(WIDGET(it), sd);
417 431
418 _item_free((Elm_Index_Item *)it); 432 _item_free((Elm_Widobj_Item *)eo_item);
419 _index_box_clear(WIDGET(it), sd->level); 433 _index_box_clear(WIDGET(it), sd->level);
420 434
421 return EINA_TRUE; 435 return EINA_TRUE;
422} 436}
423 437
424static Elm_Index_Item * 438EOLIAN static void
439_elm_index_item_eo_base_constructor(Eo *obj, Elm_Index_Item_Data *it)
440{
441 eo_do_super(obj, ELM_INDEX_ITEM_CLASS, eo_constructor());
442 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
443}
444
445static Elm_Widobj_Item *
425_item_new(Evas_Object *obj, 446_item_new(Evas_Object *obj,
426 const char *letter, 447 const char *letter,
427 Evas_Smart_Cb func, 448 Evas_Smart_Cb func,
428 const void *data) 449 const void *data)
429{ 450{
430 Elm_Index_Item *it; 451 Elm_Widobj_Item *eo_item;
431 452
432 ELM_INDEX_DATA_GET(obj, sd); 453 ELM_INDEX_DATA_GET(obj, sd);
433 454
434 it = elm_widget_item_new(obj, Elm_Index_Item); 455 eo_item = eo_add (ELM_INDEX_ITEM_CLASS, obj);
435 if (!it) return NULL; 456 if (!eo_item) return NULL;
457
458 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
436 459
437 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
438 if (letter) it->letter = eina_stringshare_add(letter); 460 if (letter) it->letter = eina_stringshare_add(letter);
439 it->func = func; 461 it->func = func;
440 it->base.data = data; 462 it->base->data = data;
441 it->level = sd->level; 463 it->level = sd->level;
442 464
443 return it; 465 return eo_item;
444} 466}
445 467
446static Elm_Index_Item * 468static Elm_Widobj_Item *
447_item_find(Evas_Object *obj, 469_item_find(Evas_Object *obj,
448 const void *data) 470 const void *data)
449{ 471{
450 Eina_List *l; 472 Eina_List *l;
451 Elm_Index_Item *it; 473 Elm_Widobj_Item *eo_item;
452 474
453 ELM_INDEX_DATA_GET(obj, sd); 475 ELM_INDEX_DATA_GET(obj, sd);
454 476
455 EINA_LIST_FOREACH(sd->items, l, it) 477 EINA_LIST_FOREACH(sd->items, l, eo_item)
456 if (it->base.data == data) return it; 478 {
457 479 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
480 if (it->base->data == data) return eo_item;
481 }
458 return NULL; 482 return NULL;
459} 483}
460 484
@@ -478,7 +502,7 @@ _sel_eval(Evas_Object *obj,
478 Evas_Coord evy) 502 Evas_Coord evy)
479{ 503{
480 Evas_Coord x, y, w, h, bx, by, bw, bh, xx, yy; 504 Evas_Coord x, y, w, h, bx, by, bw, bh, xx, yy;
481 Elm_Index_Item *it, *it_closest, *it_last, *om_closest; 505 Elm_Widobj_Item *eo_item, *it_closest, *it_last, *om_closest;
482 char *label = NULL, *last = NULL; 506 char *label = NULL, *last = NULL;
483 double cdv = 0.5; 507 double cdv = 0.5;
484 Evas_Coord dist; 508 Evas_Coord dist;
@@ -496,21 +520,22 @@ _sel_eval(Evas_Object *obj,
496 dist = 0x7fffffff; 520 dist = 0x7fffffff;
497 evas_object_geometry_get(sd->bx[i], &bx, &by, &bw, &bh); 521 evas_object_geometry_get(sd->bx[i], &bx, &by, &bw, &bh);
498 522
499 EINA_LIST_FOREACH(sd->items, l, it) 523 EINA_LIST_FOREACH(sd->items, l, eo_item)
500 { 524 {
525 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
501 if (it->level != i) continue; 526 if (it->level != i) continue;
502 if (it->level != sd->level) 527 if (it->level != sd->level)
503 { 528 {
504 if (it->selected) 529 if (it->selected)
505 { 530 {
506 it_closest = it; 531 it_closest = eo_item;
507 break; 532 break;
508 } 533 }
509 continue; 534 continue;
510 } 535 }
511 if (it->selected) 536 if (it->selected)
512 { 537 {
513 it_last = it; 538 it_last = eo_item;
514 it->selected = EINA_FALSE; 539 it->selected = EINA_FALSE;
515 } 540 }
516 if (VIEW(it)) 541 if (VIEW(it))
@@ -527,7 +552,7 @@ _sel_eval(Evas_Object *obj,
527 cdv = (double)(xx - bx) / (double)bw; 552 cdv = (double)(xx - bx) / (double)bw;
528 else 553 else
529 cdv = (double)(yy - by) / (double)bh; 554 cdv = (double)(yy - by) / (double)bh;
530 it_closest = it; 555 it_closest = eo_item;
531 dist = x; 556 dist = x;
532 } 557 }
533 } 558 }
@@ -536,9 +561,10 @@ _sel_eval(Evas_Object *obj,
536 edje_object_part_drag_value_set 561 edje_object_part_drag_value_set
537 (wd->resize_obj, "elm.dragable.index.1", cdv, cdv); 562 (wd->resize_obj, "elm.dragable.index.1", cdv, cdv);
538 563
539 if (it_closest && it_closest->omitted) 564 if (it_closest && ELM_INDEX_ITEM_DATA(it_closest)->omitted)
540 { 565 {
541 it = it_closest; 566 eo_item = it_closest;
567 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
542 size = eina_list_count(it->omitted); 568 size = eina_list_count(it->omitted);
543 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); 569 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
544 dist = 0x7fffffff; 570 dist = 0x7fffffff;
@@ -563,8 +589,8 @@ _sel_eval(Evas_Object *obj,
563 } 589 }
564 } 590 }
565 591
566 if (om_closest) om_closest->selected = EINA_TRUE; 592 if (om_closest) ELM_INDEX_ITEM_DATA(om_closest)->selected = EINA_TRUE;
567 else if (it_closest) it_closest->selected = EINA_TRUE; 593 else if (it_closest) ELM_INDEX_ITEM_DATA(it_closest)->selected = EINA_TRUE;
568 594
569 if (it_closest != it_last) 595 if (it_closest != it_last)
570 { 596 {
@@ -572,14 +598,16 @@ _sel_eval(Evas_Object *obj,
572 { 598 {
573 const char *stacking, *selectraise; 599 const char *stacking, *selectraise;
574 600
575 it = it_last; 601 eo_item = it_last;
602 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
576 if (it->head) 603 if (it->head)
577 { 604 {
578 if (it->head != it_closest) it = it->head; 605 if (it->head != it_closest) eo_item = it->head;
579 else it = NULL; 606 else eo_item = NULL;
580 } 607 }
581 if (it) 608 if (eo_item)
582 { 609 {
610 it = ELM_INDEX_ITEM_DATA(eo_item);
583 edje_object_signal_emit 611 edje_object_signal_emit
584 (VIEW(it), "elm,state,inactive", "elm"); 612 (VIEW(it), "elm,state,inactive", "elm");
585 stacking = edje_object_data_get(VIEW(it), "stacking"); 613 stacking = edje_object_data_get(VIEW(it), "stacking");
@@ -595,9 +623,10 @@ _sel_eval(Evas_Object *obj,
595 { 623 {
596 const char *selectraise; 624 const char *selectraise;
597 625
598 it = it_closest; 626 eo_item = it_closest;
627 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
599 628
600 if (!((it_last) && (it_last->head) && (it_last->head == it_closest))) 629 if (!((it_last) && (ELM_INDEX_ITEM_DATA(it_last)->head) && (ELM_INDEX_ITEM_DATA(it_last)->head == it_closest)))
601 { 630 {
602 edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); 631 edje_object_signal_emit(VIEW(it), "elm,state,active", "elm");
603 selectraise = edje_object_data_get(VIEW(it), "selectraise"); 632 selectraise = edje_object_data_get(VIEW(it), "selectraise");
@@ -613,13 +642,13 @@ _sel_eval(Evas_Object *obj,
613 buf = eina_strbuf_new(); 642 buf = eina_strbuf_new();
614 643
615 if (om_closest) 644 if (om_closest)
616 eina_strbuf_append_printf(buf, "index item %s clicked", om_closest->letter); 645 eina_strbuf_append_printf(buf, "index item %s clicked", ELM_INDEX_ITEM_DATA(om_closest)->letter);
617 else 646 else
618 eina_strbuf_append_printf(buf, "index item %s clicked", it->letter); 647 eina_strbuf_append_printf(buf, "index item %s clicked", it->letter);
619 ret = eina_strbuf_string_steal(buf); 648 ret = eina_strbuf_string_steal(buf);
620 eina_strbuf_free(buf); 649 eina_strbuf_free(buf);
621 650
622 _elm_access_highlight_set(it->base.access_obj); 651 _elm_access_highlight_set(it->base->access_obj);
623 _elm_access_say(ret); 652 _elm_access_say(ret);
624 } 653 }
625 654
@@ -628,7 +657,7 @@ _sel_eval(Evas_Object *obj,
628 (obj, SIG_CHANGED, om_closest); 657 (obj, SIG_CHANGED, om_closest);
629 else 658 else
630 evas_object_smart_callback_call 659 evas_object_smart_callback_call
631 (obj, SIG_CHANGED, it); 660 (obj, SIG_CHANGED, eo_item);
632 ecore_timer_del(sd->delay); 661 ecore_timer_del(sd->delay);
633 sd->delay = ecore_timer_add(sd->delay_change_time, 662 sd->delay = ecore_timer_add(sd->delay_change_time,
634 _delay_change_cb, obj); 663 _delay_change_cb, obj);
@@ -636,8 +665,9 @@ _sel_eval(Evas_Object *obj,
636 } 665 }
637 if (it_closest) 666 if (it_closest)
638 { 667 {
639 if (om_closest) it = om_closest; 668 if (om_closest) eo_item = om_closest;
640 else it = it_closest; 669 else eo_item = it_closest;
670 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
641 if (!last && it->letter) last = strdup(it->letter); 671 if (!last && it->letter) last = strdup(it->letter);
642 else 672 else
643 { 673 {
@@ -706,7 +736,7 @@ _on_mouse_up(void *data,
706{ 736{
707 Evas_Event_Mouse_Up *ev = event_info; 737 Evas_Event_Mouse_Up *ev = event_info;
708 Elm_Object_Item *item; 738 Elm_Object_Item *item;
709 Elm_Index_Item *id_item; 739 Elm_Widobj_Item *eo_id_item;
710 740
711 ELM_INDEX_DATA_GET(data, sd); 741 ELM_INDEX_DATA_GET(data, sd);
712 742
@@ -716,9 +746,10 @@ _on_mouse_up(void *data,
716 if (item) 746 if (item)
717 { 747 {
718 evas_object_smart_callback_call(data, SIG_SELECTED, item); 748 evas_object_smart_callback_call(data, SIG_SELECTED, item);
719 id_item = (Elm_Index_Item *)item; 749 eo_id_item = (Elm_Widobj_Item *)item;
750 ELM_INDEX_ITEM_DATA_GET(eo_id_item, id_item);
720 if (id_item->func) 751 if (id_item->func)
721 id_item->func((void *)id_item->base.data, WIDGET(id_item), id_item); 752 id_item->func((void *)id_item->base->data, WIDGET(id_item), eo_id_item);
722 } 753 }
723 if (!sd->autohide_disabled) 754 if (!sd->autohide_disabled)
724 elm_layout_signal_emit(data, "elm,state,inactive", "elm"); 755 elm_layout_signal_emit(data, "elm,state,inactive", "elm");
@@ -804,7 +835,7 @@ _on_mouse_move_access(void *data,
804{ 835{
805 836
806 Evas_Event_Mouse_Down *ev = event_info; 837 Evas_Event_Mouse_Down *ev = event_info;
807 Elm_Index_Item *it, *it_closest; 838 Elm_Widobj_Item *eo_item, *it_closest;
808 Eina_List *l; 839 Eina_List *l;
809 Evas_Coord dist = 0; 840 Evas_Coord dist = 0;
810 Evas_Coord x, y, w, h, xx, yy; 841 Evas_Coord x, y, w, h, xx, yy;
@@ -814,8 +845,9 @@ _on_mouse_move_access(void *data,
814 it_closest = NULL; 845 it_closest = NULL;
815 dist = 0x7fffffff; 846 dist = 0x7fffffff;
816 847
817 EINA_LIST_FOREACH(sd->items, l, it) 848 EINA_LIST_FOREACH(sd->items, l, eo_item)
818 { 849 {
850 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
819 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); 851 evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
820 xx = x + (w / 2); 852 xx = x + (w / 2);
821 yy = y + (h / 2); 853 yy = y + (h / 2);
@@ -824,13 +856,13 @@ _on_mouse_move_access(void *data,
824 x = (x * x) + (y * y); 856 x = (x * x) + (y * y);
825 if ((x < dist) || (!it_closest)) 857 if ((x < dist) || (!it_closest))
826 { 858 {
827 it_closest = it; 859 it_closest = eo_item;
828 dist = x; 860 dist = x;
829 } 861 }
830 } 862 }
831 863
832 if (it_closest) 864 if (it_closest)
833 _elm_access_highlight_set(it_closest->base.access_obj); 865 _elm_access_highlight_set(ELM_INDEX_ITEM_DATA(it_closest)->base->access_obj);
834} 866}
835 867
836static void 868static void
@@ -855,16 +887,17 @@ _index_resize_cb(void *data EINA_UNUSED,
855 887
856 if (!sd->omit_enabled) return; 888 if (!sd->omit_enabled) return;
857 889
858 Elm_Index_Item *it; 890 Elm_Widobj_Item *eo_item;
859 891
860 _index_box_clear(obj, 0); 892 _index_box_clear(obj, 0);
861 _index_box_auto_fill(obj, 0); 893 _index_box_auto_fill(obj, 0);
862 894
863 it = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); 895 eo_item = (Elm_Widobj_Item *)elm_index_selected_item_get(obj, sd->level);
864 if (it) 896 if (eo_item)
865 { 897 {
898 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
866 if (it->head) 899 if (it->head)
867 edje_object_signal_emit(VIEW(it->head), "elm,state,active", "elm"); 900 edje_object_signal_emit(VIEW(ELM_INDEX_ITEM_DATA(it->head)), "elm,state,active", "elm");
868 else 901 else
869 edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); 902 edje_object_signal_emit(VIEW(it), "elm,state,active", "elm");
870 } 903 }
@@ -954,7 +987,7 @@ _elm_index_evas_object_smart_del(Eo *obj, Elm_Index_Data *sd)
954 Elm_Index_Omit *o; 987 Elm_Index_Omit *o;
955 988
956 while (sd->items) 989 while (sd->items)
957 elm_widget_item_del(sd->items->data); 990 eo_do (sd->items->data, elm_wdg_item_del());
958 991
959 EINA_LIST_FREE(sd->omit, o) 992 EINA_LIST_FREE(sd->omit, o)
960 free(o); 993 free(o);
@@ -985,7 +1018,7 @@ _elm_index_elm_widget_focus_next(Eo *obj, Elm_Index_Data *sd, Elm_Focus_Directio
985 1018
986 Eina_List *items = NULL; 1019 Eina_List *items = NULL;
987 Eina_List *l = NULL; 1020 Eina_List *l = NULL;
988 Elm_Index_Item *it; 1021 Elm_Widobj_Item *eo_item;
989 Evas_Object *ao; 1022 Evas_Object *ao;
990 Evas_Object *po; 1023 Evas_Object *po;
991 1024
@@ -997,10 +1030,11 @@ _elm_index_elm_widget_focus_next(Eo *obj, Elm_Index_Data *sd, Elm_Focus_Directio
997 ao = evas_object_data_get(po, "_part_access_obj"); 1030 ao = evas_object_data_get(po, "_part_access_obj");
998 items = eina_list_append(items, ao); 1031 items = eina_list_append(items, ao);
999 1032
1000 EINA_LIST_FOREACH(sd->items, l, it) 1033 EINA_LIST_FOREACH(sd->items, l, eo_item)
1001 { 1034 {
1035 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1002 if (it->level != 0) continue; 1036 if (it->level != 0) continue;
1003 items = eina_list_append(items, it->base.access_obj); 1037 items = eina_list_append(items, it->base->access_obj);
1004 } 1038 }
1005 1039
1006 int_ret = elm_widget_focus_list_next_get 1040 int_ret = elm_widget_focus_list_next_get
@@ -1017,15 +1051,16 @@ static void
1017_access_obj_process(Evas_Object *obj, Eina_Bool is_access) 1051_access_obj_process(Evas_Object *obj, Eina_Bool is_access)
1018{ 1052{
1019 Eina_List *l; 1053 Eina_List *l;
1020 Elm_Index_Item *it; 1054 Elm_Widobj_Item *eo_item;
1021 1055
1022 ELM_INDEX_DATA_GET(obj, sd); 1056 ELM_INDEX_DATA_GET(obj, sd);
1023 1057
1024 EINA_LIST_FOREACH(sd->items, l, it) 1058 EINA_LIST_FOREACH(sd->items, l, eo_item)
1025 { 1059 {
1060 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1026 if (it->level != 0) continue; 1061 if (it->level != 0) continue;
1027 if (is_access) _access_widget_item_register(it); 1062 if (is_access) eo_do(eo_item, elm_wdg_item_access_register());
1028 else _elm_access_widget_item_unregister((Elm_Widget_Item *)it); 1063 else eo_do(eo_item, elm_wdg_item_access_unregister());
1029 } 1064 }
1030 1065
1031 if (is_access) 1066 if (is_access)
@@ -1118,32 +1153,35 @@ _elm_index_item_level_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd)
1118} 1153}
1119 1154
1120//FIXME: Should update indicator based on the autohidden status & indicator visibility 1155//FIXME: Should update indicator based on the autohidden status & indicator visibility
1121EAPI void 1156EOLIAN static void
1122elm_index_item_selected_set(Elm_Object_Item *it, 1157_elm_index_item_selected_set(Eo *eo_it_sel,
1123 Eina_Bool selected) 1158 Elm_Index_Item_Data *it_sel,
1159 Eina_Bool selected)
1124{ 1160{
1125 Elm_Index_Item *it_sel, *it_last, *it_inactive, *it_active; 1161 Elm_Widobj_Item *eo_it_last, *eo_it_inactive, *eo_it_active;
1126 Evas_Object *obj = WIDGET(it); 1162
1163 Evas_Object *obj = WIDGET(it_sel);
1127 1164
1128 ELM_INDEX_ITEM_CHECK_OR_RETURN(it);
1129 ELM_INDEX_DATA_GET(obj, sd); 1165 ELM_INDEX_DATA_GET(obj, sd);
1130 1166
1131 selected = !!selected; 1167 selected = !!selected;
1132 it_sel = (Elm_Index_Item *)it; 1168
1133 if (it_sel->selected == selected) return; 1169 if (it_sel->selected == selected) return;
1134 1170
1135 if (selected) 1171 if (selected)
1136 { 1172 {
1137 it_last = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); 1173 eo_it_last = (Elm_Widobj_Item *)elm_index_selected_item_get(obj, sd->level);
1138 1174
1139 if (it_last) 1175 if (eo_it_last)
1140 { 1176 {
1177 ELM_INDEX_ITEM_DATA_GET(eo_it_last, it_last);
1141 it_last->selected = EINA_FALSE; 1178 it_last->selected = EINA_FALSE;
1142 if (it_last->head) 1179 if (it_last->head)
1143 it_inactive = it_last->head; 1180 eo_it_inactive = it_last->head;
1144 else 1181 else
1145 it_inactive = it_last; 1182 eo_it_inactive = eo_it_last;
1146 1183
1184 ELM_INDEX_ITEM_DATA_GET(eo_it_inactive, it_inactive);
1147 edje_object_signal_emit(VIEW(it_inactive), 1185 edje_object_signal_emit(VIEW(it_inactive),
1148 "elm,state,inactive", "elm"); 1186 "elm,state,inactive", "elm");
1149 edje_object_message_signal_process(VIEW(it_inactive)); 1187 edje_object_message_signal_process(VIEW(it_inactive));
@@ -1151,17 +1189,19 @@ elm_index_item_selected_set(Elm_Object_Item *it,
1151 1189
1152 it_sel->selected = EINA_TRUE; 1190 it_sel->selected = EINA_TRUE;
1153 if (it_sel->head) 1191 if (it_sel->head)
1154 it_active = it_sel->head; 1192 eo_it_active = it_sel->head;
1155 else 1193 else
1156 it_active = it_sel; 1194 eo_it_active = eo_it_sel;
1195
1196 ELM_INDEX_ITEM_DATA_GET(eo_it_active, it_active);
1157 1197
1158 edje_object_signal_emit(VIEW(it_active), "elm,state,active", "elm"); 1198 edje_object_signal_emit(VIEW(it_active), "elm,state,active", "elm");
1159 edje_object_message_signal_process(VIEW(it_active)); 1199 edje_object_message_signal_process(VIEW(it_active));
1160 1200
1161 evas_object_smart_callback_call 1201 evas_object_smart_callback_call
1162 (obj, SIG_CHANGED, it); 1202 (obj, SIG_CHANGED, eo_it_sel);
1163 evas_object_smart_callback_call 1203 evas_object_smart_callback_call
1164 (obj, SIG_SELECTED, it); 1204 (obj, SIG_SELECTED, eo_it_sel);
1165 ecore_timer_del(sd->delay); 1205 ecore_timer_del(sd->delay);
1166 sd->delay = ecore_timer_add(sd->delay_change_time, 1206 sd->delay = ecore_timer_add(sd->delay_change_time,
1167 _delay_change_cb, obj); 1207 _delay_change_cb, obj);
@@ -1170,12 +1210,12 @@ elm_index_item_selected_set(Elm_Object_Item *it,
1170 { 1210 {
1171 it_sel->selected = EINA_FALSE; 1211 it_sel->selected = EINA_FALSE;
1172 if (it_sel->head) 1212 if (it_sel->head)
1173 it_inactive = it_sel->head; 1213 eo_it_inactive = it_sel->head;
1174 else 1214 else
1175 it_inactive = it_sel; 1215 eo_it_inactive = eo_it_sel;
1176 1216
1177 edje_object_signal_emit(VIEW(it_inactive), "elm,state,inactive", "elm"); 1217 edje_object_signal_emit(VIEW(ELM_INDEX_ITEM_DATA(eo_it_inactive)), "elm,state,inactive", "elm");
1178 edje_object_message_signal_process(VIEW(it_inactive)); 1218 edje_object_message_signal_process(VIEW(ELM_INDEX_ITEM_DATA(eo_it_inactive)));
1179 1219
1180 // for the case in which the selected item is unselected before mouse up 1220 // for the case in which the selected item is unselected before mouse up
1181 elm_layout_signal_emit(obj, "elm,indicator,state,inactive", "elm"); 1221 elm_layout_signal_emit(obj, "elm,indicator,state,inactive", "elm");
@@ -1186,13 +1226,14 @@ EOLIAN static Elm_Object_Item*
1186_elm_index_selected_item_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd, int level) 1226_elm_index_selected_item_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd, int level)
1187{ 1227{
1188 Eina_List *l; 1228 Eina_List *l;
1189 Elm_Index_Item *it; 1229 Elm_Widobj_Item *eo_item;
1190 1230
1191 EINA_LIST_FOREACH(sd->items, l, it) 1231 EINA_LIST_FOREACH(sd->items, l, eo_item)
1192 { 1232 {
1233 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1193 if ((it->selected) && (it->level == level)) 1234 if ((it->selected) && (it->level == level))
1194 { 1235 {
1195 return (Elm_Object_Item *)it; 1236 return (Elm_Object_Item *)eo_item;
1196 } 1237 }
1197 } 1238 }
1198 1239
@@ -1202,8 +1243,7 @@ _elm_index_selected_item_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd, int level)
1202EOLIAN static Elm_Object_Item* 1243EOLIAN static Elm_Object_Item*
1203_elm_index_item_append(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data) 1244_elm_index_item_append(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data)
1204{ 1245{
1205 Elm_Index_Item *it; 1246 Elm_Widobj_Item *it;
1206
1207 1247
1208 it = _item_new(obj, letter, func, data); 1248 it = _item_new(obj, letter, func, data);
1209 if (!it) return NULL; 1249 if (!it) return NULL;
@@ -1217,7 +1257,7 @@ _elm_index_item_append(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Sma
1217EOLIAN static Elm_Object_Item* 1257EOLIAN static Elm_Object_Item*
1218_elm_index_item_prepend(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data) 1258_elm_index_item_prepend(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data)
1219{ 1259{
1220 Elm_Index_Item *it; 1260 Elm_Widobj_Item *it;
1221 1261
1222 it = _item_new(obj, letter, func, data); 1262 it = _item_new(obj, letter, func, data);
1223 if (!it) return NULL; 1263 if (!it) return NULL;
@@ -1241,7 +1281,7 @@ elm_index_item_prepend_relative(Evas_Object *obj,
1241EOLIAN static Elm_Object_Item* 1281EOLIAN static Elm_Object_Item*
1242_elm_index_item_insert_after(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data) 1282_elm_index_item_insert_after(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data)
1243{ 1283{
1244 Elm_Index_Item *it; 1284 Elm_Widobj_Item *it;
1245 1285
1246 1286
1247 if (!after) return elm_index_item_append(obj, letter, func, data); 1287 if (!after) return elm_index_item_append(obj, letter, func, data);
@@ -1258,7 +1298,7 @@ _elm_index_item_insert_after(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *after
1258EOLIAN static Elm_Object_Item* 1298EOLIAN static Elm_Object_Item*
1259_elm_index_item_insert_before(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data) 1299_elm_index_item_insert_before(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data)
1260{ 1300{
1261 Elm_Index_Item *it; 1301 Elm_Widobj_Item *it;
1262 1302
1263 if (!before) return elm_index_item_prepend(obj, letter, func, data); 1303 if (!before) return elm_index_item_prepend(obj, letter, func, data);
1264 1304
@@ -1274,38 +1314,40 @@ _elm_index_item_insert_before(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *befo
1274EOLIAN static Elm_Object_Item* 1314EOLIAN static Elm_Object_Item*
1275_elm_index_item_sorted_insert(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func) 1315_elm_index_item_sorted_insert(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func)
1276{ 1316{
1277 Elm_Index_Item *it; 1317 Elm_Widobj_Item *eo_item;
1278 Eina_List *lnear; 1318 Eina_List *lnear;
1279 int cmp; 1319 int cmp;
1280 1320
1281 if (!(sd->items)) return elm_index_item_append(obj, letter, func, data); 1321 if (!(sd->items)) return elm_index_item_append(obj, letter, func, data);
1282 1322
1283 it = _item_new(obj, letter, func, data); 1323 eo_item = _item_new(obj, letter, func, data);
1284 if (!it) return NULL; 1324 if (!eo_item) return NULL;
1285 1325
1286 lnear = eina_list_search_sorted_near_list(sd->items, cmp_func, it, &cmp); 1326 lnear = eina_list_search_sorted_near_list(sd->items, cmp_func, eo_item, &cmp);
1287 if (cmp < 0) 1327 if (cmp < 0)
1288 sd->items = eina_list_append_relative_list(sd->items, it, lnear); 1328 sd->items = eina_list_append_relative_list(sd->items, eo_item, lnear);
1289 else if (cmp > 0) 1329 else if (cmp > 0)
1290 sd->items = eina_list_prepend_relative_list(sd->items, it, lnear); 1330 sd->items = eina_list_prepend_relative_list(sd->items, eo_item, lnear);
1291 else 1331 else
1292 { 1332 {
1293 /* If cmp_data_func is not provided, append a duplicated item */ 1333 /* If cmp_data_func is not provided, append a duplicated item */
1294 if (!cmp_data_func) 1334 if (!cmp_data_func)
1295 sd->items = eina_list_append_relative_list(sd->items, it, lnear); 1335 sd->items = eina_list_append_relative_list(sd->items, eo_item, lnear);
1296 else 1336 else
1297 { 1337 {
1298 Elm_Index_Item *p_it = eina_list_data_get(lnear); 1338 Elm_Widobj_Item *eo_p_it = eina_list_data_get(lnear);
1299 if (cmp_data_func(p_it->base.data, it->base.data) >= 0) 1339 ELM_INDEX_ITEM_DATA_GET(eo_p_it, p_it);
1300 p_it->base.data = it->base.data; 1340 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1301 elm_widget_item_del(it); 1341 if (cmp_data_func(p_it->base->data, it->base->data) >= 0)
1302 it = NULL; 1342 p_it->base->data = it->base->data;
1343 eo_do(eo_item, elm_wdg_item_del());
1344 eo_item = NULL;
1303 } 1345 }
1304 } 1346 }
1305 _index_box_clear(obj, sd->level); 1347 _index_box_clear(obj, sd->level);
1306 1348
1307 if (!it) return NULL; 1349 if (!eo_item) return NULL;
1308 else return (Elm_Object_Item *)it; 1350 else return (Elm_Object_Item *)eo_item;
1309} 1351}
1310 1352
1311EOLIAN static Elm_Object_Item* 1353EOLIAN static Elm_Object_Item*
@@ -1317,17 +1359,18 @@ _elm_index_item_find(Eo *obj, Elm_Index_Data *_pd EINA_UNUSED, const void *data)
1317EOLIAN static void 1359EOLIAN static void
1318_elm_index_item_clear(Eo *obj, Elm_Index_Data *sd) 1360_elm_index_item_clear(Eo *obj, Elm_Index_Data *sd)
1319{ 1361{
1320 Elm_Index_Item *it; 1362 Elm_Widobj_Item *eo_item;
1321 Eina_List *l, *clear = NULL; 1363 Eina_List *l, *clear = NULL;
1322 1364
1323 _index_box_clear(obj, sd->level); 1365 _index_box_clear(obj, sd->level);
1324 EINA_LIST_FOREACH(sd->items, l, it) 1366 EINA_LIST_FOREACH(sd->items, l, eo_item)
1325 { 1367 {
1368 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1326 if (it->level != sd->level) continue; 1369 if (it->level != sd->level) continue;
1327 clear = eina_list_append(clear, it); 1370 clear = eina_list_append(clear, eo_item);
1328 } 1371 }
1329 EINA_LIST_FREE(clear, it) 1372 EINA_LIST_FREE(clear, eo_item)
1330 elm_widget_item_del(it); 1373 eo_do(eo_item, elm_wdg_item_del());
1331} 1374}
1332 1375
1333EOLIAN static void 1376EOLIAN static void
@@ -1362,12 +1405,10 @@ _elm_index_indicator_disabled_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd)
1362 return sd->indicator_disabled; 1405 return sd->indicator_disabled;
1363} 1406}
1364 1407
1365EAPI const char * 1408EOLIAN static const char *
1366elm_index_item_letter_get(const Elm_Object_Item *it) 1409_elm_index_item_letter_get(Eo *item EINA_UNUSED, Elm_Index_Item_Data *it)
1367{ 1410{
1368 ELM_INDEX_ITEM_CHECK_OR_RETURN(it, NULL); 1411 return it->letter;
1369
1370 return ((Elm_Index_Item *)it)->letter;
1371} 1412}
1372 1413
1373EOLIAN static void 1414EOLIAN static void
@@ -1428,4 +1469,19 @@ _elm_index_class_constructor(Eo_Class *klass)
1428 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 1469 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1429} 1470}
1430 1471
1472EAPI const char *
1473elm_index_item_letter_get(const Elm_Object_Item *it)
1474{
1475 const char *ret = NULL;
1476 eo_do((Eo*)it, ret = elm_obj_index_item_letter_get());
1477 return ret;
1478}
1479
1480EAPI void
1481elm_index_item_selected_set(Elm_Object_Item *it, Eina_Bool selected)
1482{
1483 eo_do((Eo*)it, elm_obj_index_item_selected_set(selected));
1484}
1485
1486#include "elm_index_item.eo.c"
1431#include "elm_index.eo.c" 1487#include "elm_index.eo.c"
diff --git a/src/lib/elm_index_item.eo b/src/lib/elm_index_item.eo
new file mode 100644
index 000000000..901774c19
--- /dev/null
+++ b/src/lib/elm_index_item.eo
@@ -0,0 +1,48 @@
1class Elm_Index_Item(Elm_Widget_Item)
2{
3 legacy_prefix: null;
4 eo_prefix: elm_obj_index_item;
5 properties {
6 selected {
7 set {
8 /*@
9 Set the selected state of an item.
10
11 This sets the selected state of the given item @p it.
12 @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
13
14 If a new item is selected the previously selected will be unselected.
15 Previously selected item can be get with function
16 elm_index_selected_item_get().
17
18 Selected items will be highlighted.
19
20 @see elm_index_selected_item_get()
21
22 @ingroup Index
23 */
24 }
25 values {
26 Eina_Bool selected; /*@ EINA_TRUE if selected EINA_FALSE otherwise */
27 }
28 }
29
30 }
31 methods {
32 letter_get {
33 /*@
34 Get the letter (string) set on a given index widget item.
35 @return The letter string set on @p item
36
37 @ingroup Index
38 */
39 const;
40 return const char*;
41 }
42 }
43 implements {
44 Eo_Base::constructor;
45 Elm_Widget_Item::access_register;
46 Elm_Widget_Item::del_pre;
47 }
48} \ No newline at end of file
diff --git a/src/lib/elm_widget_index.h b/src/lib/elm_widget_index.h
index 2f3a92eb1..6d5204822 100644
--- a/src/lib/elm_widget_index.h
+++ b/src/lib/elm_widget_index.h
@@ -2,6 +2,9 @@
2#define ELM_WIDGET_INDEX_H 2#define ELM_WIDGET_INDEX_H
3 3
4#include "Elementary.h" 4#include "Elementary.h"
5#include "elm_index_item.eo.h"
6
7#include "elm_object_item_migration_temp.h"
5 8
6/** 9/**
7 * @addtogroup Widget 10 * @addtogroup Widget
@@ -42,17 +45,17 @@ struct _Elm_Index_Data
42 Eina_Bool omit_enabled : 1; 45 Eina_Bool omit_enabled : 1;
43}; 46};
44 47
45typedef struct _Elm_Index_Item Elm_Index_Item; 48typedef struct _Elm_Index_Item_Data Elm_Index_Item_Data;
46struct _Elm_Index_Item 49struct _Elm_Index_Item_Data
47{ 50{
48 ELM_WIDGET_ITEM; 51 Elm_Widget_Item_Data *base;
49 52
50 const char *letter; 53 const char *letter;
51 int level; 54 int level;
52 Evas_Smart_Cb func; 55 Evas_Smart_Cb func;
53 56
54 Eina_List *omitted; 57 Eina_List *omitted;
55 Elm_Index_Item *head; 58 Elm_Widobj_Item *head;
56 59
57 Eina_Bool selected : 1; /**< a flag that remembers an item is selected. this is set true when mouse down/move occur above an item and when elm_index_item_selected_set() API is called. */ 60 Eina_Bool selected : 1; /**< a flag that remembers an item is selected. this is set true when mouse down/move occur above an item and when elm_index_item_selected_set() API is called. */
58}; 61};
@@ -92,12 +95,18 @@ struct _Elm_Index_Omit
92 if (EINA_UNLIKELY(!eo_isa((obj), ELM_INDEX_CLASS))) \ 95 if (EINA_UNLIKELY(!eo_isa((obj), ELM_INDEX_CLASS))) \
93 return 96 return
94 97
95#define ELM_INDEX_ITEM_CHECK(it) \ 98#define ELM_INDEX_ITEM_DATA_GET(o, sd) \
96 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, ); \ 99 Elm_Index_Item_Data * sd = eo_data_scope_get(o, ELM_INDEX_ITEM_CLASS)
97 ELM_INDEX_CHECK(it->base.widget); 100
101#define ELM_INDEX_ITEM_DATA(o) \
102 ((Elm_Index_Item_Data*)eo_data_scope_get(o, ELM_INDEX_ITEM_CLASS))
103
104#define ELM_INDEX_ITEM_CHECK(obj) \
105 if (EINA_UNLIKELY(!eo_isa((obj), ELM_INDEX_ITEM_CLASS))) \
106 return
98 107
99#define ELM_INDEX_ITEM_CHECK_OR_RETURN(it, ...) \ 108#define ELM_INDEX_ITEM_CHECK_OR_RETURN(obj, ...) \
100 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ 109 if (EINA_UNLIKELY(!eo_isa((obj), ELM_INDEX_ITEM_CLASS))) \
101 ELM_INDEX_CHECK(it->base.widget) __VA_ARGS__; 110 return __VA_ARGS__;
102 111
103#endif 112#endif