forked from enlightenment/efl
Change flippicker items functions names
elm_flippicker_item_prev/next -> elm_flippicker_item_prev_get/next_get elm_flippicker_item_selected_set(it) -> elm_flippicker_item_selected_set(it, bool selected) Added bool elm_flippicker_item_selected_get(it) SVN revision: 54377
This commit is contained in:
parent
8cbad3de66
commit
9d43ab9489
|
@ -13,15 +13,24 @@ _sel_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|||
printf("label of selected item is: %s\n", elm_flippicker_item_label_get(it));
|
||||
}
|
||||
|
||||
void
|
||||
_unsel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Elm_Flippicker_Item *it;
|
||||
Evas_Object *fp = data;
|
||||
it = elm_flippicker_selected_item_get(fp);
|
||||
elm_flippicker_item_selected_set(it, EINA_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
_third_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Elm_Flippicker_Item *it;
|
||||
Evas_Object *fp = data;
|
||||
it = elm_flippicker_first_item_get(fp);
|
||||
it = elm_flippicker_item_next(it);
|
||||
it = elm_flippicker_item_next(it);
|
||||
elm_flippicker_item_selected_set(it);
|
||||
it = elm_flippicker_item_next_get(it);
|
||||
it = elm_flippicker_item_next_get(it);
|
||||
elm_flippicker_item_selected_set(it, EINA_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -95,6 +104,12 @@ test_flippicker(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_
|
|||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Unselect year");
|
||||
evas_object_smart_callback_add(bt, "clicked", _unsel_cb, fp);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
evas_object_show(win);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2139,12 +2139,13 @@ extern "C" {
|
|||
EAPI Elm_Flippicker_Item *elm_flippicker_first_item_get(const Evas_Object *obj);
|
||||
EAPI Elm_Flippicker_Item *elm_flippicker_last_item_get(const Evas_Object *obj);
|
||||
EAPI Elm_Flippicker_Item *elm_flippicker_selected_item_get(const Evas_Object *obj);
|
||||
EAPI void elm_flippicker_item_selected_set(Elm_Flippicker_Item *item);
|
||||
EAPI void elm_flippicker_item_selected_set(Elm_Flippicker_Item *item, Eina_Bool selected);
|
||||
EAPI Eina_Bool elm_flippicker_item_selected_get(const Elm_Flippicker_Item *item);
|
||||
EAPI void elm_flippicker_item_del(Elm_Flippicker_Item *item);
|
||||
EAPI const char *elm_flippicker_item_label_get(const Elm_Flippicker_Item *item);
|
||||
EAPI void elm_flippicker_item_label_set(Elm_Flippicker_Item *item, const char *label);
|
||||
EAPI Elm_Flippicker_Item *elm_flippicker_item_prev(Elm_Flippicker_Item *item);
|
||||
EAPI Elm_Flippicker_Item *elm_flippicker_item_next(Elm_Flippicker_Item *item);
|
||||
EAPI Elm_Flippicker_Item *elm_flippicker_item_prev_get(Elm_Flippicker_Item *item);
|
||||
EAPI Elm_Flippicker_Item *elm_flippicker_item_next_get(Elm_Flippicker_Item *item);
|
||||
EAPI void elm_flippicker_interval_set(Evas_Object *obj, double interval);
|
||||
EAPI double elm_flippicker_interval_get(const Evas_Object *obj);
|
||||
/* smart callbacks called:
|
||||
|
|
|
@ -852,14 +852,20 @@ elm_flippicker_selected_item_get(const Evas_Object *obj)
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the selected state of a flippicker item.
|
||||
* Set the selected state of an item
|
||||
*
|
||||
* This sets the selected state (EINA_TRUE selected, EINA_FALSE not selected)
|
||||
* of the given item @p item.
|
||||
* If a new item is selected the previosly selected will be unselected.
|
||||
* If the item @p item is unselected, the first item will be selected.
|
||||
*
|
||||
* @param item The item
|
||||
* @param selected The selected state
|
||||
*
|
||||
* @ingroup Flippicker
|
||||
*/
|
||||
EAPI void
|
||||
elm_flippicker_item_selected_set(Elm_Flippicker_Item *item)
|
||||
elm_flippicker_item_selected_set(Elm_Flippicker_Item *item, Eina_Bool selected)
|
||||
{
|
||||
ELM_FLIPPICKER_ITEM_CHECK_DELETED_RETURN(item);
|
||||
|
||||
|
@ -873,11 +879,26 @@ elm_flippicker_item_selected_set(Elm_Flippicker_Item *item)
|
|||
return;
|
||||
|
||||
cur = DATA_GET(wd->current);
|
||||
if (cur == item)
|
||||
if ((selected) && (cur == item))
|
||||
return;
|
||||
|
||||
_flippicker_walk(wd);
|
||||
|
||||
if ((!selected) && (cur == item))
|
||||
{
|
||||
EINA_LIST_FOREACH(wd->items, l, _item)
|
||||
{
|
||||
if (!_item->deleted)
|
||||
{
|
||||
wd->current = l;
|
||||
_send_msg(wd, MSG_FLIP_UP, (char *)_item->label);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_flippicker_unwalk(wd);
|
||||
return;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(wd->items, l, _item)
|
||||
{
|
||||
if (_item == cur)
|
||||
|
@ -892,8 +913,25 @@ elm_flippicker_item_selected_set(Elm_Flippicker_Item *item)
|
|||
}
|
||||
|
||||
_flippicker_unwalk(wd);
|
||||
}
|
||||
|
||||
return;
|
||||
/*
|
||||
* Get the selected state of @p item.
|
||||
*
|
||||
* @param item The flippicker item
|
||||
* @return If true, the item is selected
|
||||
*
|
||||
* @ingroup Flippicker
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_flippicker_item_selected_get(const Elm_Flippicker_Item *item)
|
||||
{
|
||||
ELM_FLIPPICKER_ITEM_CHECK_DELETED_RETURN(item, EINA_FALSE);
|
||||
Widget_Data *wd;
|
||||
|
||||
wd = elm_widget_data_get(item->base.widget);
|
||||
if (!wd) return EINA_FALSE;
|
||||
return (eina_list_data_get(wd->current) == item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1009,7 +1047,7 @@ elm_flippicker_item_label_set(Elm_Flippicker_Item *item, const char *label)
|
|||
* @ingroup Flippicker
|
||||
*/
|
||||
EAPI Elm_Flippicker_Item *
|
||||
elm_flippicker_item_prev(Elm_Flippicker_Item *item)
|
||||
elm_flippicker_item_prev_get(Elm_Flippicker_Item *item)
|
||||
{
|
||||
ELM_FLIPPICKER_ITEM_CHECK_DELETED_RETURN(item, NULL);
|
||||
|
||||
|
@ -1042,7 +1080,7 @@ elm_flippicker_item_prev(Elm_Flippicker_Item *item)
|
|||
* @ingroup Flippicker
|
||||
*/
|
||||
EAPI Elm_Flippicker_Item *
|
||||
elm_flippicker_item_next(Elm_Flippicker_Item *item)
|
||||
elm_flippicker_item_next_get(Elm_Flippicker_Item *item)
|
||||
{
|
||||
ELM_FLIPPICKER_ITEM_CHECK_DELETED_RETURN(item, NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue