elementary/index - Elm_Index_Item -> Elm_Object_Item

SVN revision: 66659
This commit is contained in:
ChunEon Park 2011-12-30 04:57:28 +00:00
parent b291d3c5be
commit 6f07cf3ea0
6 changed files with 57 additions and 56 deletions

View File

@ -3773,8 +3773,8 @@
* @until }
*
* It will get the last index item selected's data and find the
* respective #Elm_Index_Item handle with elm_index_item_find(). We
* need the latter to query the indexing letter string from, with
* respective index item handle(#Elm_Object_Item) with elm_index_item_find().
* We need the latter to query the indexing letter string from, with
* elm_index_item_letter_get(). Next, comes the delition, itself,
* which will also trigger the @c _index_item_del callback function,
* as said above.
@ -3827,7 +3827,7 @@
* each index item to base our ordering on. The parameters on
* @c _index_cmp have to be declared as void pointers because of the
* @c Eina_Compare_Cb prototype requisition, but in this case we know
* they'll be #Elm_Index_Item's:
* they'll be index item(#Elm_Object_Item)'s:
* @dontinclude index_example_02.c
* @skip ordering alphabetically
* @until }

View File

@ -126,11 +126,11 @@ int
test_index2_icmp(const void *data1, const void *data2)
{
const char *label1, *label2;
const Elm_Index_Item *it1 = data1;
const Elm_Index_Item *it2 = data2;
const Elm_Object_Item *index_it1 = data1;
const Elm_Object_Item *index_it2 = data2;
label1 = elm_index_item_letter_get(it1);
label2 = elm_index_item_letter_get(it2);
label1 = elm_index_item_letter_get(index_it1);
label2 = elm_index_item_letter_get(index_it2);
return strcasecmp(label1, label2);
}
@ -146,9 +146,9 @@ test_index2_it_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __U
label = elm_entry_entry_get(gui->entry);
snprintf(letter, sizeof(letter), "%c", label[0]);
it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL, NULL,
test_index2_cmp);
test_index2_cmp);
elm_index_item_sorted_insert(gui->id, letter, it, test_index2_icmp,
test_index2_cmp);
test_index2_cmp);
elm_list_go(gui->lst);
/* FIXME it's not showing the recently added item */
elm_list_item_show(it);
@ -160,7 +160,7 @@ test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__)
Test_Index2_Elements *gui = data;
const char *label, *label_next;
Elm_List_Item *it, *it_next;
Elm_Index_Item *iit;
Elm_Object_Item *iit;
it = elm_list_selected_item_get(obj);
it_next = elm_list_item_next(it);
@ -169,8 +169,8 @@ test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
iit = elm_index_item_find(gui->id, it);
if (iit) elm_index_item_del(gui->id, iit);
elm_list_item_del(it);
return;
elm_list_item_del(it);
return;
}
label = elm_list_item_label_get(it);

View File

@ -49,15 +49,15 @@ _item_del(void *data __UNUSED__,
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Elm_Index_Item *it;
Elm_Object_Item *iit;
Elm_List_Item *lit = elm_index_item_selected_get(d.index, 0);
it = elm_index_item_find(d.index, lit);
iit = elm_index_item_find(d.index, lit);
if (!it) return;
if (!iit) return;
fprintf(stdout, "Deleting last selected index item, which had letter"
" %s (pointing to %s)\n", elm_index_item_letter_get(it),
" %s (pointing to %s)\n", elm_index_item_letter_get(iit),
elm_list_item_label_get(lit));
elm_index_item_del(d.index, lit);
@ -154,7 +154,7 @@ elm_main(int argc __UNUSED__,
if (curr != dict[i][0])
{
Elm_Index_Item *index_it;
Elm_Object_Item *index_it;
char buf[32];
curr = dict[i][0];

View File

@ -83,11 +83,11 @@ _index_icmp(const void *data1,
{
const char *label1, *label2;
const Elm_Index_Item *it1 = data1;
const Elm_Index_Item *it2 = data2;
const Elm_Object_Item *index_it1 = data1;
const Elm_Object_Item *index_it2 = data2;
label1 = elm_index_item_letter_get(it1);
label2 = elm_index_item_letter_get(it2);
label1 = elm_index_item_letter_get(index_it1);
label2 = elm_index_item_letter_get(index_it2);
return strcasecmp(label1, label2);
}

View File

@ -1272,7 +1272,7 @@ extern "C" {
* @ingroup General
*/
EAPI Evas_Object *elm_object_name_find(const Evas_Object *obj, const char *name, int recurse);
/**
* Get the widget object's handle which contains a given item
*
@ -23147,8 +23147,6 @@ extern "C" {
* @{
*/
typedef struct _Elm_Index_Item Elm_Index_Item; /**< Opaque handle for items of Elementary index widgets */
/**
* Add a new index widget to the given parent Elementary
* (container) object
@ -23222,7 +23220,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI Elm_Index_Item *elm_index_item_selected_get(const Evas_Object *obj, int level) EINA_ARG_NONNULL(1);
EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level) EINA_ARG_NONNULL(1);
/**
* Append a new item on a given index widget.
@ -23281,7 +23279,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative) EINA_ARG_NONNULL(1);
EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) EINA_ARG_NONNULL(1);
/**
* Prepend a new item, on a given index widget, <b>after the item
@ -23304,7 +23302,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative) EINA_ARG_NONNULL(1);
EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative) EINA_ARG_NONNULL(1);
/**
* Insert a new item into the given index widget, using @p cmp_func
@ -23314,7 +23312,7 @@ extern "C" {
* @param letter Letter under which the item should be indexed
* @param item The item data to set for the index's item
* @param cmp_func The comparing function to be used to sort index
* items <b>by #Elm_Index_Item item handles</b>
* items <b>by #index item handles</b>
* @param cmp_data_func A @b fallback function to be called for the
* sorting of index items <b>by item data</b>). It will be used
* when @p cmp_func returns @c 0 (equality), which means an index
@ -23351,7 +23349,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI void elm_index_item_del(Evas_Object *obj, Elm_Index_Item *item) EINA_ARG_NONNULL(1);
EAPI void elm_index_item_del(Evas_Object *obj, Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* Find a given index widget's item, <b>using item data</b>.
@ -23362,7 +23360,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI Elm_Index_Item *elm_index_item_find(Evas_Object *obj, const void *item) EINA_ARG_NONNULL(1);
EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *item) EINA_ARG_NONNULL(1);
/**
* Removes @b all items from a given index widget.
@ -23396,7 +23394,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI void *elm_index_item_data_get(const Elm_Index_Item *item) EINA_ARG_NONNULL(1);
EAPI void *elm_index_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* Set the data associated with a given index widget item
@ -23411,7 +23409,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI void elm_index_item_data_set(Elm_Index_Item *it, const void *data) EINA_ARG_NONNULL(1);
EAPI void elm_index_item_data_set(Elm_Object_Item *it, const void *data) EINA_ARG_NONNULL(1);
/**
* Set the function to be called when a given index widget item is freed.
@ -23425,7 +23423,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI void elm_index_item_del_cb_set(Elm_Index_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
EAPI void elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
/**
* Get the letter (string) set on a given index widget item.
@ -23435,7 +23433,7 @@ extern "C" {
*
* @ingroup Index
*/
EAPI const char *elm_index_item_letter_get(const Elm_Index_Item *item) EINA_ARG_NONNULL(1);
EAPI const char *elm_index_item_letter_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* @}

View File

@ -3,6 +3,7 @@
#include "els_box.h"
typedef struct _Widget_Data Widget_Data;
typedef struct _Elm_Index_Item Elm_Index_Item;
struct _Widget_Data
{
@ -204,7 +205,7 @@ _item_find(Evas_Object *obj, const void *item)
Elm_Index_Item *it;
if (!wd) return NULL;
EINA_LIST_FOREACH(wd->items, l, it)
if (it->base.data == item) return it;
if (it->base.data == item) return it;
return NULL;
}
@ -298,7 +299,7 @@ static Eina_Bool
_delay_change(void *data)
{
Widget_Data *wd = elm_widget_data_get(data);
Elm_Index_Item *item;
Elm_Object_Item *item;
if (!wd) return ECORE_CALLBACK_CANCEL;
wd->delay = NULL;
item = elm_index_item_selected_get(data, wd->level);
@ -452,7 +453,7 @@ _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event
{
Widget_Data *wd = elm_widget_data_get(data);
Evas_Event_Mouse_Up *ev = event_info;
Elm_Index_Item *item;
Elm_Object_Item *item;
if (!wd) return;
if (ev->button != 1) return;
wd->down = 0;
@ -628,7 +629,7 @@ elm_index_item_level_get(const Evas_Object *obj)
return wd->level;
}
EAPI Elm_Index_Item *
EAPI Elm_Object_Item *
elm_index_item_selected_get(const Evas_Object *obj, int level)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@ -637,8 +638,10 @@ elm_index_item_selected_get(const Evas_Object *obj, int level)
Elm_Index_Item *it;
if (!wd) return NULL;
EINA_LIST_FOREACH(wd->items, l, it)
if ((it->selected) && (it->level == level))
return it;
{
if ((it->selected) && (it->level == level))
return (Elm_Object_Item *) it;
}
return NULL;
}
@ -670,7 +673,7 @@ elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item)
}
EAPI void
elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_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);
Widget_Data *wd = elm_widget_data_get(obj);
@ -688,7 +691,7 @@ elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void
}
EAPI void
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative)
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Object_Item *relative)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
@ -747,23 +750,23 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
}
EAPI void
elm_index_item_del(Evas_Object *obj, Elm_Index_Item *item)
elm_index_item_del(Evas_Object *obj, Elm_Object_Item *it)
{
ELM_CHECK_WIDTYPE(obj, widtype);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (!item) return;
_item_free(item);
_item_free((Elm_Index_Item *) it);
_index_box_clear(obj, wd->bx[wd->level], wd->level);
}
EAPI Elm_Index_Item *
EAPI Elm_Object_Item *
elm_index_item_find(Evas_Object *obj, const void *item)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return _item_find(obj, item);
return (Elm_Object_Item *) _item_find(obj, item);
}
EAPI void
@ -794,30 +797,30 @@ elm_index_item_go(Evas_Object *obj, int level __UNUSED__)
}
EAPI void *
elm_index_item_data_get(const Elm_Index_Item *it)
elm_index_item_data_get(const Elm_Object_Item *it)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return elm_widget_item_data_get(it);
}
EAPI void
elm_index_item_data_set(Elm_Index_Item *it, const void *data)
elm_index_item_data_set(Elm_Object_Item *it, const void *data)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
elm_widget_item_data_set(it, data);
}
EAPI void
elm_index_item_del_cb_set(Elm_Index_Item *it, Evas_Smart_Cb func)
elm_index_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
elm_widget_item_del_cb_set(it, func);
}
EAPI const char *
elm_index_item_letter_get(const Elm_Index_Item *it)
elm_index_item_letter_get(const Elm_Object_Item *it)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
return it->letter;
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return ((Elm_Index_Item *) it)->letter;
}