summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <woohyun0705@gmail.com>2012-03-05 10:05:58 +0000
committerWooHyun Jung <woohyun0705@gmail.com>2012-03-05 10:05:58 +0000
commitd5a2bf6c40ed870f8e902aa9d924e81fa676972e (patch)
tree9999a3edbd6280d190d35a4b7852e1b407adac95
parentfe4adb97b62d05f67903061718649038aa9525d0 (diff)
[elementary/index] Some APIs were modified or removed + fix build
break. SVN revision: 68690
-rw-r--r--doc/widgets/widget_preview_index.c4
-rw-r--r--src/bin/test_index.c20
-rw-r--r--src/examples/index_example_01.c2
-rw-r--r--src/examples/index_example_02.c2
-rw-r--r--src/lib/Elementary.h.in6
-rw-r--r--src/lib/elm_deprecated.h87
-rw-r--r--src/lib/elm_index.c118
-rw-r--r--src/lib/elm_index.h56
8 files changed, 215 insertions, 80 deletions
diff --git a/doc/widgets/widget_preview_index.c b/doc/widgets/widget_preview_index.c
index bf910edb0..3e655cecb 100644
--- a/doc/widgets/widget_preview_index.c
+++ b/doc/widgets/widget_preview_index.c
@@ -33,9 +33,9 @@ for (i = 0; i < (sizeof(dict) / sizeof(dict[0])); i++)
33 33
34 list_it = elm_list_item_append(o, dict[i], NULL, NULL, NULL, NULL); 34 list_it = elm_list_item_append(o, dict[i], NULL, NULL, NULL, NULL);
35 snprintf(buf, sizeof(buf), "%c", dict[i][0]); 35 snprintf(buf, sizeof(buf), "%c", dict[i][0]);
36 elm_index_item_append(id, buf, list_it); 36 elm_index_item_append(id, buf, NULL, list_it);
37 } 37 }
38 38
39elm_index_active_set(id, EINA_TRUE); 39elm_index_autohide_disabled_set(id, EINA_FALSE);
40 40
41#include "widget_preview_tmpl_foot.c" 41#include "widget_preview_tmpl_foot.c"
diff --git a/src/bin/test_index.c b/src/bin/test_index.c
index 2f8e4d945..e8f7acdf4 100644
--- a/src/bin/test_index.c
+++ b/src/bin/test_index.c
@@ -38,20 +38,20 @@ set_api_state(api_data *api)
38 switch(api->state) 38 switch(api->state)
39 { /* Put all api-changes under switch */ 39 { /* Put all api-changes under switch */
40 case INDEX_LEVEL_SET: /* 0 */ 40 case INDEX_LEVEL_SET: /* 0 */
41 elm_index_active_set(d->id, EINA_TRUE); 41 elm_index_autohide_disabled_set(d->id, EINA_TRUE);
42 elm_index_item_level_set(d->id, (elm_index_item_level_get(d->id) ? 0 : 1)); 42 elm_index_item_level_set(d->id, (elm_index_item_level_get(d->id) ? 0 : 1));
43 break; 43 break;
44 44
45 case INDEX_ACTIVE_SET: /* 1 */ 45 case INDEX_ACTIVE_SET: /* 1 */
46 elm_index_active_set(d->id, EINA_FALSE); 46 elm_index_autohide_disabled_set(d->id, EINA_FALSE);
47 break; 47 break;
48 48
49 case INDEX_APPEND_RELATIVE: /* 2 */ 49 case INDEX_APPEND_RELATIVE: /* 2 */
50 elm_index_item_append_relative(d->id, "W", d->item, elm_index_item_find(d->id, d->item)); 50 elm_index_item_insert_after(d->id, elm_index_item_find(d->id, d->item), "W", NULL, d->item);
51 break; 51 break;
52 52
53 case INDEX_PREPEND: /* 3 */ 53 case INDEX_PREPEND: /* 3 */
54 elm_index_item_prepend(d->id, "D", d->item); 54 elm_index_item_prepend(d->id, "D", NULL, d->item);
55 break; 55 break;
56 56
57 case INDEX_ITEM_DEL: /* 4 */ 57 case INDEX_ITEM_DEL: /* 4 */
@@ -136,6 +136,12 @@ _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *e
136 free(data); 136 free(data);
137} 137}
138 138
139static void
140id_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
141{
142 printf("Current Index : %s\n", elm_index_item_letter_get((const Elm_Object_Item *)event_info));
143}
144
139void 145void
140test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 146test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
141{ 147{
@@ -199,7 +205,7 @@ test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
199 char buf[32]; 205 char buf[32];
200 206
201 snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf)); 207 snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf));
202 elm_index_item_append(id, buf, glit); 208 elm_index_item_append(id, buf, id_cb, glit);
203 209
204 if (*buf == 'G') /* Just init dt->item later used in API test */ 210 if (*buf == 'G') /* Just init dt->item later used in API test */
205 api->dt.item = glit; 211 api->dt.item = glit;
@@ -209,7 +215,7 @@ test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
209 evas_object_smart_callback_add(id, "delay,changed", _index_delay_changed_cb, NULL); 215 evas_object_smart_callback_add(id, "delay,changed", _index_delay_changed_cb, NULL);
210 evas_object_smart_callback_add(id, "changed", _index_changed_cb, NULL); 216 evas_object_smart_callback_add(id, "changed", _index_changed_cb, NULL);
211 evas_object_smart_callback_add(id, "selected", _index_selected_cb, NULL); 217 evas_object_smart_callback_add(id, "selected", _index_selected_cb, NULL);
212 elm_index_item_go(id, 0); 218 elm_index_level_go(id, 0);
213 219
214 evas_object_resize(win, 320, 480); 220 evas_object_resize(win, 320, 480);
215 evas_object_show(win); 221 evas_object_show(win);
@@ -267,7 +273,7 @@ test_index2_it_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __U
267 snprintf(letter, sizeof(letter), "%c", label[0]); 273 snprintf(letter, sizeof(letter), "%c", label[0]);
268 list_it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL, 274 list_it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL,
269 NULL, test_index2_cmp); 275 NULL, test_index2_cmp);
270 elm_index_item_sorted_insert(gui->id, letter, list_it, test_index2_icmp, 276 elm_index_item_sorted_insert(gui->id, letter, NULL, list_it, test_index2_icmp,
271 test_index2_cmp); 277 test_index2_cmp);
272 elm_list_go(gui->lst); 278 elm_list_go(gui->lst);
273 /* FIXME it's not showing the recently added item */ 279 /* FIXME it's not showing the recently added item */
diff --git a/src/examples/index_example_01.c b/src/examples/index_example_01.c
index 4c669fef5..41d7bbb82 100644
--- a/src/examples/index_example_01.c
+++ b/src/examples/index_example_01.c
@@ -161,7 +161,7 @@ elm_main(int argc __UNUSED__,
161 /* indexing by first letters */ 161 /* indexing by first letters */
162 162
163 snprintf(buf, sizeof(buf), "%c", curr); 163 snprintf(buf, sizeof(buf), "%c", curr);
164 elm_index_item_append(d.index, buf, lit); 164 elm_index_item_append(d.index, buf, NULL, lit);
165 index_it = elm_index_item_find(d.index, lit); 165 index_it = elm_index_item_find(d.index, lit);
166 166
167 elm_object_item_del_cb_set(index_it, _index_item_del); 167 elm_object_item_del_cb_set(index_it, _index_item_del);
diff --git a/src/examples/index_example_02.c b/src/examples/index_example_02.c
index c3c537f23..a056746c2 100644
--- a/src/examples/index_example_02.c
+++ b/src/examples/index_example_02.c
@@ -138,7 +138,7 @@ elm_main(int argc __UNUSED__,
138 138
139 /* indexing by first letters */ 139 /* indexing by first letters */
140 snprintf(buf, sizeof(buf), "%c", items[i][0]); 140 snprintf(buf, sizeof(buf), "%c", items[i][0]);
141 elm_index_item_sorted_insert(index, buf, gg_it, _index_icmp, NULL); 141 elm_index_item_sorted_insert(index, buf, NULL, gg_it, _index_icmp, NULL);
142 } 142 }
143 143
144 evas_object_smart_callback_add(index, "delay,changed", _index_changed, NULL); 144 evas_object_smart_callback_add(index, "delay,changed", _index_changed, NULL);
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 9da5102f4..3f9b9c7c7 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -210,13 +210,13 @@ EAPI extern Elm_Version *elm_version;
210// Woohyun Jung 210// Woohyun Jung
211#include <elm_hover.h> // XXX: needs to change one API 211#include <elm_hover.h> // XXX: needs to change one API
212#include <elm_image.h> // XXX: some API names are ambiguous 212#include <elm_image.h> // XXX: some API names are ambiguous
213#include <elm_index.h> // XXX: all elm_index_item_xxx functions should be modifield 213#include <elm_index.h> // OK
214#include <elm_label.h> // XXX: some APIs should be checked again for deprecating 214#include <elm_label.h> // OK
215#include <elm_layout.h> // OK 215#include <elm_layout.h> // OK
216#include <elm_macros.h> // OK 216#include <elm_macros.h> // OK
217#include <elm_mapbuf.h> // OK 217#include <elm_mapbuf.h> // OK
218#include <elm_map.h> 218#include <elm_map.h>
219#include <elm_menu.h> // XXX: one API's name is ambiguous 219#include <elm_menu.h> // OK
220#include <elm_mirroring.h> // OK 220#include <elm_mirroring.h> // OK
221#include <elm_need.h> // OK 221#include <elm_need.h> // OK
222#include <elm_notify.h> // OK 222#include <elm_notify.h> // OK
diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h
index adf2631d3..f24c19af1 100644
--- a/src/lib/elm_deprecated.h
+++ b/src/lib/elm_deprecated.h
@@ -4655,5 +4655,92 @@ EINA_DEPRECATED EAPI void elm_object_cursor_engine_only_set(Evas_Object *
4655EINA_DEPRECATED EAPI Eina_Bool elm_object_cursor_engine_only_get(const Evas_Object *obj); 4655EINA_DEPRECATED EAPI Eina_Bool elm_object_cursor_engine_only_get(const Evas_Object *obj);
4656 4656
4657/** 4657/**
4658 * Go to a given items level on a index widget
4659 *
4660 * @param obj The index object
4661 * @param level The index level (one of @c 0 or @c 1)
4662 *
4663 * @deprecated please use "elm_index_level_go" instead.
4664 * @ingroup Index
4665 */
4666EINA_DEPRECATED EAPI void elm_index_item_go(Evas_Object *obj, int level);
4667
4668/**
4669 * Enable or disable auto hiding feature for a given index widget.
4670 *
4671 * @param obj The index object
4672 * @param active @c EINA_TRUE to enable auto hiding, @c EINA_FALSE to disable
4673 *
4674 * @see elm_index_active_get()
4675 *
4676 * @deprecated please use "elm_index_autohide_disabled_set" instead.
4677 * @ingroup Index
4678 */
4679EINA_DEPRECATED EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active);
4680
4681/**
4682 * Get whether auto hiding feature is enabled or not for a given index widget.
4683 *
4684 * @param obj The index object
4685 * @return @c EINA_TRUE, if auto hiding is enabled, @c EINA_FALSE otherwise
4686 *
4687 * @see elm_index_active_set() for more details
4688 *
4689 * @deprecated please use "elm_index_autohide_disabled_get" instead.
4690 * @ingroup Index
4691 */
4692EINA_DEPRECATED EAPI Eina_Bool elm_index_active_get(const Evas_Object *obj);
4693
4694/**
4695 * Append a new item, on a given index widget, <b>after the item
4696 * having @p relative as data</b>.
4697 *
4698 * @param obj The index object.
4699 * @param letter Letter under which the item should be indexed
4700 * @param item The item data to set for the index's item
4701 * @param relative The index item to be the predecessor of this new one
4702 * @return A handle to the item added or @c NULL, on errors
4703 *
4704 * Despite the most common usage of the @p letter argument is for
4705 * single char strings, one could use arbitrary strings as index
4706 * entries.
4707 *
4708 * @c item will be the pointer returned back on @c "changed", @c
4709 * "delay,changed" and @c "selected" smart events.
4710 *
4711 * @note If @p relative is @c NULL this function will behave as
4712 * elm_index_item_append().
4713 *
4714 * @deprecated please use "elm_index_item_insert_after" instead.
4715 * @ingroup Index
4716 */
4717EAPI Elm_Object_Item *elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
4718
4719/**
4720 * Prepend a new item, on a given index widget, <b>after the item
4721 * having @p relative as data</b>.
4722 *
4723 * @param obj The index object.
4724 * @param letter Letter under which the item should be indexed
4725 * @param item The item data to set for the index's item
4726 * @param relative The index item to be the successor of this new one
4727 * @return A handle to the item added or @c NULL, on errors
4728 *
4729 * Despite the most common usage of the @p letter argument is for
4730 * single char strings, one could use arbitrary strings as index
4731 * entries.
4732 *
4733 * @c item will be the pointer returned back on @c "changed", @c
4734 * "delay,changed" and @c "selected" smart events.
4735 *
4736 * @note If @p relative is @c NULL this function will behave as
4737 * elm_index_item_prepend().
4738 *
4739 * @deprecated please use "elm_index_item_insert_before" instead.
4740 * @ingroup Index
4741 */
4742EAPI Elm_Object_Item *elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
4743
4744/**
4658 * @} 4745 * @}
4659 */ 4746 */
diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index 9b621b583..db07ee59e 100644
--- a/src/lib/elm_index.c
+++ b/src/lib/elm_index.c
@@ -16,7 +16,7 @@ struct _Widget_Data
16 Ecore_Timer *delay; 16 Ecore_Timer *delay;
17 Eina_Bool level_active[2]; 17 Eina_Bool level_active[2];
18 Eina_Bool horizontal : 1; 18 Eina_Bool horizontal : 1;
19 Eina_Bool active : 1; 19 Eina_Bool autohide_disabled : 1;
20 Eina_Bool down : 1; 20 Eina_Bool down : 1;
21 Eina_Bool indicator_disabled : 1; 21 Eina_Bool indicator_disabled : 1;
22}; 22};
@@ -26,6 +26,7 @@ struct _Elm_Index_Item
26 ELM_WIDGET_ITEM; 26 ELM_WIDGET_ITEM;
27 const char *letter; 27 const char *letter;
28 int level; 28 int level;
29 Evas_Smart_Cb func;
29 Eina_Bool selected : 1; 30 Eina_Bool selected : 1;
30}; 31};
31 32
@@ -176,7 +177,7 @@ _theme_hook(Evas_Object *obj)
176 edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale); 177 edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
177 _sizing_eval(obj); 178 _sizing_eval(obj);
178 _index_box_auto_fill(obj, wd->bx[0], 0); 179 _index_box_auto_fill(obj, wd->bx[0], 0);
179 if (wd->active) 180 if (wd->autohide_disabled)
180 if (wd->level == 1) 181 if (wd->level == 1)
181 _index_box_auto_fill(obj, wd->bx[1], 1); 182 _index_box_auto_fill(obj, wd->bx[1], 1);
182} 183}
@@ -203,7 +204,7 @@ _item_del_pre_hook(Elm_Object_Item *it)
203} 204}
204 205
205static Elm_Index_Item * 206static Elm_Index_Item *
206_item_new(Evas_Object *obj, const char *letter, const void *item) 207_item_new(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data)
207{ 208{
208 Widget_Data *wd = elm_widget_data_get(obj); 209 Widget_Data *wd = elm_widget_data_get(obj);
209 Elm_Index_Item *it; 210 Elm_Index_Item *it;
@@ -212,20 +213,21 @@ _item_new(Evas_Object *obj, const char *letter, const void *item)
212 if (!it) return NULL; 213 if (!it) return NULL;
213 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); 214 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
214 if (letter) it->letter = eina_stringshare_add(letter); 215 if (letter) it->letter = eina_stringshare_add(letter);
215 it->base.data = item; 216 it->func = func;
217 it->base.data = data;
216 it->level = wd->level; 218 it->level = wd->level;
217 return it; 219 return it;
218} 220}
219 221
220static Elm_Index_Item * 222static Elm_Index_Item *
221_item_find(Evas_Object *obj, const void *item) 223_item_find(Evas_Object *obj, const void *data)
222{ 224{
223 Widget_Data *wd = elm_widget_data_get(obj); 225 Widget_Data *wd = elm_widget_data_get(obj);
224 Eina_List *l; 226 Eina_List *l;
225 Elm_Index_Item *it; 227 Elm_Index_Item *it;
226 if (!wd) return NULL; 228 if (!wd) return NULL;
227 EINA_LIST_FOREACH(wd->items, l, it) 229 EINA_LIST_FOREACH(wd->items, l, it)
228 if (it->base.data == item) return it; 230 if (it->base.data == data) return it;
229 return NULL; 231 return NULL;
230} 232}
231 233
@@ -458,7 +460,12 @@ _mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *eve
458 evas_object_geometry_get(wd->base, &x, &y, &w, NULL); 460 evas_object_geometry_get(wd->base, &x, &y, &w, NULL);
459 wd->dx = ev->canvas.x - x; 461 wd->dx = ev->canvas.x - x;
460 wd->dy = ev->canvas.y - y; 462 wd->dy = ev->canvas.y - y;
461 elm_index_active_set(data, 1); 463 if (!wd->autohide_disabled)
464 {
465 _index_box_clear(data, wd->bx[1], 1);
466 _index_box_auto_fill(data, wd->bx[0], 0);
467 edje_object_signal_emit(wd->base, "elm,state,active", "elm");
468 }
462 _sel_eval(data, ev->canvas.x, ev->canvas.y); 469 _sel_eval(data, ev->canvas.x, ev->canvas.y);
463 edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer", 470 edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer",
464 (!edje_object_mirrored_get(wd->base)) ? wd->dx : (wd->dx - w), wd->dy); 471 (!edje_object_mirrored_get(wd->base)) ? wd->dx : (wd->dx - w), wd->dy);
@@ -472,12 +479,20 @@ _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event
472 Widget_Data *wd = elm_widget_data_get(data); 479 Widget_Data *wd = elm_widget_data_get(data);
473 Evas_Event_Mouse_Up *ev = event_info; 480 Evas_Event_Mouse_Up *ev = event_info;
474 Elm_Object_Item *item; 481 Elm_Object_Item *item;
482 Elm_Index_Item *id_item;
475 if (!wd) return; 483 if (!wd) return;
476 if (ev->button != 1) return; 484 if (ev->button != 1) return;
477 wd->down = 0; 485 wd->down = 0;
478 item = elm_index_item_selected_get(data, wd->level); 486 item = elm_index_item_selected_get(data, wd->level);
479 if (item) evas_object_smart_callback_call(data, SIG_SELECTED, item); 487 if (item)
480 elm_index_active_set(data, 0); 488 {
489 evas_object_smart_callback_call(data, SIG_SELECTED, item);
490 id_item = (Elm_Index_Item *) item;
491 if (id_item->func)
492 id_item->func((void *)id_item->base.data, WIDGET(id_item), id_item);
493 }
494 if (!wd->autohide_disabled)
495 edje_object_signal_emit(wd->base, "elm,state,inactive", "elm");
481 edje_object_signal_emit(wd->base, "elm,state,level,0", "elm"); 496 edje_object_signal_emit(wd->base, "elm,state,level,0", "elm");
482 if (wd->items && !wd->indicator_disabled) 497 if (wd->items && !wd->indicator_disabled)
483 edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm"); 498 edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm");
@@ -552,6 +567,7 @@ elm_index_add(Evas_Object *parent)
552 567
553 wd->indicator_disabled = EINA_FALSE; 568 wd->indicator_disabled = EINA_FALSE;
554 wd->horizontal = EINA_FALSE; 569 wd->horizontal = EINA_FALSE;
570 wd->autohide_disabled = EINA_FALSE;
555 571
556 wd->base = edje_object_add(e); 572 wd->base = edje_object_add(e);
557 _elm_theme_object_set(obj, wd->base, "index", "base/vertical", "default"); 573 _elm_theme_object_set(obj, wd->base, "index", "base/vertical", "default");
@@ -602,16 +618,29 @@ elm_index_add(Evas_Object *parent)
602 return obj; 618 return obj;
603} 619}
604 620
605EAPI void 621EINA_DEPRECATED EAPI void
606elm_index_active_set(Evas_Object *obj, Eina_Bool active) 622elm_index_active_set(Evas_Object *obj, Eina_Bool active)
607{ 623{
624 elm_index_autohide_disabled_set(obj, !active);
625}
626
627EINA_DEPRECATED EAPI Eina_Bool
628elm_index_active_get(const Evas_Object *obj)
629{
630 return !elm_index_autohide_disabled_get(obj);
631}
632
633EAPI void
634elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled)
635{
608 ELM_CHECK_WIDTYPE(obj, widtype); 636 ELM_CHECK_WIDTYPE(obj, widtype);
609 Widget_Data *wd = elm_widget_data_get(obj); 637 Widget_Data *wd = elm_widget_data_get(obj);
610 if (!wd) return; 638 if (!wd) return;
611 if (wd->active == active) return; 639 disabled = !!disabled;
612 wd->active = active; 640 if (wd->autohide_disabled == disabled) return;
641 wd->autohide_disabled = disabled;
613 wd->level = 0; 642 wd->level = 0;
614 if (wd->active) 643 if (wd->autohide_disabled)
615 { 644 {
616 _index_box_clear(obj, wd->bx[1], 1); 645 _index_box_clear(obj, wd->bx[1], 1);
617 _index_box_auto_fill(obj, wd->bx[0], 0); 646 _index_box_auto_fill(obj, wd->bx[0], 0);
@@ -622,12 +651,12 @@ elm_index_active_set(Evas_Object *obj, Eina_Bool active)
622} 651}
623 652
624EAPI Eina_Bool 653EAPI Eina_Bool
625elm_index_active_get(const Evas_Object *obj) 654elm_index_autohide_disabled_get(const Evas_Object *obj)
626{ 655{
627 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; 656 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
628 Widget_Data *wd = elm_widget_data_get(obj); 657 Widget_Data *wd = elm_widget_data_get(obj);
629 if (!wd) return EINA_FALSE; 658 if (!wd) return EINA_FALSE;
630 return wd->active; 659 return wd->autohide_disabled;
631} 660}
632 661
633EAPI void 662EAPI void
@@ -666,13 +695,13 @@ elm_index_item_selected_get(const Evas_Object *obj, int level)
666} 695}
667 696
668EAPI Elm_Object_Item * 697EAPI Elm_Object_Item *
669elm_index_item_append(Evas_Object *obj, const char *letter, const void *item) 698elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data)
670{ 699{
671 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 700 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
672 Widget_Data *wd = elm_widget_data_get(obj); 701 Widget_Data *wd = elm_widget_data_get(obj);
673 Elm_Index_Item *it; 702 Elm_Index_Item *it;
674 if (!wd) return NULL; 703 if (!wd) return NULL;
675 it = _item_new(obj, letter, item); 704 it = _item_new(obj, letter, func, data);
676 if (!it) return NULL; 705 if (!it) return NULL;
677 wd->items = eina_list_append(wd->items, it); 706 wd->items = eina_list_append(wd->items, it);
678 _index_box_clear(obj, wd->bx[wd->level], wd->level); 707 _index_box_clear(obj, wd->bx[wd->level], wd->level);
@@ -680,55 +709,64 @@ elm_index_item_append(Evas_Object *obj, const char *letter, const void *item)
680} 709}
681 710
682EAPI Elm_Object_Item * 711EAPI Elm_Object_Item *
683elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item) 712elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data)
684{ 713{
685 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 714 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
686 Widget_Data *wd = elm_widget_data_get(obj); 715 Widget_Data *wd = elm_widget_data_get(obj);
687 Elm_Index_Item *it; 716 Elm_Index_Item *it;
688 717
689 if (!wd) return NULL; 718 if (!wd) return NULL;
690 it = _item_new(obj, letter, item); 719 it = _item_new(obj, letter, func, data);
691 if (!it) return NULL; 720 if (!it) return NULL;
692 wd->items = eina_list_prepend(wd->items, it); 721 wd->items = eina_list_prepend(wd->items, it);
693 _index_box_clear(obj, wd->bx[wd->level], wd->level); 722 _index_box_clear(obj, wd->bx[wd->level], wd->level);
694 return (Elm_Object_Item *) it; 723 return (Elm_Object_Item *) it;
695} 724}
696 725
697EAPI Elm_Object_Item * 726EINA_DEPRECATED EAPI Elm_Object_Item *
698elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) 727elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
699{ 728{
729 return elm_index_item_insert_after(obj, (Elm_Object_Item *) relative, letter, NULL, item);
730}
731
732EINA_DEPRECATED EAPI Elm_Object_Item *
733elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
734{
735 return elm_index_item_insert_before(obj, (Elm_Object_Item *) relative, letter, NULL, item);
736}
737
738EAPI Elm_Object_Item *
739elm_index_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data)
740{
700 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 741 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
701 Widget_Data *wd = elm_widget_data_get(obj); 742 Widget_Data *wd = elm_widget_data_get(obj);
702 Elm_Index_Item *it; 743 Elm_Index_Item *it;
703 if (!wd) return NULL; 744 if (!wd) return NULL;
704 if (!relative) 745 if (!after) return elm_index_item_append(obj, letter, func, data);
705 return elm_index_item_append(obj, letter, item); 746 it = _item_new(obj, letter, func, data);
706 it = _item_new(obj, letter, item);
707 if (!it) return NULL; 747 if (!it) return NULL;
708 wd->items = eina_list_append_relative(wd->items, it, relative); 748 wd->items = eina_list_append_relative(wd->items, it, after);
709 _index_box_clear(obj, wd->bx[wd->level], wd->level); 749 _index_box_clear(obj, wd->bx[wd->level], wd->level);
710 return (Elm_Object_Item *) it; 750 return (Elm_Object_Item *) it;
711
712} 751}
713 752
714EAPI Elm_Object_Item * 753EAPI Elm_Object_Item *
715elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) 754elm_index_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data)
716{ 755{
717 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 756 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
718 Widget_Data *wd = elm_widget_data_get(obj); 757 Widget_Data *wd = elm_widget_data_get(obj);
719 Elm_Index_Item *it; 758 Elm_Index_Item *it;
720 if (!wd) return NULL; 759 if (!wd) return NULL;
721 if (!relative) 760 if (!before) return elm_index_item_prepend(obj, letter, func, data);
722 return elm_index_item_prepend(obj, letter, item); 761 it = _item_new(obj, letter, func, data);
723 it = _item_new(obj, letter, item);
724 if (!it) return NULL; 762 if (!it) return NULL;
725 wd->items = eina_list_prepend_relative(wd->items, it, relative); 763 wd->items = eina_list_prepend_relative(wd->items, it, before);
726 _index_box_clear(obj, wd->bx[wd->level], wd->level); 764 _index_box_clear(obj, wd->bx[wd->level], wd->level);
727 return (Elm_Object_Item *) it; 765 return (Elm_Object_Item *) it;
728} 766}
729 767
730EAPI Elm_Object_Item * 768EAPI Elm_Object_Item *
731elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func) 769elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func)
732{ 770{
733 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 771 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
734 Widget_Data *wd = elm_widget_data_get(obj); 772 Widget_Data *wd = elm_widget_data_get(obj);
@@ -738,9 +776,9 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
738 776
739 if (!wd) return NULL; 777 if (!wd) return NULL;
740 if (!(wd->items)) 778 if (!(wd->items))
741 return elm_index_item_append(obj, letter, item); 779 return elm_index_item_append(obj, letter, func, data);
742 780
743 it = _item_new(obj, letter, item); 781 it = _item_new(obj, letter, func, data);
744 if (!it) return NULL; 782 if (!it) return NULL;
745 783
746 lnear = eina_list_search_sorted_near_list(wd->items, cmp_func, it, &cmp); 784 lnear = eina_list_search_sorted_near_list(wd->items, cmp_func, it, &cmp);
@@ -762,9 +800,7 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
762 elm_widget_item_free(it); 800 elm_widget_item_free(it);
763 } 801 }
764 } 802 }
765
766 _index_box_clear(obj, wd->bx[wd->level], wd->level); 803 _index_box_clear(obj, wd->bx[wd->level], wd->level);
767
768 return (Elm_Object_Item *) it; 804 return (Elm_Object_Item *) it;
769} 805}
770 806
@@ -775,12 +811,12 @@ elm_index_item_del(Evas_Object *obj __UNUSED__, Elm_Object_Item *it)
775} 811}
776 812
777EAPI Elm_Object_Item * 813EAPI Elm_Object_Item *
778elm_index_item_find(Evas_Object *obj, const void *item) 814elm_index_item_find(Evas_Object *obj, const void *data)
779{ 815{
780 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 816 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
781 Widget_Data *wd = elm_widget_data_get(obj); 817 Widget_Data *wd = elm_widget_data_get(obj);
782 if (!wd) return NULL; 818 if (!wd) return NULL;
783 return (Elm_Object_Item *) _item_find(obj, item); 819 return (Elm_Object_Item *) _item_find(obj, data);
784} 820}
785 821
786EAPI void 822EAPI void
@@ -804,9 +840,15 @@ elm_index_item_clear(Evas_Object *obj)
804 } 840 }
805} 841}
806 842
807EAPI void 843EINA_DEPRECATED EAPI void
808elm_index_item_go(Evas_Object *obj, int level __UNUSED__) 844elm_index_item_go(Evas_Object *obj, int level __UNUSED__)
809{ 845{
846 elm_index_level_go(obj, level);
847}
848
849EAPI void
850elm_index_level_go(Evas_Object *obj, int level __UNUSED__)
851{
810 ELM_CHECK_WIDTYPE(obj, widtype); 852 ELM_CHECK_WIDTYPE(obj, widtype);
811 Widget_Data *wd = elm_widget_data_get(obj); 853 Widget_Data *wd = elm_widget_data_get(obj);
812 if (!wd) return; 854 if (!wd) return;
diff --git a/src/lib/elm_index.h b/src/lib/elm_index.h
index b715b6ff1..456e64699 100644
--- a/src/lib/elm_index.h
+++ b/src/lib/elm_index.h
@@ -66,25 +66,25 @@ EAPI Evas_Object *elm_index_add(Evas_Object *parent);
66 * Enable or disable auto hiding feature for a given index widget. 66 * Enable or disable auto hiding feature for a given index widget.
67 * 67 *
68 * @param obj The index object 68 * @param obj The index object
69 * @param active @c EINA_TRUE to enable auto hiding, @c EINA_FALSE to disable 69 * @param disabled @c EINA_TRUE to disable auto hiding, @c EINA_FALSE to enable
70 * 70 *
71 * @see elm_index_active_get() 71 * @see elm_index_autohide_disabled_get()
72 * 72 *
73 * @ingroup Index 73 * @ingroup Index
74 */ 74 */
75EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active); 75EAPI void elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled);
76 76
77/** 77/**
78 * Get whether auto hiding feature is enabled or not for a given index widget. 78 * Get whether auto hiding feature is enabled or not for a given index widget.
79 * 79 *
80 * @param obj The index object 80 * @param obj The index object
81 * @return @c EINA_TRUE, if auto hiding is enabled, @c EINA_FALSE otherwise 81 * @return @c EINA_TRUE, if auto hiding is disabled, @c EINA_FALSE otherwise
82 * 82 *
83 * @see elm_index_active_set() for more details 83 * @see elm_index_active_set() for more details
84 * 84 *
85 * @ingroup Index 85 * @ingroup Index
86 */ 86 */
87EAPI Eina_Bool elm_index_active_get(const Evas_Object *obj); 87EAPI Eina_Bool elm_index_autohide_disabled_get(const Evas_Object *obj);
88 88
89/** 89/**
90 * Set the items level for a given index widget. 90 * Set the items level for a given index widget.
@@ -118,7 +118,6 @@ EAPI int elm_index_item_level_get(const Evas_Object *obj);
118 * 118 *
119 * @ingroup Index 119 * @ingroup Index
120 */ 120 */
121//XXX: elm_index_selected_item_get.
122EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level); 121EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level);
123 122
124/** 123/**
@@ -126,7 +125,8 @@ EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, i
126 * 125 *
127 * @param obj The index object. 126 * @param obj The index object.
128 * @param letter Letter under which the item should be indexed 127 * @param letter Letter under which the item should be indexed
129 * @param item The item data to set for the index's item 128 * @param func The function to call when the item is selected.
129 * @param data The item data to set for the index's item
130 * @return A handle to the item added or @c NULL, on errors 130 * @return A handle to the item added or @c NULL, on errors
131 * 131 *
132 * Despite the most common usage of the @p letter argument is for 132 * Despite the most common usage of the @p letter argument is for
@@ -138,14 +138,15 @@ EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, i
138 * 138 *
139 * @ingroup Index 139 * @ingroup Index
140 */ 140 */
141EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, const void *item); 141EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
142 142
143/** 143/**
144 * Prepend a new item on a given index widget. 144 * Prepend a new item on a given index widget.
145 * 145 *
146 * @param obj The index object. 146 * @param obj The index object.
147 * @param letter Letter under which the item should be indexed 147 * @param letter Letter under which the item should be indexed
148 * @param item The item data to set for the index's item 148 * @param func The function to call when the item is selected.
149 * @param data The item data to set for the index's item
149 * @return A handle to the item added or @c NULL, on errors 150 * @return A handle to the item added or @c NULL, on errors
150 * 151 *
151 * Despite the most common usage of the @p letter argument is for 152 * Despite the most common usage of the @p letter argument is for
@@ -157,16 +158,16 @@ EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *l
157 * 158 *
158 * @ingroup Index 159 * @ingroup Index
159 */ 160 */
160EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item); 161EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
161 162
162/** 163/**
163 * Append a new item, on a given index widget, <b>after the item 164 * Insert a new item into the index object after item @p after.
164 * having @p relative as data</b>.
165 * 165 *
166 * @param obj The index object. 166 * @param obj The index object.
167 * @param after The index item to insert after.
167 * @param letter Letter under which the item should be indexed 168 * @param letter Letter under which the item should be indexed
168 * @param item The item data to set for the index's item 169 * @param func The function to call when the item is clicked.
169 * @param relative The index item to be the predecessor of this new one 170 * @param data The item data to set for the index's item
170 * @return A handle to the item added or @c NULL, on errors 171 * @return A handle to the item added or @c NULL, on errors
171 * 172 *
172 * Despite the most common usage of the @p letter argument is for 173 * Despite the most common usage of the @p letter argument is for
@@ -181,16 +182,16 @@ EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *
181 * 182 *
182 * @ingroup Index 183 * @ingroup Index
183 */ 184 */
184EAPI Elm_Object_Item *elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative); 185EAPI Elm_Object_Item *elm_index_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data);
185 186
186/** 187/**
187 * Prepend a new item, on a given index widget, <b>after the item 188 * Insert a new item into the index object before item @p before.
188 * having @p relative as data</b>.
189 * 189 *
190 * @param obj The index object. 190 * @param obj The index object.
191 * @param before The index item to insert after.
191 * @param letter Letter under which the item should be indexed 192 * @param letter Letter under which the item should be indexed
192 * @param item The item data to set for the index's item 193 * @param func The function to call when the item is clicked.
193 * @param relative The index item to be the successor of this new one 194 * @param data The item data to set for the index's item
194 * @return A handle to the item added or @c NULL, on errors 195 * @return A handle to the item added or @c NULL, on errors
195 * 196 *
196 * Despite the most common usage of the @p letter argument is for 197 * Despite the most common usage of the @p letter argument is for
@@ -205,7 +206,7 @@ EAPI Elm_Object_Item *elm_index_item_append_relative(Evas_Object *obj, cons
205 * 206 *
206 * @ingroup Index 207 * @ingroup Index
207 */ 208 */
208EAPI Elm_Object_Item *elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative); 209EAPI Elm_Object_Item *elm_index_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data);
209 210
210/** 211/**
211 * Insert a new item into the given index widget, using @p cmp_func 212 * Insert a new item into the given index widget, using @p cmp_func
@@ -213,7 +214,8 @@ EAPI Elm_Object_Item *elm_index_item_prepend_relative(Evas_Object *obj, con
213 * 214 *
214 * @param obj The index object. 215 * @param obj The index object.
215 * @param letter Letter under which the item should be indexed 216 * @param letter Letter under which the item should be indexed
216 * @param item The item data to set for the index's item 217 * @param func The function to call when the item is clicked.
218 * @param data The item data to set for the index's item
217 * @param cmp_func The comparing function to be used to sort index 219 * @param cmp_func The comparing function to be used to sort index
218 * items <b>by #index item handles</b> 220 * items <b>by #index item handles</b>
219 * @param cmp_data_func A @b fallback function to be called for the 221 * @param cmp_data_func A @b fallback function to be called for the
@@ -239,19 +241,18 @@ EAPI Elm_Object_Item *elm_index_item_prepend_relative(Evas_Object *obj, con
239 * 241 *
240 * @ingroup Index 242 * @ingroup Index
241 */ 243 */
242EAPI Elm_Object_Item *elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func); 244EAPI Elm_Object_Item *elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
243 245
244/** 246/**
245 * Find a given index widget's item, <b>using item data</b>. 247 * Find a given index widget's item, <b>using item data</b>.
246 * 248 *
247 * @param obj The index object 249 * @param obj The index object
248 * @param item The item data pointed to by the desired index item 250 * @param data The item data pointed to by the desired index item
249 * @return The index item handle, if found, or @c NULL otherwise 251 * @return The index item handle, if found, or @c NULL otherwise
250 * 252 *
251 * @ingroup Index 253 * @ingroup Index
252 */ 254 */
253//XXX: After changing above APIs, this should be deprecated. 255EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *data);
254EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *item);
255 256
256/** 257/**
257 * Removes @b all items from a given index widget. 258 * Removes @b all items from a given index widget.
@@ -273,8 +274,7 @@ EAPI void elm_index_item_clear(Evas_Object *obj);
273 * 274 *
274 * @ingroup Index 275 * @ingroup Index
275 */ 276 */
276//XXX: how about elm_index_level_go ?? 277EAPI void elm_index_level_go(Evas_Object *obj, int level);
277EAPI void elm_index_item_go(Evas_Object *obj, int level);
278 278
279/** 279/**
280 * Get the letter (string) set on a given index widget item. 280 * Get the letter (string) set on a given index widget item.
@@ -310,7 +310,7 @@ EAPI void elm_index_indicator_disabled_set(Evas_Object *obj, Ein
310 * 310 *
311 * @ingroup Index 311 * @ingroup Index
312 */ 312 */
313EAPI Eina_Bool elm_index_indicator_disabled_get(const Evas_Object *obj); 313EAPI Eina_Bool elm_index_indicator_disabled_get(const Evas_Object *obj);
314 314
315/** 315/**
316 * @} 316 * @}