printf("unrealized item # %d\n", num);
}
+static void
+_gl_del_doubleclick_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info)
+{
+ int num = (int)(uintptr_t)elm_object_item_data_get(event_info);
+ int num_category = num % 4;
+
+ if (num_category == 3)
+ elm_genlist_clear(obj);
+}
static Evas_Object *
_gl_del_genlist_add(Evas_Object *bx)
{
evas_object_show(gl);
evas_object_smart_callback_add(gl, "unrealized",
_gl_del_unrealized_cb, NULL);
+ evas_object_smart_callback_add(gl, "clicked,double",
+ _gl_del_doubleclick_cb, NULL);
return gl;
}
{
char buf[256] = { 0 };
int num = (int)(uintptr_t)data;
- int num_category = num % 3;
+ int num_category = num % 4;
if (num_category == 0)
- snprintf(buf, sizeof(buf), "Item # %i - Item Del", num);
+ snprintf(buf, sizeof(buf),
+ "Item #%.02i - 1. Item Del", num);
else if (num_category == 1)
- snprintf(buf, sizeof(buf), "Item # %i - Genlist Clear and Item Append",
- num);
+ snprintf(buf, sizeof(buf),
+ "Item #%.02i - 2. Genlist Clear and Item Append", num);
else if (num_category == 2)
- snprintf(buf, sizeof(buf), "Item # %i - Genlist Del", num);
+ snprintf(buf, sizeof(buf),
+ "Item #%.02i - 3. Genlist Del", num);
+ else if (num_category == 3)
+ snprintf(buf, sizeof(buf),
+ "Item #%.02i - 4. Genlist Clear on double-click", num);
return strdup(buf);
}
_gl_del_sel(void *data, Evas_Object *obj, void *event_info)
{
int num = (int)(uintptr_t)data;
- int num_category = num % 3;
+ int num_category = num % 4;
Elm_Object_Item *it = event_info;
Elm_Genlist_Item_Class *itc =
(Elm_Genlist_Item_Class *)elm_genlist_item_item_class_get(it);
" on item selection.<br/>"
" 1. genlist item deletion<br/>"
" 2. genlist clear and item append<br/>"
- " 3. genlist del</align>");
+ " 3. genlist del<br/>"
+ " 4. genlist clear on double-click</align>");
elm_object_content_set(fr, lb);
evas_object_show(lb);
else sd->on_hold = EINA_FALSE;
if (sd->on_hold) return;
sd->wasselected = it->selected;
- it->highlight_cb(it);
- if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- if ((!elm_widget_item_disabled_get(it)) &&
- (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
- {
- evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
- evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
- }
- evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it);
+
ecore_timer_del(it->item->swipe_timer);
it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it);
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
it->long_timer = NULL;
sd->swipe = EINA_FALSE;
sd->movements = 0;
+
+ // and finally call the user callbacks.
+ // NOTE: keep this code at the bottom, as the user can change the
+ // list at this point (clear, delete, etc...)
+ it->highlight_cb(it);
+ if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
+ if ((!elm_widget_item_disabled_get(it)) &&
+ (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
+ {
+ evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
+ evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
+ }
+ evas_object_smart_callback_call(WIDGET(it), SIG_PRESSED, it);
}
static Item_Block *