forked from enlightenment/efl
always_select added to normal list too.
SVN revision: 40406
This commit is contained in:
parent
6eeaf7eb1a
commit
9af8000740
|
@ -3300,6 +3300,7 @@ my_win_main(void)
|
||||||
evas_object_show(lb);
|
evas_object_show(lb);
|
||||||
|
|
||||||
li = elm_list_add(win);
|
li = elm_list_add(win);
|
||||||
|
elm_list_always_select_mode_set(li, 1);
|
||||||
evas_object_size_hint_weight_set(li, 1.0, 1.0);
|
evas_object_size_hint_weight_set(li, 1.0, 1.0);
|
||||||
evas_object_size_hint_align_set(li, -1.0, -1.0);
|
evas_object_size_hint_align_set(li, -1.0, -1.0);
|
||||||
elm_box_pack_end(bx0, li);
|
elm_box_pack_end(bx0, li);
|
||||||
|
|
|
@ -574,6 +574,7 @@ extern "C" {
|
||||||
EAPI void elm_list_go(Evas_Object *obj);
|
EAPI void elm_list_go(Evas_Object *obj);
|
||||||
EAPI void elm_list_multi_select_set(Evas_Object *obj, Evas_Bool multi);
|
EAPI void elm_list_multi_select_set(Evas_Object *obj, Evas_Bool multi);
|
||||||
EAPI void elm_list_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode);
|
EAPI void elm_list_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode);
|
||||||
|
EAPI void elm_list_always_select_mode_set(Evas_Object *obj, Evas_Bool always_select);
|
||||||
EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj);
|
EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj);
|
||||||
EAPI Elm_List_Item *elm_list_selected_item_get(const Evas_Object *obj);
|
EAPI Elm_List_Item *elm_list_selected_item_get(const Evas_Object *obj);
|
||||||
EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj);
|
EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj);
|
||||||
|
|
|
@ -12,6 +12,7 @@ struct _Widget_Data
|
||||||
Evas_Coord minw[2], minh[2];
|
Evas_Coord minw[2], minh[2];
|
||||||
Evas_Bool on_hold : 1;
|
Evas_Bool on_hold : 1;
|
||||||
Evas_Bool multi : 1;
|
Evas_Bool multi : 1;
|
||||||
|
Evas_Bool always_select : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Elm_List_Item
|
struct _Elm_List_Item
|
||||||
|
@ -129,13 +130,18 @@ _item_select(Elm_List_Item *it)
|
||||||
{
|
{
|
||||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||||
const char *selectraise;
|
const char *selectraise;
|
||||||
if (it->selected) return;
|
if (it->selected)
|
||||||
|
{
|
||||||
|
if (wd->always_select) goto call;
|
||||||
|
return;
|
||||||
|
}
|
||||||
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
||||||
selectraise = edje_object_data_get(it->base, "selectraise");
|
selectraise = edje_object_data_get(it->base, "selectraise");
|
||||||
if ((selectraise) && (!strcmp(selectraise, "on")))
|
if ((selectraise) && (!strcmp(selectraise, "on")))
|
||||||
evas_object_raise(it->base);
|
evas_object_raise(it->base);
|
||||||
it->selected = 1;
|
it->selected = 1;
|
||||||
wd->selected = eina_list_append(wd->selected, it);
|
wd->selected = eina_list_append(wd->selected, it);
|
||||||
|
call:
|
||||||
if (it->func) it->func((void *)it->data, it->obj, it);
|
if (it->func) it->func((void *)it->data, it->obj, it);
|
||||||
evas_object_smart_callback_call(it->obj, "selected", it);
|
evas_object_smart_callback_call(it->obj, "selected", it);
|
||||||
}
|
}
|
||||||
|
@ -191,6 +197,7 @@ _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
||||||
Elm_List_Item *it2;
|
Elm_List_Item *it2;
|
||||||
EINA_LIST_FOREACH_SAFE(wd->selected, l, l_next, it2)
|
EINA_LIST_FOREACH_SAFE(wd->selected, l, l_next, it2)
|
||||||
if (it2 != it) _item_unselect(it2);
|
if (it2 != it) _item_unselect(it2);
|
||||||
|
_item_select(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,6 +473,13 @@ elm_list_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode)
|
||||||
elm_scroller_content_min_limit(wd->scroller, 0, 0);
|
elm_scroller_content_min_limit(wd->scroller, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_list_always_select_mode_set(Evas_Object *obj, Evas_Bool always_select)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
wd->always_select = always_select;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI const Eina_List *
|
EAPI const Eina_List *
|
||||||
elm_list_items_get(const Evas_Object *obj)
|
elm_list_items_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue