[elementary/index] Some APIs were modified or removed + fix build

break.


SVN revision: 68690
This commit is contained in:
WooHyun Jung 2012-03-05 10:05:58 +00:00
parent 6920a5c1ab
commit 9073ed6efb
8 changed files with 221 additions and 86 deletions

View File

@ -33,9 +33,9 @@ for (i = 0; i < (sizeof(dict) / sizeof(dict[0])); i++)
list_it = elm_list_item_append(o, dict[i], NULL, NULL, NULL, NULL); list_it = elm_list_item_append(o, dict[i], NULL, NULL, NULL, NULL);
snprintf(buf, sizeof(buf), "%c", dict[i][0]); snprintf(buf, sizeof(buf), "%c", dict[i][0]);
elm_index_item_append(id, buf, list_it); elm_index_item_append(id, buf, NULL, list_it);
} }
elm_index_active_set(id, EINA_TRUE); elm_index_autohide_disabled_set(id, EINA_FALSE);
#include "widget_preview_tmpl_foot.c" #include "widget_preview_tmpl_foot.c"

View File

@ -38,20 +38,20 @@ set_api_state(api_data *api)
switch(api->state) switch(api->state)
{ /* Put all api-changes under switch */ { /* Put all api-changes under switch */
case INDEX_LEVEL_SET: /* 0 */ case INDEX_LEVEL_SET: /* 0 */
elm_index_active_set(d->id, EINA_TRUE); elm_index_autohide_disabled_set(d->id, EINA_TRUE);
elm_index_item_level_set(d->id, (elm_index_item_level_get(d->id) ? 0 : 1)); elm_index_item_level_set(d->id, (elm_index_item_level_get(d->id) ? 0 : 1));
break; break;
case INDEX_ACTIVE_SET: /* 1 */ case INDEX_ACTIVE_SET: /* 1 */
elm_index_active_set(d->id, EINA_FALSE); elm_index_autohide_disabled_set(d->id, EINA_FALSE);
break; break;
case INDEX_APPEND_RELATIVE: /* 2 */ case INDEX_APPEND_RELATIVE: /* 2 */
elm_index_item_append_relative(d->id, "W", d->item, elm_index_item_find(d->id, d->item)); elm_index_item_insert_after(d->id, elm_index_item_find(d->id, d->item), "W", NULL, d->item);
break; break;
case INDEX_PREPEND: /* 3 */ case INDEX_PREPEND: /* 3 */
elm_index_item_prepend(d->id, "D", d->item); elm_index_item_prepend(d->id, "D", NULL, d->item);
break; break;
case INDEX_ITEM_DEL: /* 4 */ case INDEX_ITEM_DEL: /* 4 */
@ -136,6 +136,12 @@ _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *e
free(data); free(data);
} }
static void
id_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
printf("Current Index : %s\n", elm_index_item_letter_get((const Elm_Object_Item *)event_info));
}
void void
test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ {
@ -199,7 +205,7 @@ test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
char buf[32]; char buf[32];
snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf)); snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf));
elm_index_item_append(id, buf, glit); elm_index_item_append(id, buf, id_cb, glit);
if (*buf == 'G') /* Just init dt->item later used in API test */ if (*buf == 'G') /* Just init dt->item later used in API test */
api->dt.item = glit; api->dt.item = glit;
@ -209,7 +215,7 @@ test_index(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_smart_callback_add(id, "delay,changed", _index_delay_changed_cb, NULL); evas_object_smart_callback_add(id, "delay,changed", _index_delay_changed_cb, NULL);
evas_object_smart_callback_add(id, "changed", _index_changed_cb, NULL); evas_object_smart_callback_add(id, "changed", _index_changed_cb, NULL);
evas_object_smart_callback_add(id, "selected", _index_selected_cb, NULL); evas_object_smart_callback_add(id, "selected", _index_selected_cb, NULL);
elm_index_item_go(id, 0); elm_index_level_go(id, 0);
evas_object_resize(win, 320, 480); evas_object_resize(win, 320, 480);
evas_object_show(win); evas_object_show(win);
@ -267,7 +273,7 @@ test_index2_it_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __U
snprintf(letter, sizeof(letter), "%c", label[0]); snprintf(letter, sizeof(letter), "%c", label[0]);
list_it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL, list_it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL,
NULL, test_index2_cmp); NULL, test_index2_cmp);
elm_index_item_sorted_insert(gui->id, letter, list_it, test_index2_icmp, elm_index_item_sorted_insert(gui->id, letter, NULL, list_it, test_index2_icmp,
test_index2_cmp); test_index2_cmp);
elm_list_go(gui->lst); elm_list_go(gui->lst);
/* FIXME it's not showing the recently added item */ /* FIXME it's not showing the recently added item */

View File

@ -161,7 +161,7 @@ elm_main(int argc __UNUSED__,
/* indexing by first letters */ /* indexing by first letters */
snprintf(buf, sizeof(buf), "%c", curr); snprintf(buf, sizeof(buf), "%c", curr);
elm_index_item_append(d.index, buf, lit); elm_index_item_append(d.index, buf, NULL, lit);
index_it = elm_index_item_find(d.index, lit); index_it = elm_index_item_find(d.index, lit);
elm_object_item_del_cb_set(index_it, _index_item_del); elm_object_item_del_cb_set(index_it, _index_item_del);

View File

@ -138,7 +138,7 @@ elm_main(int argc __UNUSED__,
/* indexing by first letters */ /* indexing by first letters */
snprintf(buf, sizeof(buf), "%c", items[i][0]); snprintf(buf, sizeof(buf), "%c", items[i][0]);
elm_index_item_sorted_insert(index, buf, gg_it, _index_icmp, NULL); elm_index_item_sorted_insert(index, buf, NULL, gg_it, _index_icmp, NULL);
} }
evas_object_smart_callback_add(index, "delay,changed", _index_changed, NULL); evas_object_smart_callback_add(index, "delay,changed", _index_changed, NULL);

View File

@ -210,13 +210,13 @@ EAPI extern Elm_Version *elm_version;
// Woohyun Jung // Woohyun Jung
#include <elm_hover.h> // XXX: needs to change one API #include <elm_hover.h> // XXX: needs to change one API
#include <elm_image.h> // XXX: some API names are ambiguous #include <elm_image.h> // XXX: some API names are ambiguous
#include <elm_index.h> // XXX: all elm_index_item_xxx functions should be modifield #include <elm_index.h> // OK
#include <elm_label.h> // XXX: some APIs should be checked again for deprecating #include <elm_label.h> // OK
#include <elm_layout.h> // OK #include <elm_layout.h> // OK
#include <elm_macros.h> // OK #include <elm_macros.h> // OK
#include <elm_mapbuf.h> // OK #include <elm_mapbuf.h> // OK
#include <elm_map.h> #include <elm_map.h>
#include <elm_menu.h> // XXX: one API's name is ambiguous #include <elm_menu.h> // OK
#include <elm_mirroring.h> // OK #include <elm_mirroring.h> // OK
#include <elm_need.h> // OK #include <elm_need.h> // OK
#include <elm_notify.h> // OK #include <elm_notify.h> // OK

View File

@ -4654,6 +4654,93 @@ EINA_DEPRECATED EAPI void elm_object_cursor_engine_only_set(Evas_Object *
*/ */
EINA_DEPRECATED EAPI Eina_Bool elm_object_cursor_engine_only_get(const Evas_Object *obj); EINA_DEPRECATED EAPI Eina_Bool elm_object_cursor_engine_only_get(const Evas_Object *obj);
/**
* Go to a given items level on a index widget
*
* @param obj The index object
* @param level The index level (one of @c 0 or @c 1)
*
* @deprecated please use "elm_index_level_go" instead.
* @ingroup Index
*/
EINA_DEPRECATED EAPI void elm_index_item_go(Evas_Object *obj, int level);
/**
* Enable or disable auto hiding feature for a given index widget.
*
* @param obj The index object
* @param active @c EINA_TRUE to enable auto hiding, @c EINA_FALSE to disable
*
* @see elm_index_active_get()
*
* @deprecated please use "elm_index_autohide_disabled_set" instead.
* @ingroup Index
*/
EINA_DEPRECATED EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active);
/**
* Get whether auto hiding feature is enabled or not for a given index widget.
*
* @param obj The index object
* @return @c EINA_TRUE, if auto hiding is enabled, @c EINA_FALSE otherwise
*
* @see elm_index_active_set() for more details
*
* @deprecated please use "elm_index_autohide_disabled_get" instead.
* @ingroup Index
*/
EINA_DEPRECATED EAPI Eina_Bool elm_index_active_get(const Evas_Object *obj);
/**
* Append a new item, on a given index widget, <b>after the item
* having @p relative as data</b>.
*
* @param obj The index object.
* @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item
* @param relative The index item to be the predecessor of this new one
* @return A handle to the item added or @c NULL, on errors
*
* Despite the most common usage of the @p letter argument is for
* single char strings, one could use arbitrary strings as index
* entries.
*
* @c item will be the pointer returned back on @c "changed", @c
* "delay,changed" and @c "selected" smart events.
*
* @note If @p relative is @c NULL this function will behave as
* elm_index_item_append().
*
* @deprecated please use "elm_index_item_insert_after" instead.
* @ingroup Index
*/
EAPI Elm_Object_Item *elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
/**
* Prepend a new item, on a given index widget, <b>after the item
* having @p relative as data</b>.
*
* @param obj The index object.
* @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item
* @param relative The index item to be the successor of this new one
* @return A handle to the item added or @c NULL, on errors
*
* Despite the most common usage of the @p letter argument is for
* single char strings, one could use arbitrary strings as index
* entries.
*
* @c item will be the pointer returned back on @c "changed", @c
* "delay,changed" and @c "selected" smart events.
*
* @note If @p relative is @c NULL this function will behave as
* elm_index_item_prepend().
*
* @deprecated please use "elm_index_item_insert_before" instead.
* @ingroup Index
*/
EAPI Elm_Object_Item *elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
/** /**
* @} * @}
*/ */

View File

@ -16,7 +16,7 @@ struct _Widget_Data
Ecore_Timer *delay; Ecore_Timer *delay;
Eina_Bool level_active[2]; Eina_Bool level_active[2];
Eina_Bool horizontal : 1; Eina_Bool horizontal : 1;
Eina_Bool active : 1; Eina_Bool autohide_disabled : 1;
Eina_Bool down : 1; Eina_Bool down : 1;
Eina_Bool indicator_disabled : 1; Eina_Bool indicator_disabled : 1;
}; };
@ -26,6 +26,7 @@ struct _Elm_Index_Item
ELM_WIDGET_ITEM; ELM_WIDGET_ITEM;
const char *letter; const char *letter;
int level; int level;
Evas_Smart_Cb func;
Eina_Bool selected : 1; Eina_Bool selected : 1;
}; };
@ -176,7 +177,7 @@ _theme_hook(Evas_Object *obj)
edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale); edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj); _sizing_eval(obj);
_index_box_auto_fill(obj, wd->bx[0], 0); _index_box_auto_fill(obj, wd->bx[0], 0);
if (wd->active) if (wd->autohide_disabled)
if (wd->level == 1) if (wd->level == 1)
_index_box_auto_fill(obj, wd->bx[1], 1); _index_box_auto_fill(obj, wd->bx[1], 1);
} }
@ -203,7 +204,7 @@ _item_del_pre_hook(Elm_Object_Item *it)
} }
static Elm_Index_Item * static Elm_Index_Item *
_item_new(Evas_Object *obj, const char *letter, const void *item) _item_new(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data)
{ {
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it; Elm_Index_Item *it;
@ -212,20 +213,21 @@ _item_new(Evas_Object *obj, const char *letter, const void *item)
if (!it) return NULL; if (!it) return NULL;
elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
if (letter) it->letter = eina_stringshare_add(letter); if (letter) it->letter = eina_stringshare_add(letter);
it->base.data = item; it->func = func;
it->base.data = data;
it->level = wd->level; it->level = wd->level;
return it; return it;
} }
static Elm_Index_Item * static Elm_Index_Item *
_item_find(Evas_Object *obj, const void *item) _item_find(Evas_Object *obj, const void *data)
{ {
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *l; Eina_List *l;
Elm_Index_Item *it; Elm_Index_Item *it;
if (!wd) return NULL; if (!wd) return NULL;
EINA_LIST_FOREACH(wd->items, l, it) EINA_LIST_FOREACH(wd->items, l, it)
if (it->base.data == item) return it; if (it->base.data == data) return it;
return NULL; return NULL;
} }
@ -458,7 +460,12 @@ _mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *eve
evas_object_geometry_get(wd->base, &x, &y, &w, NULL); evas_object_geometry_get(wd->base, &x, &y, &w, NULL);
wd->dx = ev->canvas.x - x; wd->dx = ev->canvas.x - x;
wd->dy = ev->canvas.y - y; wd->dy = ev->canvas.y - y;
elm_index_active_set(data, 1); if (!wd->autohide_disabled)
{
_index_box_clear(data, wd->bx[1], 1);
_index_box_auto_fill(data, wd->bx[0], 0);
edje_object_signal_emit(wd->base, "elm,state,active", "elm");
}
_sel_eval(data, ev->canvas.x, ev->canvas.y); _sel_eval(data, ev->canvas.x, ev->canvas.y);
edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer", edje_object_part_drag_value_set(wd->base, "elm.dragable.pointer",
(!edje_object_mirrored_get(wd->base)) ? wd->dx : (wd->dx - w), wd->dy); (!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
Widget_Data *wd = elm_widget_data_get(data); Widget_Data *wd = elm_widget_data_get(data);
Evas_Event_Mouse_Up *ev = event_info; Evas_Event_Mouse_Up *ev = event_info;
Elm_Object_Item *item; Elm_Object_Item *item;
Elm_Index_Item *id_item;
if (!wd) return; if (!wd) return;
if (ev->button != 1) return; if (ev->button != 1) return;
wd->down = 0; wd->down = 0;
item = elm_index_item_selected_get(data, wd->level); item = elm_index_item_selected_get(data, wd->level);
if (item) evas_object_smart_callback_call(data, SIG_SELECTED, item); if (item)
elm_index_active_set(data, 0); {
evas_object_smart_callback_call(data, SIG_SELECTED, item);
id_item = (Elm_Index_Item *) item;
if (id_item->func)
id_item->func((void *)id_item->base.data, WIDGET(id_item), id_item);
}
if (!wd->autohide_disabled)
edje_object_signal_emit(wd->base, "elm,state,inactive", "elm");
edje_object_signal_emit(wd->base, "elm,state,level,0", "elm"); edje_object_signal_emit(wd->base, "elm,state,level,0", "elm");
if (wd->items && !wd->indicator_disabled) if (wd->items && !wd->indicator_disabled)
edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm"); edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm");
@ -552,6 +567,7 @@ elm_index_add(Evas_Object *parent)
wd->indicator_disabled = EINA_FALSE; wd->indicator_disabled = EINA_FALSE;
wd->horizontal = EINA_FALSE; wd->horizontal = EINA_FALSE;
wd->autohide_disabled = EINA_FALSE;
wd->base = edje_object_add(e); wd->base = edje_object_add(e);
_elm_theme_object_set(obj, wd->base, "index", "base/vertical", "default"); _elm_theme_object_set(obj, wd->base, "index", "base/vertical", "default");
@ -602,16 +618,29 @@ elm_index_add(Evas_Object *parent)
return obj; return obj;
} }
EAPI void EINA_DEPRECATED EAPI void
elm_index_active_set(Evas_Object *obj, Eina_Bool active) elm_index_active_set(Evas_Object *obj, Eina_Bool active)
{
elm_index_autohide_disabled_set(obj, !active);
}
EINA_DEPRECATED EAPI Eina_Bool
elm_index_active_get(const Evas_Object *obj)
{
return !elm_index_autohide_disabled_get(obj);
}
EAPI void
elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled)
{ {
ELM_CHECK_WIDTYPE(obj, widtype); ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return; if (!wd) return;
if (wd->active == active) return; disabled = !!disabled;
wd->active = active; if (wd->autohide_disabled == disabled) return;
wd->autohide_disabled = disabled;
wd->level = 0; wd->level = 0;
if (wd->active) if (wd->autohide_disabled)
{ {
_index_box_clear(obj, wd->bx[1], 1); _index_box_clear(obj, wd->bx[1], 1);
_index_box_auto_fill(obj, wd->bx[0], 0); _index_box_auto_fill(obj, wd->bx[0], 0);
@ -622,12 +651,12 @@ elm_index_active_set(Evas_Object *obj, Eina_Bool active)
} }
EAPI Eina_Bool EAPI Eina_Bool
elm_index_active_get(const Evas_Object *obj) elm_index_autohide_disabled_get(const Evas_Object *obj)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE; if (!wd) return EINA_FALSE;
return wd->active; return wd->autohide_disabled;
} }
EAPI void EAPI void
@ -666,13 +695,13 @@ elm_index_item_selected_get(const Evas_Object *obj, int level)
} }
EAPI Elm_Object_Item * EAPI Elm_Object_Item *
elm_index_item_append(Evas_Object *obj, const char *letter, const void *item) elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it; Elm_Index_Item *it;
if (!wd) return NULL; if (!wd) return NULL;
it = _item_new(obj, letter, item); it = _item_new(obj, letter, func, data);
if (!it) return NULL; if (!it) return NULL;
wd->items = eina_list_append(wd->items, it); wd->items = eina_list_append(wd->items, it);
_index_box_clear(obj, wd->bx[wd->level], wd->level); _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)
} }
EAPI Elm_Object_Item * EAPI Elm_Object_Item *
elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item) elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it; Elm_Index_Item *it;
if (!wd) return NULL; if (!wd) return NULL;
it = _item_new(obj, letter, item); it = _item_new(obj, letter, func, data);
if (!it) return NULL; if (!it) return NULL;
wd->items = eina_list_prepend(wd->items, it); wd->items = eina_list_prepend(wd->items, it);
_index_box_clear(obj, wd->bx[wd->level], wd->level); _index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it; return (Elm_Object_Item *) it;
} }
EAPI Elm_Object_Item * EINA_DEPRECATED EAPI Elm_Object_Item *
elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; return elm_index_item_insert_after(obj, (Elm_Object_Item *) relative, letter, NULL, item);
Widget_Data *wd = elm_widget_data_get(obj); }
Elm_Index_Item *it;
if (!wd) return NULL;
if (!relative)
return elm_index_item_append(obj, letter, item);
it = _item_new(obj, letter, item);
if (!it) return NULL;
wd->items = eina_list_append_relative(wd->items, it, relative);
_index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it;
EINA_DEPRECATED EAPI Elm_Object_Item *
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
{
return elm_index_item_insert_before(obj, (Elm_Object_Item *) relative, letter, NULL, item);
} }
EAPI Elm_Object_Item * EAPI Elm_Object_Item *
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) elm_index_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *letter, Evas_Smart_Cb func, const void *data)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it; Elm_Index_Item *it;
if (!wd) return NULL; if (!wd) return NULL;
if (!relative) if (!after) return elm_index_item_append(obj, letter, func, data);
return elm_index_item_prepend(obj, letter, item); it = _item_new(obj, letter, func, data);
it = _item_new(obj, letter, item);
if (!it) return NULL; if (!it) return NULL;
wd->items = eina_list_prepend_relative(wd->items, it, relative); wd->items = eina_list_append_relative(wd->items, it, after);
_index_box_clear(obj, wd->bx[wd->level], wd->level); _index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it; return (Elm_Object_Item *) it;
} }
EAPI Elm_Object_Item * EAPI 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) elm_index_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *letter, Evas_Smart_Cb func, const void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it;
if (!wd) return NULL;
if (!before) return elm_index_item_prepend(obj, letter, func, data);
it = _item_new(obj, letter, func, data);
if (!it) return NULL;
wd->items = eina_list_prepend_relative(wd->items, it, before);
_index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it;
}
EAPI 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)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj); 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
if (!wd) return NULL; if (!wd) return NULL;
if (!(wd->items)) if (!(wd->items))
return elm_index_item_append(obj, letter, item); return elm_index_item_append(obj, letter, func, data);
it = _item_new(obj, letter, item); it = _item_new(obj, letter, func, data);
if (!it) return NULL; if (!it) return NULL;
lnear = eina_list_search_sorted_near_list(wd->items, cmp_func, it, &cmp); 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
elm_widget_item_free(it); elm_widget_item_free(it);
} }
} }
_index_box_clear(obj, wd->bx[wd->level], wd->level); _index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it; return (Elm_Object_Item *) it;
} }
@ -775,12 +811,12 @@ elm_index_item_del(Evas_Object *obj __UNUSED__, Elm_Object_Item *it)
} }
EAPI Elm_Object_Item * EAPI Elm_Object_Item *
elm_index_item_find(Evas_Object *obj, const void *item) elm_index_item_find(Evas_Object *obj, const void *data)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL; if (!wd) return NULL;
return (Elm_Object_Item *) _item_find(obj, item); return (Elm_Object_Item *) _item_find(obj, data);
} }
EAPI void EAPI void
@ -804,8 +840,14 @@ elm_index_item_clear(Evas_Object *obj)
} }
} }
EAPI void EINA_DEPRECATED EAPI void
elm_index_item_go(Evas_Object *obj, int level __UNUSED__) elm_index_item_go(Evas_Object *obj, int level __UNUSED__)
{
elm_index_level_go(obj, level);
}
EAPI void
elm_index_level_go(Evas_Object *obj, int level __UNUSED__)
{ {
ELM_CHECK_WIDTYPE(obj, widtype); ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);

View File

@ -66,25 +66,25 @@ EAPI Evas_Object *elm_index_add(Evas_Object *parent);
* Enable or disable auto hiding feature for a given index widget. * Enable or disable auto hiding feature for a given index widget.
* *
* @param obj The index object * @param obj The index object
* @param active @c EINA_TRUE to enable auto hiding, @c EINA_FALSE to disable * @param disabled @c EINA_TRUE to disable auto hiding, @c EINA_FALSE to enable
* *
* @see elm_index_active_get() * @see elm_index_autohide_disabled_get()
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active); EAPI void elm_index_autohide_disabled_set(Evas_Object *obj, Eina_Bool disabled);
/** /**
* Get whether auto hiding feature is enabled or not for a given index widget. * Get whether auto hiding feature is enabled or not for a given index widget.
* *
* @param obj The index object * @param obj The index object
* @return @c EINA_TRUE, if auto hiding is enabled, @c EINA_FALSE otherwise * @return @c EINA_TRUE, if auto hiding is disabled, @c EINA_FALSE otherwise
* *
* @see elm_index_active_set() for more details * @see elm_index_active_set() for more details
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI Eina_Bool elm_index_active_get(const Evas_Object *obj); EAPI Eina_Bool elm_index_autohide_disabled_get(const Evas_Object *obj);
/** /**
* Set the items level for a given index widget. * Set the items level for a given index widget.
@ -118,7 +118,6 @@ EAPI int elm_index_item_level_get(const Evas_Object *obj);
* *
* @ingroup Index * @ingroup Index
*/ */
//XXX: elm_index_selected_item_get.
EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level); EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level);
/** /**
@ -126,7 +125,8 @@ EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, i
* *
* @param obj The index object. * @param obj The index object.
* @param letter Letter under which the item should be indexed * @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item * @param func The function to call when the item is selected.
* @param data The item data to set for the index's item
* @return A handle to the item added or @c NULL, on errors * @return A handle to the item added or @c NULL, on errors
* *
* Despite the most common usage of the @p letter argument is for * 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
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, const void *item); EAPI Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
/** /**
* Prepend a new item on a given index widget. * Prepend a new item on a given index widget.
* *
* @param obj The index object. * @param obj The index object.
* @param letter Letter under which the item should be indexed * @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item * @param func The function to call when the item is selected.
* @param data The item data to set for the index's item
* @return A handle to the item added or @c NULL, on errors * @return A handle to the item added or @c NULL, on errors
* *
* Despite the most common usage of the @p letter argument is for * 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
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item); EAPI Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char *letter, Evas_Smart_Cb func, const void *data);
/** /**
* Append a new item, on a given index widget, <b>after the item * Insert a new item into the index object after item @p after.
* having @p relative as data</b>.
* *
* @param obj The index object. * @param obj The index object.
* @param after The index item to insert after.
* @param letter Letter under which the item should be indexed * @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item * @param func The function to call when the item is clicked.
* @param relative The index item to be the predecessor of this new one * @param data The item data to set for the index's item
* @return A handle to the item added or @c NULL, on errors * @return A handle to the item added or @c NULL, on errors
* *
* Despite the most common usage of the @p letter argument is for * 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 *
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI Elm_Object_Item *elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative); EAPI 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);
/** /**
* Prepend a new item, on a given index widget, <b>after the item * Insert a new item into the index object before item @p before.
* having @p relative as data</b>.
* *
* @param obj The index object. * @param obj The index object.
* @param before The index item to insert after.
* @param letter Letter under which the item should be indexed * @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item * @param func The function to call when the item is clicked.
* @param relative The index item to be the successor of this new one * @param data The item data to set for the index's item
* @return A handle to the item added or @c NULL, on errors * @return A handle to the item added or @c NULL, on errors
* *
* Despite the most common usage of the @p letter argument is for * 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
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI Elm_Object_Item *elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative); EAPI 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);
/** /**
* Insert a new item into the given index widget, using @p cmp_func * 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
* *
* @param obj The index object. * @param obj The index object.
* @param letter Letter under which the item should be indexed * @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item * @param func The function to call when the item is clicked.
* @param data The item data to set for the index's item
* @param cmp_func The comparing function to be used to sort index * @param cmp_func The comparing function to be used to sort index
* items <b>by #index item handles</b> * items <b>by #index item handles</b>
* @param cmp_data_func A @b fallback function to be called for the * @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
* *
* @ingroup Index * @ingroup Index
*/ */
EAPI 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); EAPI 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);
/** /**
* Find a given index widget's item, <b>using item data</b>. * Find a given index widget's item, <b>using item data</b>.
* *
* @param obj The index object * @param obj The index object
* @param item The item data pointed to by the desired index item * @param data The item data pointed to by the desired index item
* @return The index item handle, if found, or @c NULL otherwise * @return The index item handle, if found, or @c NULL otherwise
* *
* @ingroup Index * @ingroup Index
*/ */
//XXX: After changing above APIs, this should be deprecated. EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *data);
EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *item);
/** /**
* Removes @b all items from a given index widget. * Removes @b all items from a given index widget.
@ -273,8 +274,7 @@ EAPI void elm_index_item_clear(Evas_Object *obj);
* *
* @ingroup Index * @ingroup Index
*/ */
//XXX: how about elm_index_level_go ?? EAPI void elm_index_level_go(Evas_Object *obj, int level);
EAPI void elm_index_item_go(Evas_Object *obj, int level);
/** /**
* Get the letter (string) set on a given index widget item. * Get the letter (string) set on a given index widget item.