elementary/index - return item handles.

SVN revision: 68660
This commit is contained in:
ChunEon Park 2012-03-04 13:51:17 +00:00
parent d6a8be7f95
commit d1ac092565
2 changed files with 40 additions and 42 deletions

View File

@ -665,87 +665,83 @@ elm_index_item_selected_get(const Evas_Object *obj, int level)
return NULL;
}
EAPI void
EAPI Elm_Object_Item *
elm_index_item_append(Evas_Object *obj, const char *letter, const void *item)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it;
if (!wd) return;
if (!wd) return NULL;
it = _item_new(obj, letter, item);
if (!it) return;
if (!it) return NULL;
wd->items = eina_list_append(wd->items, it);
_index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it;
}
EAPI void
EAPI Elm_Object_Item *
elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it;
if (!wd) return;
if (!wd) return NULL;
it = _item_new(obj, letter, item);
if (!it) return;
if (!it) return NULL;
wd->items = eina_list_prepend(wd->items, it);
_index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it;
}
EAPI void
EAPI Elm_Object_Item *
elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it;
if (!wd) return;
if (!wd) return NULL;
if (!relative)
{
elm_index_item_append(obj, letter, item);
return;
}
return elm_index_item_append(obj, letter, item);
it = _item_new(obj, letter, item);
if (!it) return;
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;
}
EAPI void
EAPI Elm_Object_Item *
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Elm_Index_Item *it;
if (!wd) return;
if (!wd) return NULL;
if (!relative)
{
elm_index_item_prepend(obj, letter, item);
return;
}
return elm_index_item_prepend(obj, letter, item);
it = _item_new(obj, letter, item);
if (!it) return;
if (!it) return NULL;
wd->items = eina_list_prepend_relative(wd->items, it, relative);
_index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it;
}
EAPI void
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_CHECK_WIDTYPE(obj, widtype);
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *lnear;
Elm_Index_Item *it;
int cmp;
if (!wd) return;
if (!wd) return NULL;
if (!(wd->items))
{
elm_index_item_append(obj, letter, item);
return;
}
return elm_index_item_append(obj, letter, item);
it = _item_new(obj, letter, item);
if (!it) return;
if (!it) return NULL;
lnear = eina_list_search_sorted_near_list(wd->items, cmp_func, it, &cmp);
if (cmp < 0)
@ -768,6 +764,8 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
}
_index_box_clear(obj, wd->bx[wd->level], wd->level);
return (Elm_Object_Item *) it;
}
EAPI void

View File

@ -126,6 +126,7 @@ EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, i
* @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
* @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
@ -136,8 +137,7 @@ EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, i
*
* @ingroup Index
*/
//XXX: Should be changed like Elm_Object_Item *elm_index_item_append(Evas_Object *obj, const char* letter, const void *data);
EAPI void 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, const void *item);
/**
* Prepend a new item on a given index widget.
@ -145,6 +145,7 @@ EAPI void elm_index_item_append(Evas_Object *obj, const char *l
* @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
* @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
@ -155,8 +156,7 @@ EAPI void elm_index_item_append(Evas_Object *obj, const char *l
*
* @ingroup Index
*/
//XXX: Should be changed like Elm_Object_Item *elm_index_item_prepend(Evas_Object *obj, const char* letter, const void *data);
EAPI void 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, const void *item);
/**
* Append a new item, on a given index widget, <b>after the item
@ -166,6 +166,7 @@ EAPI void elm_index_item_prepend(Evas_Object *obj, const char *
* @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
@ -179,8 +180,7 @@ EAPI void elm_index_item_prepend(Evas_Object *obj, const char *
*
* @ingroup Index
*/
//XXX: Should be changed like Elm_Object_Item *elm_index_item_insert_after(Evas_Object *obj, const Elm_Object_Item *after, const char* letter, const void *data);
EAPI void 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_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
@ -190,6 +190,7 @@ EAPI void elm_index_item_append_relative(Evas_Object *obj, cons
* @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
@ -203,8 +204,7 @@ EAPI void elm_index_item_append_relative(Evas_Object *obj, cons
*
* @ingroup Index
*/
//XXX: Should be changed like Elm_Object_Item *elm_index_item_insert_before(Evas_Object *obj, const Elm_Object_Item *before, const char* letter, const void *data);
EAPI void 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_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative);
/**
* Insert a new item into the given index widget, using @p cmp_func
@ -227,6 +227,7 @@ EAPI void elm_index_item_prepend_relative(Evas_Object *obj, con
* because all references to it will be lost. If this function is
* not provided (@c NULL is given), index items will be @b
* duplicated, if @p cmp_func returns @c 0.
* @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
@ -237,8 +238,7 @@ EAPI void elm_index_item_prepend_relative(Evas_Object *obj, con
*
* @ingroup Index
*/
//XXX: Should be changed like Elm_Object_Item *elm_index_item_sorted_insert(Evas_Object *obj, const char* letter, const void *data, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
EAPI void 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, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
/**
* Find a given index widget's item, <b>using item data</b>.