forked from enlightenment/efl
add new signal for list/genlist/gengrid: "activated"
this signal is called whenever an item receives either a double click or selection+(enter/spacebar/return) this commit also unifies the click/enter/spacebar/etc event api for these widgets, including removing the double click signal from keypress events and removing the 'clicked' signal from double click events SVN revision: 61720
This commit is contained in:
parent
2139708729
commit
47574fccbf
|
@ -4569,9 +4569,11 @@ extern "C" {
|
|||
* @section Gengrid_Smart_Events Gengrid smart events
|
||||
*
|
||||
* Smart events that you can add callbacks for are:
|
||||
* - @c "clicked,double" - The user has double-clicked or pressed
|
||||
* enter on an item. The @c event_info parameter is the gengrid
|
||||
* item that was double-clicked.
|
||||
* - @c "activated" - The user has double-clicked or pressed
|
||||
* (enter|return|spacebar) on an item. The @c event_info parameter
|
||||
* is the gengrid item that was activated.
|
||||
* - @c "clicked,double" - The user has double-clicked an item.
|
||||
* The @c event_info parameter is the gengrid item that was double-clicked.
|
||||
* - @c "selected" - The user has made an item selected. The
|
||||
* @c event_info parameter is the gengrid item that was selected.
|
||||
* - @c "unselected" - The user has made an item unselected. The
|
||||
|
@ -9276,7 +9278,11 @@ extern "C" {
|
|||
* lists, @ref Genlist should probably be used.
|
||||
*
|
||||
* Smart callbacks one can listen to:
|
||||
* - "clicked,double" - when the user double-clicked an item
|
||||
* - @c "activated" - The user has double-clicked or pressed
|
||||
* (enter|return|spacebar) on an item. The @c event_info parameter
|
||||
* is the item that was activated.
|
||||
* - @c "clicked,double" - The user has double-clicked an item.
|
||||
* The @c event_info parameter is the item that was double-clicked.
|
||||
* - "selected" - when the user selected an item
|
||||
* - "unselected" - when the user unselected an item
|
||||
* - "longpressed" - an item in the list is long-pressed
|
||||
|
@ -10718,9 +10724,11 @@ extern "C" {
|
|||
EAPI void elm_genlist_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_genlist_reorder_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/* Signals that you can add callbacks for are:
|
||||
* "clicked,double" - This is called when a user has double-clicked an item.
|
||||
* The event_info parameter is the genlist item that was
|
||||
* double-clicked.
|
||||
* - @c "activated" - The user has double-clicked or pressed
|
||||
* (enter|return|spacebar) on an item. The @c event_info parameter
|
||||
* is the item that was activated.
|
||||
* - @c "clicked,double" - The user has double-clicked an item.
|
||||
* The @c event_info parameter is the item that was double-clicked.
|
||||
* "selected" - This is called when a user has made an item selected. The
|
||||
* event_info parameter is the genlist item that was selected.
|
||||
* "unselected" - This is called when a user has made an item unselected. The
|
||||
|
|
|
@ -124,6 +124,7 @@ static Eina_Bool _deselect_all_items(Widget_Data *wd);
|
|||
static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
|
||||
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
||||
|
||||
static const char SIG_ACTIVATED[] = "activated";
|
||||
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
||||
static const char SIG_SELECTED[] = "selected";
|
||||
static const char SIG_UNSELECTED[] = "unselected";
|
||||
|
@ -142,6 +143,7 @@ static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
|
|||
static const char SIG_MOVED[] = "moved";
|
||||
|
||||
static const Evas_Smart_Cb_Description _signals[] = {
|
||||
{SIG_ACTIVATED, ""},
|
||||
{SIG_CLICKED_DOUBLE, ""},
|
||||
{SIG_SELECTED, ""},
|
||||
{SIG_UNSELECTED, ""},
|
||||
|
@ -337,7 +339,7 @@ _event_hook(Evas_Object *obj,
|
|||
(!strcmp(ev->keyname, "space")))
|
||||
{
|
||||
item = elm_gengrid_selected_item_get(obj);
|
||||
evas_object_smart_callback_call(item->wd->self, SIG_CLICKED_DOUBLE, item);
|
||||
evas_object_smart_callback_call(item->wd->self, SIG_ACTIVATED, item);
|
||||
}
|
||||
else return EINA_FALSE;
|
||||
|
||||
|
@ -783,7 +785,7 @@ _mouse_down(void *data,
|
|||
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
||||
{
|
||||
evas_object_smart_callback_call(item->wd->self, SIG_CLICKED_DOUBLE, item);
|
||||
evas_object_smart_callback_call(item->wd->self, "clicked", item); // will be removed
|
||||
evas_object_smart_callback_call(item->wd->self, SIG_ACTIVATED, item);
|
||||
}
|
||||
if (item->long_timer) ecore_timer_del(item->long_timer);
|
||||
if (item->realized)
|
||||
|
|
|
@ -412,6 +412,7 @@ static void _item_auto_scroll(Widget_Data *wd);
|
|||
|
||||
static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
|
||||
|
||||
static const char SIG_ACTIVATED[] = "activated";
|
||||
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
||||
static const char SIG_SELECTED[] = "selected";
|
||||
static const char SIG_UNSELECTED[] = "unselected";
|
||||
|
@ -442,6 +443,7 @@ static const char SIG_SWIPE[] = "swipe";
|
|||
|
||||
static const Evas_Smart_Cb_Description _signals[] = {
|
||||
{SIG_CLICKED_DOUBLE, ""},
|
||||
{SIG_ACTIVATED, ""},
|
||||
{SIG_SELECTED, ""},
|
||||
{SIG_UNSELECTED, ""},
|
||||
{SIG_EXPANDED, ""},
|
||||
|
@ -576,6 +578,7 @@ _event_hook(Evas_Object *obj,
|
|||
it = elm_genlist_selected_item_get(obj);
|
||||
elm_genlist_item_expanded_set(it,
|
||||
!elm_genlist_item_expanded_get(it));
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "Escape"))
|
||||
{
|
||||
|
@ -1421,7 +1424,10 @@ _mouse_down(void *data,
|
|||
_item_highlight(it);
|
||||
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
||||
if ((!it->disabled) && (!it->display_only))
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
|
||||
{
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
|
||||
}
|
||||
if (it->long_timer) ecore_timer_del(it->long_timer);
|
||||
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
|
||||
it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
|
||||
|
|
|
@ -77,6 +77,7 @@ static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
|
|||
Evas_Callback_Type type, void *event_info);
|
||||
static Eina_Bool _deselect_all_items(Widget_Data *wd);
|
||||
|
||||
static const char SIG_ACTIVATED[] = "activated";
|
||||
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
||||
static const char SIG_SELECTED[] = "selected";
|
||||
static const char SIG_UNSELECTED[] = "unselected";
|
||||
|
@ -87,6 +88,7 @@ static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
|
|||
static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
|
||||
|
||||
static const Evas_Smart_Cb_Description _signals[] = {
|
||||
{SIG_ACTIVATED, ""},
|
||||
{SIG_CLICKED_DOUBLE, ""},
|
||||
{SIG_SELECTED, ""},
|
||||
{SIG_UNSELECTED, ""},
|
||||
|
@ -271,6 +273,14 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
|
|||
y += page_y;
|
||||
}
|
||||
}
|
||||
else if (((!strcmp(ev->keyname, "Return")) ||
|
||||
(!strcmp(ev->keyname, "KP_Enter")) ||
|
||||
(!strcmp(ev->keyname, "space")))
|
||||
&& (!wd->multi) && (wd->selected))
|
||||
{
|
||||
it = elm_list_selected_item_get(obj);
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "Escape"))
|
||||
{
|
||||
if (!_deselect_all_items(wd)) return EINA_FALSE;
|
||||
|
@ -913,7 +923,10 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
|
|||
it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
|
||||
/* Always call the callbacks last - the user may delete our context! */
|
||||
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
|
||||
{
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
|
||||
evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
|
||||
}
|
||||
wd->swipe = EINA_FALSE;
|
||||
wd->movements = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue