forked from enlightenment/efl
elementary: API break ! using Elm_Index_Item instead of the item's data in the index widget. This was applied for function and smart callbacks
SVN revision: 65956
This commit is contained in:
parent
3dae010810
commit
65106b50ac
|
@ -20,7 +20,7 @@ index_changed2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
|
|||
{
|
||||
// called on a change but delayed in case multiple changes happen in a
|
||||
// short timespan
|
||||
elm_genlist_item_top_bring_in(event_info);
|
||||
elm_genlist_item_top_bring_in(elm_index_item_data_get(event_info));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -34,7 +34,7 @@ void
|
|||
index_selected(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||
{
|
||||
// called on final select
|
||||
elm_genlist_item_top_bring_in(event_info);
|
||||
elm_genlist_item_top_bring_in(elm_index_item_data_get(event_info));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -160,13 +160,15 @@ 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;
|
||||
|
||||
it = elm_list_selected_item_get(obj);
|
||||
it_next = elm_list_item_next(it);
|
||||
|
||||
if (!it_next)
|
||||
{
|
||||
elm_index_item_del(gui->id, it);
|
||||
iit = elm_index_item_find(gui->id, it);
|
||||
if (iit) elm_index_item_del(gui->id, iit);
|
||||
elm_list_item_del(it);
|
||||
return;
|
||||
}
|
||||
|
@ -174,14 +176,11 @@ test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
label = elm_list_item_label_get(it);
|
||||
label_next = elm_list_item_label_get(it_next);
|
||||
|
||||
iit = elm_index_item_find(gui->id, it);
|
||||
if (label[0] == label_next[0])
|
||||
{
|
||||
Elm_Index_Item *iit;
|
||||
iit = elm_index_item_find(gui->id, it);
|
||||
elm_index_item_data_set(iit, it_next);
|
||||
}
|
||||
elm_index_item_data_set(iit, it_next);
|
||||
else
|
||||
elm_index_item_del(gui->id, it);
|
||||
elm_index_item_del(gui->id, iit);
|
||||
|
||||
elm_list_item_del(it);
|
||||
}
|
||||
|
@ -189,7 +188,7 @@ test_index2_it_del(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
void
|
||||
test_index2_id_changed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||
{
|
||||
elm_list_item_show(event_info);
|
||||
elm_list_item_show(elm_index_item_data_get(event_info));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -22399,19 +22399,14 @@ extern "C" {
|
|||
EAPI int elm_index_item_level_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Returns the last selected item's data, for a given index widget.
|
||||
* Returns the last selected item, for a given index widget.
|
||||
*
|
||||
* @param obj The index object.
|
||||
* @return The item @b data associated to the last selected item on
|
||||
* @p obj (or @c NULL, on errors).
|
||||
*
|
||||
* @warning The returned value is @b not an #Elm_Index_Item item
|
||||
* handle, but the data associated to it (see the @c item parameter
|
||||
* in elm_index_item_append(), as an example).
|
||||
* @return The last item @b selected on @p obj (or @c NULL, on errors).
|
||||
*
|
||||
* @ingroup Index
|
||||
*/
|
||||
EAPI void *elm_index_item_selected_get(const Evas_Object *obj, int level) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Index_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.
|
||||
|
@ -22456,8 +22451,7 @@ extern "C" {
|
|||
* @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 item data of the index item to be the
|
||||
* predecessor of this new one
|
||||
* @param relative The index item to be the predecessor of this new one
|
||||
*
|
||||
* Despite the most common usage of the @p letter argument is for
|
||||
* single char strings, one could use arbitrary strings as index
|
||||
|
@ -22466,13 +22460,12 @@ extern "C" {
|
|||
* @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 or if it's not found to be data
|
||||
* set on any previous item on @p obj, this function will behave as
|
||||
* @note If @p relative is @c NULL this function will behave as
|
||||
* elm_index_item_append().
|
||||
*
|
||||
* @ingroup Index
|
||||
*/
|
||||
EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative) EINA_ARG_NONNULL(1);
|
||||
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);
|
||||
|
||||
/**
|
||||
* Prepend a new item, on a given index widget, <b>after the item
|
||||
|
@ -22481,8 +22474,7 @@ extern "C" {
|
|||
* @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 item data of the index item to be the
|
||||
* successor of this new one
|
||||
* @param relative The index item to be the successor of this new one
|
||||
*
|
||||
* Despite the most common usage of the @p letter argument is for
|
||||
* single char strings, one could use arbitrary strings as index
|
||||
|
@ -22491,13 +22483,12 @@ extern "C" {
|
|||
* @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 or if it's not found to be data
|
||||
* set on any previous item on @p obj, this function will behave as
|
||||
* @note If @p relative is @c NULL this function will behave as
|
||||
* elm_index_item_prepend().
|
||||
*
|
||||
* @ingroup Index
|
||||
*/
|
||||
EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative) EINA_ARG_NONNULL(1);
|
||||
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);
|
||||
|
||||
/**
|
||||
* Insert a new item into the given index widget, using @p cmp_func
|
||||
|
@ -22537,18 +22528,14 @@ extern "C" {
|
|||
* it's data value</b>.
|
||||
*
|
||||
* @param obj The index object
|
||||
* @param item The item's data pointer for the item to be removed
|
||||
* from @p obj
|
||||
* @param item The item to be removed from @p obj
|
||||
*
|
||||
* If a deletion callback is set, via elm_index_item_del_cb_set(),
|
||||
* that callback function will be called by this one.
|
||||
*
|
||||
* @warning The item to be removed from @p obj will be found via
|
||||
* its item data pointer, and not by an #Elm_Index_Item handle.
|
||||
*
|
||||
* @ingroup Index
|
||||
*/
|
||||
EAPI void elm_index_item_del(Evas_Object *obj, const void *item) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_index_item_del(Evas_Object *obj, Elm_Index_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Find a given index widget's item, <b>using item data</b>.
|
||||
|
|
|
@ -298,11 +298,11 @@ static Eina_Bool
|
|||
_delay_change(void *data)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
void *d;
|
||||
Elm_Index_Item *item;
|
||||
if (!wd) return ECORE_CALLBACK_CANCEL;
|
||||
wd->delay = NULL;
|
||||
d = (void *)elm_index_item_selected_get(data, wd->level);
|
||||
if (d) evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, d);
|
||||
item = elm_index_item_selected_get(data, wd->level);
|
||||
if (item) evas_object_smart_callback_call(data, SIG_DELAY_CHANGED, item);
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ _sel_eval(Evas_Object *obj, Evas_Coord evx, Evas_Coord evy)
|
|||
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
||||
if ((selectraise) && (!strcmp(selectraise, "on")))
|
||||
evas_object_raise(VIEW(it));
|
||||
evas_object_smart_callback_call((void *)obj, SIG_CHANGED, (void *)it->base.data);
|
||||
evas_object_smart_callback_call((void *)obj, SIG_CHANGED, (void *)it);
|
||||
if (wd->delay) ecore_timer_del(wd->delay);
|
||||
wd->delay = ecore_timer_add(0.2, _delay_change, obj);
|
||||
}
|
||||
|
@ -452,12 +452,12 @@ _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;
|
||||
void *d;
|
||||
Elm_Index_Item *item;
|
||||
if (!wd) return;
|
||||
if (ev->button != 1) return;
|
||||
wd->down = 0;
|
||||
d = (void *)elm_index_item_selected_get(data, wd->level);
|
||||
if (d) evas_object_smart_callback_call(data, SIG_SELECTED, d);
|
||||
item = elm_index_item_selected_get(data, wd->level);
|
||||
if (item) evas_object_smart_callback_call(data, SIG_SELECTED, item);
|
||||
elm_index_active_set(data, 0);
|
||||
edje_object_signal_emit(wd->base, "elm,state,level,0", "elm");
|
||||
edje_object_signal_emit(wd->base, "elm,indicator,state,inactive", "elm");
|
||||
|
@ -628,7 +628,7 @@ elm_index_item_level_get(const Evas_Object *obj)
|
|||
return wd->level;
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
EAPI Elm_Index_Item *
|
||||
elm_index_item_selected_get(const Evas_Object *obj, int level)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
|
@ -638,7 +638,7 @@ elm_index_item_selected_get(const Evas_Object *obj, int level)
|
|||
if (!wd) return NULL;
|
||||
EINA_LIST_FOREACH(wd->items, l, it)
|
||||
if ((it->selected) && (it->level == level))
|
||||
return elm_widget_item_data_get(it);
|
||||
return it;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -670,50 +670,38 @@ 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 void *relative)
|
||||
elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Elm_Index_Item *it, *it_rel;
|
||||
Elm_Index_Item *it;
|
||||
if (!wd) return;
|
||||
if (!relative)
|
||||
{
|
||||
elm_index_item_append(obj, letter, item);
|
||||
return;
|
||||
}
|
||||
it_rel = _item_find(obj, relative);
|
||||
if (!it_rel)
|
||||
{
|
||||
elm_index_item_append(obj, letter, item);
|
||||
return;
|
||||
}
|
||||
it = _item_new(obj, letter, item);
|
||||
if (!it) return;
|
||||
wd->items = eina_list_append_relative(wd->items, it, it_rel);
|
||||
wd->items = eina_list_append_relative(wd->items, it, relative);
|
||||
_index_box_clear(obj, wd->bx[wd->level], wd->level);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative)
|
||||
elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const Elm_Index_Item *relative)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Elm_Index_Item *it, *it_rel;
|
||||
Elm_Index_Item *it;
|
||||
if (!wd) return;
|
||||
if (!relative)
|
||||
{
|
||||
elm_index_item_prepend(obj, letter, item);
|
||||
return;
|
||||
}
|
||||
it_rel = _item_find(obj, relative);
|
||||
if (!it_rel)
|
||||
{
|
||||
elm_index_item_append(obj, letter, item);
|
||||
return;
|
||||
}
|
||||
it = _item_new(obj, letter, item);
|
||||
if (!it) return;
|
||||
wd->items = eina_list_prepend_relative(wd->items, it, it_rel);
|
||||
wd->items = eina_list_prepend_relative(wd->items, it, relative);
|
||||
_index_box_clear(obj, wd->bx[wd->level], wd->level);
|
||||
}
|
||||
|
||||
|
@ -759,15 +747,13 @@ elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *i
|
|||
}
|
||||
|
||||
EAPI void
|
||||
elm_index_item_del(Evas_Object *obj, const void *item)
|
||||
elm_index_item_del(Evas_Object *obj, Elm_Index_Item *item)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Elm_Index_Item *it;
|
||||
if (!wd) return;
|
||||
it = _item_find(obj, item);
|
||||
if (!it) return;
|
||||
_item_free(it);
|
||||
if (!item) return;
|
||||
_item_free(item);
|
||||
_index_box_clear(obj, wd->bx[wd->level], wd->level);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue