2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
2014-09-27 22:15:48 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:06:36 -07:00
|
|
|
#include "elm_widget_list.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_interface_scrollable.h"
|
2009-01-07 05:49:08 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_LIST_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_List"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_list"
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2014-01-23 06:11:12 -08:00
|
|
|
#define ELM_LIST_SWIPE_TIME 0.4
|
|
|
|
|
2011-07-25 18:49:24 -07:00
|
|
|
static const char SIG_ACTIVATED[] = "activated";
|
2011-04-21 08:57:03 -07:00
|
|
|
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
|
|
|
static const char SIG_SELECTED[] = "selected";
|
|
|
|
static const char SIG_UNSELECTED[] = "unselected";
|
|
|
|
static const char SIG_LONGPRESSED[] = "longpressed";
|
2011-10-20 09:42:42 -07:00
|
|
|
static const char SIG_EDGE_TOP[] = "edge,top";
|
|
|
|
static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
|
|
|
|
static const char SIG_EDGE_LEFT[] = "edge,left";
|
|
|
|
static const char SIG_EDGE_RIGHT[] = "edge,right";
|
2012-07-04 14:43:05 -07:00
|
|
|
static const char SIG_SWIPE[] = "swipe";
|
2013-01-14 02:12:50 -08:00
|
|
|
static const char SIG_HIGHLIGHTED[] = "highlighted";
|
|
|
|
static const char SIG_UNHIGHLIGHTED[] = "unhighlighted";
|
2014-02-18 06:40:48 -08:00
|
|
|
static const char SIG_ITEM_FOCUSED[] = "item,focused";
|
|
|
|
static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused";
|
2012-07-04 14:43:05 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2011-07-25 18:49:24 -07:00
|
|
|
{SIG_ACTIVATED, ""},
|
2011-04-21 08:57:03 -07:00
|
|
|
{SIG_CLICKED_DOUBLE, ""},
|
|
|
|
{SIG_SELECTED, ""},
|
|
|
|
{SIG_UNSELECTED, ""},
|
|
|
|
{SIG_LONGPRESSED, ""},
|
2011-10-20 09:42:42 -07:00
|
|
|
{SIG_EDGE_TOP, ""},
|
|
|
|
{SIG_EDGE_BOTTOM, ""},
|
|
|
|
{SIG_EDGE_LEFT, ""},
|
|
|
|
{SIG_EDGE_RIGHT, ""},
|
2012-07-04 14:43:05 -07:00
|
|
|
{SIG_SWIPE, ""},
|
2013-01-14 02:12:50 -08:00
|
|
|
{SIG_HIGHLIGHTED, ""},
|
|
|
|
{SIG_UNHIGHLIGHTED, ""},
|
2014-02-18 06:40:48 -08:00
|
|
|
{SIG_ITEM_FOCUSED, ""},
|
|
|
|
{SIG_ITEM_UNFOCUSED, ""},
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2011-04-21 08:57:03 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
static void _size_hints_changed_cb(void *, Evas *, Evas_Object *, void *);
|
|
|
|
static void _mouse_up_cb(void *, Evas *, Evas_Object *, void *);
|
|
|
|
static void _mouse_down_cb(void *, Evas *, Evas_Object *, void *);
|
|
|
|
static void _mouse_move_cb(void *, Evas *, Evas_Object *, void *);
|
2014-04-01 04:22:47 -07:00
|
|
|
static void _mouse_in_cb(void *, Evas *, Evas_Object *, void *);
|
2012-07-04 14:43:05 -07:00
|
|
|
static void _items_fix(Evas_Object *);
|
|
|
|
|
2014-04-14 21:13:57 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
|
|
|
|
|
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"select", _key_action_select},
|
|
|
|
{"escape", _key_action_escape},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-08-21 10:57:57 -07:00
|
|
|
static Eina_Bool
|
2014-09-27 22:15:48 -07:00
|
|
|
_is_no_select(Elm_List_Item_Data *it)
|
2014-08-21 10:57:57 -07:00
|
|
|
{
|
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-12-02 10:59:41 -08:00
|
|
|
static inline void
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_free(Elm_List_Item_Data *it)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it = it?EO_OBJ(it):NULL;
|
2014-05-10 07:37:03 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (sd->focused_item == eo_it)
|
2014-05-10 07:37:03 -07:00
|
|
|
sd->focused_item = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
if (sd->last_focused_item == eo_it)
|
2014-05-10 07:37:03 -07:00
|
|
|
sd->last_focused_item = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
if (sd->last_selected_item == eo_it)
|
2014-05-10 07:37:03 -07:00
|
|
|
sd->last_selected_item = NULL;
|
|
|
|
|
|
|
|
|
2009-12-02 10:59:41 -08:00
|
|
|
evas_object_event_callback_del_full
|
2012-07-04 14:43:05 -07:00
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, it);
|
2009-12-02 10:59:41 -08:00
|
|
|
evas_object_event_callback_del_full
|
2012-07-04 14:43:05 -07:00
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, it);
|
2009-12-02 10:59:41 -08:00
|
|
|
evas_object_event_callback_del_full
|
2012-07-04 14:43:05 -07:00
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, it);
|
2014-04-01 04:22:47 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_IN, _mouse_in_cb, it);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
if (it->icon)
|
|
|
|
evas_object_event_callback_del_full
|
2012-07-04 14:43:05 -07:00
|
|
|
(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_size_hints_changed_cb, WIDGET(it));
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
if (it->end)
|
|
|
|
evas_object_event_callback_del_full
|
2012-07-04 14:43:05 -07:00
|
|
|
(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_size_hints_changed_cb, WIDGET(it));
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2013-05-29 05:00:12 -07:00
|
|
|
ELM_SAFE_FREE(it->label, eina_stringshare_del);
|
|
|
|
ELM_SAFE_FREE(it->swipe_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(it->icon, evas_object_del);
|
|
|
|
ELM_SAFE_FREE(it->end, evas_object_del);
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:03 -07:00
|
|
|
static Eina_Bool
|
2014-03-31 05:59:55 -07:00
|
|
|
_item_multi_select_up(Elm_List_Data *sd)
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Elm_Object_Item *prev;
|
2010-10-05 12:10:03 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
if (!sd->multi) return EINA_FALSE;
|
|
|
|
|
|
|
|
prev = elm_list_item_prev(sd->last_selected_item);
|
2014-03-23 08:46:43 -07:00
|
|
|
while (prev)
|
|
|
|
{
|
|
|
|
if (!elm_object_item_disabled_get(prev)) break;
|
|
|
|
prev = elm_list_item_prev(prev);
|
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!prev) return EINA_TRUE;
|
|
|
|
|
|
|
|
if (elm_list_item_selected_get(prev))
|
|
|
|
{
|
|
|
|
elm_list_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
|
|
|
sd->last_selected_item = prev;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_list_item_selected_set(prev, EINA_TRUE);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-03-31 05:59:55 -07:00
|
|
|
_item_multi_select_down(Elm_List_Data *sd)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *next;
|
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
if (!sd->multi) return EINA_FALSE;
|
|
|
|
|
|
|
|
next = elm_list_item_next(sd->last_selected_item);
|
2014-03-23 08:46:43 -07:00
|
|
|
while (next)
|
|
|
|
{
|
|
|
|
if (!elm_object_item_disabled_get(next)) break;
|
|
|
|
next = elm_list_item_next(next);
|
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!next) return EINA_TRUE;
|
|
|
|
|
|
|
|
if (elm_list_item_selected_get(next))
|
|
|
|
{
|
|
|
|
elm_list_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
|
|
|
sd->last_selected_item = next;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_list_item_selected_set(next, EINA_TRUE);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-03-31 05:59:55 -07:00
|
|
|
_all_items_unselect(Elm_List_Data *sd)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
while (sd->selected)
|
|
|
|
elm_list_item_selected_set
|
2014-08-19 00:52:24 -07:00
|
|
|
(sd->selected->data, EINA_FALSE);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-03-31 05:59:55 -07:00
|
|
|
_item_single_select_up(Elm_List_Data *sd)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *prev;
|
|
|
|
|
2014-03-23 08:46:43 -07:00
|
|
|
if (!sd->selected)
|
|
|
|
prev = eina_list_data_get(eina_list_last(sd->items));
|
2012-08-09 04:54:37 -07:00
|
|
|
else
|
2014-03-23 08:46:43 -07:00
|
|
|
prev = elm_list_item_prev(sd->last_selected_item);
|
|
|
|
|
|
|
|
while (prev)
|
2012-08-09 04:54:37 -07:00
|
|
|
{
|
2014-03-23 08:46:43 -07:00
|
|
|
if (!elm_object_item_disabled_get(prev)) break;
|
|
|
|
prev = elm_list_item_prev(prev);
|
2012-08-09 04:54:37 -07:00
|
|
|
}
|
2014-03-23 08:46:43 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!prev) return EINA_FALSE;
|
|
|
|
|
|
|
|
_all_items_unselect(sd);
|
|
|
|
|
|
|
|
elm_list_item_selected_set(prev, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-03-31 05:59:55 -07:00
|
|
|
_item_single_select_down(Elm_List_Data *sd)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *next;
|
|
|
|
|
2014-03-23 08:46:43 -07:00
|
|
|
if (!sd->selected)
|
|
|
|
next = eina_list_data_get(sd->items);
|
2012-08-09 04:54:37 -07:00
|
|
|
else
|
2014-03-23 08:46:43 -07:00
|
|
|
next = elm_list_item_next(sd->last_selected_item);
|
|
|
|
|
|
|
|
while (next)
|
2012-08-09 04:54:37 -07:00
|
|
|
{
|
2014-03-23 08:46:43 -07:00
|
|
|
if (!elm_object_item_disabled_get(next)) break;
|
|
|
|
next = elm_list_item_next(next);
|
2012-08-09 04:54:37 -07:00
|
|
|
}
|
2014-03-23 08:46:43 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!next) return EINA_FALSE;
|
|
|
|
|
|
|
|
_all_items_unselect(sd);
|
|
|
|
|
|
|
|
elm_list_item_selected_set(next, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-02-20 02:00:49 -08:00
|
|
|
static Eina_Bool
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_content_focus_set(Elm_List_Item_Data *it, Elm_Focus_Direction dir,
|
2014-03-07 10:27:09 -08:00
|
|
|
Eina_Bool h_mode)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
|
|
|
if (!it) return EINA_FALSE;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2013-02-20 02:00:49 -08:00
|
|
|
|
2014-02-18 06:40:48 -08:00
|
|
|
if (!sd->focus_on_selection_enabled) return EINA_FALSE;
|
2014-04-06 11:08:20 -07:00
|
|
|
if ((h_mode && (dir != ELM_FOCUS_UP) && (dir != ELM_FOCUS_DOWN)) ||
|
|
|
|
(!h_mode && (dir != ELM_FOCUS_LEFT) && (dir != ELM_FOCUS_RIGHT)))
|
|
|
|
return EINA_FALSE;
|
2013-02-20 02:00:49 -08:00
|
|
|
|
|
|
|
int focus_objs = 0;
|
|
|
|
Evas_Object *focus_chain[2];
|
|
|
|
Evas_Object *focused = NULL;
|
|
|
|
int idx;
|
2014-06-10 22:07:01 -07:00
|
|
|
|
|
|
|
if (it->icon && elm_object_widget_check(it->icon) && elm_object_focus_allow_get(it->icon))
|
2013-02-20 02:00:49 -08:00
|
|
|
focus_chain[focus_objs++] = it->icon;
|
2014-06-10 22:07:01 -07:00
|
|
|
if (it->end && elm_object_widget_check(it->end) && elm_object_focus_allow_get(it->end))
|
2013-02-20 02:00:49 -08:00
|
|
|
focus_chain[focus_objs++] = it->end;
|
|
|
|
|
|
|
|
if (!focus_objs)
|
2014-04-06 11:08:20 -07:00
|
|
|
return EINA_FALSE;
|
2013-02-20 02:00:49 -08:00
|
|
|
|
|
|
|
for (idx = 0; idx < focus_objs; idx++)
|
|
|
|
{
|
|
|
|
if (elm_object_focus_get(focus_chain[idx]))
|
|
|
|
{
|
|
|
|
focused = focus_chain[idx];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!focused)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(focus_chain[0], EINA_TRUE);
|
2014-04-06 12:13:01 -07:00
|
|
|
return EINA_TRUE;
|
2013-02-20 02:00:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dir != ELM_FOCUS_PREVIOUS)
|
|
|
|
{
|
|
|
|
Evas_Object *nextfocus;
|
|
|
|
if (elm_widget_focus_next_get(focused, dir, &nextfocus))
|
|
|
|
{
|
|
|
|
elm_object_focus_set(nextfocus, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
idx += ((dir == ELM_FOCUS_UP) || (dir == ELM_FOCUS_LEFT)) ? -1 : 1;
|
|
|
|
if (idx < 0) idx = focus_objs - 1;
|
|
|
|
if (idx >= focus_objs) idx = 0;
|
|
|
|
focused = focus_chain[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_object_focus_set(focused, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
static Elm_Object_Item *
|
|
|
|
_next_item_get(Elm_List_Data *sd, Elm_Object_Item *eo_cur, Elm_Focus_Direction dir)
|
2014-02-20 08:09:55 -08:00
|
|
|
{
|
|
|
|
Eina_List *list = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-02-20 08:09:55 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
list = eina_list_data_find_list(sd->items, eo_cur);
|
|
|
|
if (!list) return NULL;
|
2014-02-20 08:09:55 -08:00
|
|
|
if ((!sd->h_mode && (dir == ELM_FOCUS_UP)) ||
|
|
|
|
((sd->h_mode) && (dir == ELM_FOCUS_LEFT)))
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = eina_list_data_get(eina_list_prev(list));
|
2014-02-20 08:09:55 -08:00
|
|
|
else if (((!sd->h_mode) && (dir == ELM_FOCUS_DOWN)) ||
|
|
|
|
((sd->h_mode) && (dir == ELM_FOCUS_RIGHT)))
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = eina_list_data_get(eina_list_next(list));
|
2014-02-20 08:09:55 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return eo_it;
|
2014-02-20 08:09:55 -08:00
|
|
|
}
|
|
|
|
|
2014-02-18 06:40:48 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_item_focused_next(Evas_Object *obj, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
ELM_LIST_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-02-18 06:40:48 -08:00
|
|
|
|
2014-02-20 08:09:55 -08:00
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = _next_item_get(sd, sd->focused_item, dir);
|
2014-02-20 08:09:55 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
while (eo_it &&
|
|
|
|
elm_object_item_disabled_get(eo_it))
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = _next_item_get(sd, eo_it, dir);
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
2014-02-20 08:09:55 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (eo_it)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2014-02-20 08:09:55 -08:00
|
|
|
return EINA_TRUE;
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
2014-02-20 08:09:55 -08:00
|
|
|
|
2014-02-18 06:40:48 -08:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-06 12:01:32 -07:00
|
|
|
static Eina_Bool
|
2014-04-14 21:13:57 -07:00
|
|
|
_elm_list_elm_widget_event_direction(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
|
2014-04-06 12:01:32 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-04-06 12:01:32 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
Eina_Bool ret = EINA_FALSE;
|
|
|
|
Evas_Coord v = 0;
|
|
|
|
Evas_Coord min = 0;
|
|
|
|
Eina_Bool focus_only = EINA_FALSE;
|
|
|
|
|
|
|
|
// check if the content can get the focus by direction key
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(elm_object_focused_item_get(obj) , it);
|
2014-04-06 12:01:32 -07:00
|
|
|
if (_elm_list_item_content_focus_set(it, dir, sd->h_mode))
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
if ((sd->h_mode && (dir != ELM_FOCUS_LEFT) && (dir != ELM_FOCUS_RIGHT)) ||
|
|
|
|
(!sd->h_mode && (dir != ELM_FOCUS_UP) && (dir != ELM_FOCUS_DOWN)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
// get content size and viewport size
|
|
|
|
if ((dir == ELM_FOCUS_LEFT) || (dir == ELM_FOCUS_RIGHT))
|
|
|
|
{
|
|
|
|
eo_do(obj,
|
entry: wrong viewport value calculation issue fix
Summary:
Issue: As entire scroller edje co-ordinates was being taken instead of the actual viewport value,
if in scroller edje more parts are added apart from just "elm.swallow.content", then the viewport value
set will be wrong. hence the selection handlers will not hide when they have to hide.
solution: Instead of taking scroller edje's geometry, get the actual viewport values.
To get viewport x,y a new scrollable interface is also added.
signed-off by: Shilpa Singh <shilpa.singh@samsung.com>
@fix
Test Plan: Selection handlers have to hide correctly when the text is scrolled in a scrolled entry, if the scroller edc of entry has more parts added other than elm.swallow.content, then when we scroll the selection handlers are not hidden correctly.
Reviewers: jaehwan, woohyun, seoz, Hermet, raster
CC: govi, rajeshps, thiepha
Differential Revision: https://phab.enlightenment.org/D674
2014-04-20 20:31:49 -07:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(NULL, NULL, &v, NULL),
|
2014-04-06 12:01:32 -07:00
|
|
|
elm_interface_scrollable_content_size_get(&min, NULL));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eo_do(obj,
|
entry: wrong viewport value calculation issue fix
Summary:
Issue: As entire scroller edje co-ordinates was being taken instead of the actual viewport value,
if in scroller edje more parts are added apart from just "elm.swallow.content", then the viewport value
set will be wrong. hence the selection handlers will not hide when they have to hide.
solution: Instead of taking scroller edje's geometry, get the actual viewport values.
To get viewport x,y a new scrollable interface is also added.
signed-off by: Shilpa Singh <shilpa.singh@samsung.com>
@fix
Test Plan: Selection handlers have to hide correctly when the text is scrolled in a scrolled entry, if the scroller edc of entry has more parts added other than elm.swallow.content, then when we scroll the selection handlers are not hidden correctly.
Reviewers: jaehwan, woohyun, seoz, Hermet, raster
CC: govi, rajeshps, thiepha
Differential Revision: https://phab.enlightenment.org/D674
2014-04-20 20:31:49 -07:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(NULL, NULL, NULL, &v),
|
2014-04-06 12:01:32 -07:00
|
|
|
elm_interface_scrollable_content_size_get(NULL, &min));
|
|
|
|
}
|
|
|
|
|
|
|
|
// move focus or selection according to the configuration
|
|
|
|
focus_only = _elm_config->item_select_on_focus_disable && elm_widget_focus_highlight_enabled_get(obj);
|
|
|
|
if (focus_only)
|
|
|
|
ret = _item_focused_next(obj, dir);
|
|
|
|
else
|
|
|
|
{
|
2014-04-14 21:13:57 -07:00
|
|
|
if (multi)
|
2014-04-06 12:01:32 -07:00
|
|
|
{
|
|
|
|
if ((dir == ELM_FOCUS_LEFT) || (dir == ELM_FOCUS_UP))
|
|
|
|
ret = _item_multi_select_up(sd);
|
|
|
|
else
|
|
|
|
ret = _item_multi_select_down(sd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((dir == ELM_FOCUS_LEFT) || (dir == ELM_FOCUS_UP))
|
|
|
|
ret = _item_single_select_up(sd);
|
|
|
|
else
|
|
|
|
ret = _item_single_select_down(sd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ret)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
// handle item loop feature
|
2014-07-21 23:11:17 -07:00
|
|
|
if (sd->item_loop_enable && !sd->item_looping_on)
|
2014-04-06 12:01:32 -07:00
|
|
|
{
|
|
|
|
if (min > v)
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_LEFT)
|
2014-07-21 23:11:17 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,looping,left", "elm");
|
|
|
|
sd->item_looping_on = EINA_TRUE;
|
|
|
|
}
|
2014-04-06 12:01:32 -07:00
|
|
|
else if (dir == ELM_FOCUS_RIGHT)
|
2014-07-21 23:11:17 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,looping,right", "elm");
|
|
|
|
sd->item_looping_on = EINA_TRUE;
|
|
|
|
}
|
2014-04-06 12:01:32 -07:00
|
|
|
else if (dir == ELM_FOCUS_UP)
|
2014-07-21 23:11:17 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,looping,up", "elm");
|
|
|
|
sd->item_looping_on = EINA_TRUE;
|
|
|
|
}
|
2014-04-06 12:01:32 -07:00
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
2014-07-21 23:11:17 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,looping,down", "elm");
|
|
|
|
sd->item_looping_on = EINA_TRUE;
|
|
|
|
}
|
2014-04-06 12:01:32 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((dir == ELM_FOCUS_LEFT) || (dir == ELM_FOCUS_UP))
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = elm_list_last_item_get(obj);
|
2014-04-06 12:01:32 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = elm_list_first_item_get(obj);
|
2014-04-06 12:01:32 -07:00
|
|
|
|
|
|
|
if (focus_only)
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2014-04-06 12:01:32 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(eo_it, EINA_TRUE);
|
2014-04-06 12:01:32 -07:00
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-07-21 23:11:17 -07:00
|
|
|
else if (sd->item_looping_on)
|
|
|
|
return EINA_TRUE;
|
2014-04-06 12:01:32 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-14 21:13:57 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2014-04-14 21:13:57 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2010-10-05 12:10:03 -07:00
|
|
|
Evas_Coord x = 0;
|
|
|
|
Evas_Coord y = 0;
|
|
|
|
Evas_Coord v_w = 0;
|
|
|
|
Evas_Coord v_h = 0;
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Coord step_x = 0;
|
|
|
|
Evas_Coord step_y = 0;
|
2010-10-05 12:10:03 -07:00
|
|
|
Evas_Coord page_x = 0;
|
|
|
|
Evas_Coord page_y = 0;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *it = NULL;
|
2010-10-05 12:10:03 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2014-03-17 04:44:40 -07:00
|
|
|
elm_interface_scrollable_content_pos_get(&x, &y),
|
|
|
|
elm_interface_scrollable_step_size_get(&step_x, &step_y),
|
|
|
|
elm_interface_scrollable_page_size_get(&page_x, &page_y),
|
entry: wrong viewport value calculation issue fix
Summary:
Issue: As entire scroller edje co-ordinates was being taken instead of the actual viewport value,
if in scroller edje more parts are added apart from just "elm.swallow.content", then the viewport value
set will be wrong. hence the selection handlers will not hide when they have to hide.
solution: Instead of taking scroller edje's geometry, get the actual viewport values.
To get viewport x,y a new scrollable interface is also added.
signed-off by: Shilpa Singh <shilpa.singh@samsung.com>
@fix
Test Plan: Selection handlers have to hide correctly when the text is scrolled in a scrolled entry, if the scroller edc of entry has more parts added other than elm.swallow.content, then when we scroll the selection handlers are not hidden correctly.
Reviewers: jaehwan, woohyun, seoz, Hermet, raster
CC: govi, rajeshps, thiepha
Differential Revision: https://phab.enlightenment.org/D674
2014-04-20 20:31:49 -07:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(NULL, NULL, &v_w, &v_h));
|
2014-04-06 12:01:32 -07:00
|
|
|
|
2010-10-19 13:19:12 -07:00
|
|
|
/* TODO: fix logic for horizontal mode */
|
2014-04-14 21:13:57 -07:00
|
|
|
if (!strcmp(dir, "left"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2014-04-14 21:13:57 -07:00
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_LEFT, EINA_FALSE))
|
|
|
|
return EINA_TRUE;
|
2014-04-06 12:01:32 -07:00
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "left_multi"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2014-04-14 21:13:57 -07:00
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_LEFT, EINA_TRUE))
|
|
|
|
return EINA_TRUE;
|
2014-04-06 12:01:32 -07:00
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "right"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2014-04-14 21:13:57 -07:00
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_RIGHT, EINA_FALSE))
|
|
|
|
return EINA_TRUE;
|
2014-04-06 12:01:32 -07:00
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "right_multi"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2014-04-14 21:13:57 -07:00
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_RIGHT, EINA_TRUE))
|
|
|
|
return EINA_TRUE;
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "up"))
|
|
|
|
{
|
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_UP, EINA_FALSE))
|
|
|
|
return EINA_TRUE;
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "up_multi"))
|
|
|
|
{
|
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_UP, EINA_TRUE))
|
|
|
|
return EINA_TRUE;
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "down"))
|
|
|
|
{
|
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_DOWN, EINA_FALSE))
|
|
|
|
return EINA_TRUE;
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "down_multi"))
|
|
|
|
{
|
|
|
|
if (_elm_list_elm_widget_event_direction(obj, ELM_FOCUS_DOWN, EINA_TRUE))
|
|
|
|
return EINA_TRUE;
|
2014-04-06 12:01:32 -07:00
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "first"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
it = eina_list_data_get(sd->items);
|
2014-03-18 03:14:39 -07:00
|
|
|
if (it)
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(it, EINA_TRUE);
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2014-03-18 03:14:39 -07:00
|
|
|
}
|
2014-03-22 02:30:45 -07:00
|
|
|
else
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "last"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
it = eina_list_data_get(eina_list_last(sd->items));
|
2014-03-18 03:14:39 -07:00
|
|
|
if (it)
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(it, EINA_TRUE);
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2014-03-18 03:14:39 -07:00
|
|
|
}
|
2014-03-22 02:30:45 -07:00
|
|
|
else
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "prior"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->h_mode)
|
2010-11-10 10:04:51 -08:00
|
|
|
{
|
|
|
|
if (page_x < 0)
|
|
|
|
x -= -(page_x * v_w) / 100;
|
|
|
|
else
|
|
|
|
x -= page_x;
|
|
|
|
}
|
2010-10-05 12:10:03 -07:00
|
|
|
else
|
2010-11-10 10:04:51 -08:00
|
|
|
{
|
|
|
|
if (page_y < 0)
|
|
|
|
y -= -(page_y * v_h) / 100;
|
|
|
|
else
|
|
|
|
y -= page_y;
|
|
|
|
}
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
else if (!strcmp(dir, "next"))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->h_mode)
|
2010-11-10 10:04:51 -08:00
|
|
|
{
|
|
|
|
if (page_x < 0)
|
|
|
|
x += -(page_x * v_w) / 100;
|
|
|
|
else
|
|
|
|
x += page_x;
|
|
|
|
}
|
2010-10-05 12:10:03 -07:00
|
|
|
else
|
2010-11-10 10:04:51 -08:00
|
|
|
{
|
|
|
|
if (page_y < 0)
|
|
|
|
y += -(page_y * v_h) / 100;
|
|
|
|
else
|
|
|
|
y += page_y;
|
|
|
|
}
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2014-03-31 05:59:55 -07:00
|
|
|
else return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_content_pos_set(x, y, EINA_TRUE));
|
2014-04-14 21:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-04-14 21:13:57 -07:00
|
|
|
|
|
|
|
if (!_elm_config->item_select_on_focus_disable &&
|
|
|
|
(!sd->multi) && (sd->selected))
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = elm_list_selected_item_get(obj);
|
2014-04-14 21:13:57 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = elm_object_focused_item_get(obj);
|
|
|
|
elm_list_item_selected_set(eo_it, EINA_TRUE);
|
|
|
|
if (eo_it)
|
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2014-11-25 04:55:37 -08:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, eo_it);
|
2014-09-27 22:15:48 -07:00
|
|
|
}
|
2014-04-14 21:13:57 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2010-10-05 12:10:03 -07:00
|
|
|
|
2014-04-14 21:13:57 -07:00
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!_all_items_unselect(sd)) return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_event(Eo *obj, Elm_List_Data *sd, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
|
|
|
{
|
|
|
|
(void) src;
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
|
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
|
|
|
if (!sd->items) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!_elm_config_key_binding_call(obj, ev, key_actions))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2011-10-19 07:17:14 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2010-10-27 07:38:54 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *it;
|
2013-04-23 04:30:15 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->items, l, it)
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_do(it, elm_wdg_item_translate());
|
2013-04-23 04:30:15 -07:00
|
|
|
|
2014-04-03 08:32:21 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, elm_obj_widget_translate());
|
2014-01-23 03:20:43 -08:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-27 07:38:54 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
static void
|
2014-03-31 05:59:55 -07:00
|
|
|
_elm_list_deletions_process(Elm_List_Data *sd)
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it;
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->walking++; // avoid nested deletion and also _sub_del() items_fix
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->to_delete, it)
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->items = eina_list_remove_list(sd->items, it->node);
|
|
|
|
|
|
|
|
/* issuing free because of "locking" item del pre hook */
|
|
|
|
_elm_list_item_free(it);
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_del(EO_OBJ(it));
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
sd->walking--;
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_elm_layout_sizing_eval(Eo *obj, Elm_List_Data *sd)
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
2012-07-19 21:20:06 -07:00
|
|
|
Evas_Coord vw = 0, vh = 0;
|
2014-10-06 01:29:05 -07:00
|
|
|
Evas_Coord minw = 0, minh = 0, maxw = 0, maxh = 0, w = 0, h = 0, vmw = 0, vmh = 0;
|
|
|
|
double xw = 0.0, yw = 0.0;
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2013-10-05 01:14:47 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
evas_object_size_hint_min_get(sd->box, &minw, &minh);
|
|
|
|
evas_object_size_hint_max_get(sd->box, &maxw, &maxh);
|
|
|
|
evas_object_size_hint_weight_get(sd->box, &xw, &yw);
|
|
|
|
|
entry: wrong viewport value calculation issue fix
Summary:
Issue: As entire scroller edje co-ordinates was being taken instead of the actual viewport value,
if in scroller edje more parts are added apart from just "elm.swallow.content", then the viewport value
set will be wrong. hence the selection handlers will not hide when they have to hide.
solution: Instead of taking scroller edje's geometry, get the actual viewport values.
To get viewport x,y a new scrollable interface is also added.
signed-off by: Shilpa Singh <shilpa.singh@samsung.com>
@fix
Test Plan: Selection handlers have to hide correctly when the text is scrolled in a scrolled entry, if the scroller edc of entry has more parts added other than elm.swallow.content, then when we scroll the selection handlers are not hidden correctly.
Reviewers: jaehwan, woohyun, seoz, Hermet, raster
CC: govi, rajeshps, thiepha
Differential Revision: https://phab.enlightenment.org/D674
2014-04-20 20:31:49 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(NULL, NULL, &vw, &vh));
|
2012-07-04 14:43:05 -07:00
|
|
|
if (xw > 0.0)
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if ((minw > 0) && (vw < minw)) vw = minw;
|
|
|
|
else if ((maxw > 0) && (vw > maxw))
|
|
|
|
vw = maxw;
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
else if (minw > 0)
|
|
|
|
vw = minw;
|
|
|
|
if (yw > 0.0)
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if ((minh > 0) && (vh < minh)) vh = minh;
|
|
|
|
else if ((maxh > 0) && (vh > maxh))
|
|
|
|
vh = maxh;
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
else if (minh > 0)
|
|
|
|
vh = minh;
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_resize(sd->box, vw, vh);
|
|
|
|
w = -1;
|
|
|
|
h = -1;
|
2010-10-27 07:38:57 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
edje_object_size_min_calc
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, &vmw, &vmh);
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->scr_minw) w = vmw + minw;
|
|
|
|
if (sd->scr_minh) h = vmh + minh;
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_size_hint_max_get(obj, &maxw, &maxh);
|
|
|
|
if ((maxw > 0) && (w > maxw))
|
|
|
|
w = maxw;
|
|
|
|
if ((maxh > 0) && (h > maxh))
|
|
|
|
h = maxh;
|
|
|
|
|
|
|
|
evas_object_size_hint_min_set(obj, w, h);
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
static void
|
|
|
|
_elm_list_content_min_limit_cb(Evas_Object *obj,
|
2012-07-17 08:02:22 -07:00
|
|
|
Eina_Bool w,
|
|
|
|
Eina_Bool h)
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2010-10-27 07:38:57 -07:00
|
|
|
|
2014-02-13 19:19:40 -08:00
|
|
|
if ((sd->mode == ELM_LIST_LIMIT) ||
|
|
|
|
(sd->mode == ELM_LIST_EXPAND)) return;
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->scr_minw = !!w;
|
|
|
|
sd->scr_minh = !!h;
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
|
|
|
|
2009-12-02 10:59:41 -08:00
|
|
|
static void
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_mode_set_internal(Evas_Object *obj)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
Elm_List_Data *sd = eo_data_scope_get(obj, MY_CLASS);
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->mode == ELM_LIST_LIMIT)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!sd->h_mode)
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_TRUE;
|
|
|
|
sd->scr_minh = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_FALSE;
|
|
|
|
sd->scr_minh = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->mode == ELM_LIST_EXPAND)
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_TRUE;
|
|
|
|
sd->scr_minh = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_FALSE;
|
|
|
|
sd->scr_minh = EINA_FALSE;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2014-03-31 05:59:55 -07:00
|
|
|
_elm_list_walk(Elm_List_Data *sd)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->walking < 0)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2011-04-01 04:26:58 -07:00
|
|
|
ERR("ERROR: walking was negative. fixed!\n");
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->walking = 0;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->walking++;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2014-03-31 05:59:55 -07:00
|
|
|
_elm_list_unwalk(Evas_Object *obj, Elm_List_Data *sd)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->walking--;
|
|
|
|
if (sd->walking < 0)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2011-04-01 04:26:58 -07:00
|
|
|
ERR("ERROR: walking became negative. fixed!\n");
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->walking = 0;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->walking)
|
2009-12-02 10:59:41 -08:00
|
|
|
return;
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->to_delete)
|
|
|
|
_elm_list_deletions_process(sd);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->fix_pending)
|
2009-12-02 10:59:41 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->fix_pending = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
_items_fix(obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
}
|
2009-01-07 05:49:08 -08:00
|
|
|
|
2011-06-09 03:08:58 -07:00
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_items_fix(Evas_Object *obj)
|
2011-06-09 03:08:58 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 };
|
2012-03-21 22:58:49 -07:00
|
|
|
const Eina_List *l;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Coord mw, mh;
|
|
|
|
int i, redo = 0;
|
2012-03-21 22:58:49 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *style;
|
|
|
|
const char *it_odd;
|
|
|
|
const char *it_plain;
|
|
|
|
const char *it_compress;
|
|
|
|
const char *it_compress_odd;
|
2012-03-21 22:58:49 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
style = elm_widget_style_get(obj);
|
|
|
|
it_plain = sd->h_mode ? "h_item" : "item";
|
|
|
|
it_odd = sd->h_mode ? "h_item_odd" : "item_odd";
|
|
|
|
it_compress = sd->h_mode ? "h_item_compress" : "item_compress";
|
|
|
|
it_compress_odd = sd->h_mode ? "h_item_compress_odd" : "item_compress_odd";
|
|
|
|
|
|
|
|
if (sd->walking)
|
|
|
|
{
|
|
|
|
sd->fix_pending = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(sd); // watch out "return" before unwalk!
|
2011-06-09 03:08:58 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_it)
|
2012-03-21 22:58:49 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
if (it->deleted) continue;
|
2012-03-21 22:58:49 -07:00
|
|
|
if (it->icon)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
|
|
|
evas_object_size_hint_min_get(it->icon, &mw, &mh);
|
|
|
|
if (mw > minw[0]) minw[0] = mw;
|
|
|
|
if (mh > minh[0]) minh[0] = mh;
|
|
|
|
}
|
2012-03-21 22:58:49 -07:00
|
|
|
if (it->end)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
|
|
|
evas_object_size_hint_min_get(it->end, &mw, &mh);
|
|
|
|
if (mw > minw[1]) minw[1] = mw;
|
|
|
|
if (mh > minh[1]) minh[1] = mh;
|
|
|
|
}
|
2012-03-21 22:58:49 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if ((minw[0] != sd->minw[0]) || (minw[1] != sd->minw[1]) ||
|
|
|
|
(minh[0] != sd->minh[0]) || (minh[1] != sd->minh[1]))
|
|
|
|
{
|
|
|
|
sd->minw[0] = minw[0];
|
|
|
|
sd->minw[1] = minw[1];
|
|
|
|
sd->minh[0] = minh[0];
|
|
|
|
sd->minh[1] = minh[1];
|
|
|
|
redo = 1;
|
|
|
|
}
|
2011-06-09 03:08:58 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
i = 0;
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_it)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
if (it->deleted)
|
|
|
|
continue;
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
it->even = i & 0x1;
|
|
|
|
if ((it->even != it->is_even) || (!it->fixed) || (redo))
|
|
|
|
{
|
|
|
|
const char *stacking;
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (it->is_separator)
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, VIEW(it), "separator", sd->h_mode ?
|
2013-11-16 01:13:37 -08:00
|
|
|
"vertical" : "horizontal", style);
|
2012-07-04 14:43:05 -07:00
|
|
|
else if (sd->mode == ELM_LIST_COMPRESS)
|
|
|
|
{
|
|
|
|
if (it->even)
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, VIEW(it), "list", it_compress, style);
|
|
|
|
else
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, VIEW(it), "list", it_compress_odd, style);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->even)
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, VIEW(it), "list", it_plain, style);
|
|
|
|
else
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, VIEW(it), "list", it_odd, style);
|
|
|
|
}
|
|
|
|
stacking = edje_object_data_get(VIEW(it), "stacking");
|
|
|
|
if (stacking)
|
|
|
|
{
|
|
|
|
if (!strcmp(stacking, "below"))
|
|
|
|
evas_object_lower(VIEW(it));
|
|
|
|
else if (!strcmp(stacking, "above"))
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2013-01-02 22:23:33 -08:00
|
|
|
if (!it->is_separator)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2013-01-02 22:23:33 -08:00
|
|
|
edje_object_part_text_escaped_set
|
|
|
|
(VIEW(it), "elm.text", it->label);
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_do(EO_OBJ(it), elm_wdg_item_part_text_custom_update());
|
2013-01-02 22:23:33 -08:00
|
|
|
|
|
|
|
if ((!it->icon) && (minh[0] > 0))
|
|
|
|
{
|
|
|
|
it->icon = evas_object_rectangle_add
|
|
|
|
(evas_object_evas_get(VIEW(it)));
|
|
|
|
evas_object_color_set(it->icon, 0, 0, 0, 0);
|
|
|
|
it->dummy_icon = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if ((!it->end) && (minh[1] > 0))
|
|
|
|
{
|
|
|
|
it->end = evas_object_rectangle_add
|
|
|
|
(evas_object_evas_get(VIEW(it)));
|
|
|
|
evas_object_color_set(it->end, 0, 0, 0, 0);
|
|
|
|
it->dummy_end = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (it->icon)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
|
|
|
|
evas_object_size_hint_max_set(it->icon, 99999, 99999);
|
|
|
|
edje_object_part_swallow
|
|
|
|
(VIEW(it), "elm.swallow.icon", it->icon);
|
|
|
|
}
|
|
|
|
if (it->end)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
|
|
|
|
evas_object_size_hint_max_set(it->end, 99999, 99999);
|
|
|
|
edje_object_part_swallow
|
|
|
|
(VIEW(it), "elm.swallow.end", it->end);
|
|
|
|
}
|
2014-02-24 07:58:28 -08:00
|
|
|
if (eina_list_count(sd->items) == 1)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,list,single", "elm");
|
|
|
|
}
|
|
|
|
else if (l == sd->items) //1st item
|
2014-02-20 09:10:10 -08:00
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,list,first", "elm");
|
|
|
|
}
|
|
|
|
else if (l == eina_list_last(sd->items))
|
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,list,last", "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,list,middle", "elm");
|
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
}
|
|
|
|
if (!it->fixed)
|
|
|
|
{
|
|
|
|
// this may call up user and it may modify the list item
|
|
|
|
// but we're safe as we're flagged as walking.
|
|
|
|
// just don't process further
|
|
|
|
edje_object_message_signal_process(VIEW(it));
|
|
|
|
if (it->deleted)
|
|
|
|
continue;
|
|
|
|
mw = mh = -1;
|
2013-01-02 22:23:33 -08:00
|
|
|
if (!it->is_separator)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2012-07-04 14:43:05 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
|
|
|
(VIEW(it), &mw, &mh, mw, mh);
|
2013-09-13 21:31:32 -07:00
|
|
|
/*
|
|
|
|
FIXME: this fixed T179 but introduced T286.
|
|
|
|
Temporarily disable these lines until it gets fixed correctly.
|
|
|
|
Evas_Coord ew, eh;
|
2013-07-04 10:58:16 -07:00
|
|
|
edje_object_parts_extends_calc
|
|
|
|
(VIEW(it), NULL, NULL, &ew, &eh);
|
|
|
|
mw = mw > ew ? mw : ew;
|
|
|
|
mh = mh > eh ? mh : eh;
|
2013-09-13 21:31:32 -07:00
|
|
|
*/
|
2013-01-02 22:23:33 -08:00
|
|
|
if (!it->is_separator)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_size_hint_min_set(VIEW(it), mw, mh);
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
}
|
|
|
|
if ((it->selected) || (it->highlighted))
|
|
|
|
{
|
|
|
|
const char *select_raise;
|
|
|
|
|
|
|
|
// this may call up user and it may modify the list item
|
|
|
|
// but we're safe as we're flagged as walking.
|
|
|
|
// just don't process further
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,selected", "elm");
|
|
|
|
if (it->deleted)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
select_raise = edje_object_data_get(VIEW(it), "selectraise");
|
|
|
|
if ((select_raise) && (!strcmp(select_raise, "on")))
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
}
|
2014-09-27 22:15:48 -07:00
|
|
|
if (it->base->disabled)
|
2012-07-04 14:43:05 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
|
|
|
|
|
|
|
|
it->fixed = EINA_TRUE;
|
|
|
|
it->is_even = it->even;
|
|
|
|
}
|
2013-01-02 22:23:33 -08:00
|
|
|
|
|
|
|
if (!it->is_separator)
|
|
|
|
i++;
|
2012-01-29 22:06:03 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_mode_set_internal(obj);
|
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-03-12 06:02:17 -07:00
|
|
|
//focus highlight in_theme is set by list item theme.
|
|
|
|
_elm_widget_item_highlight_in_theme(
|
|
|
|
obj, elm_list_first_item_get(obj));
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:00 -07:00
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_size_hints_changed_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2012-08-29 16:38:58 -07:00
|
|
|
ELM_LIST_DATA_GET(data, sd);
|
|
|
|
if (sd->delete_me) return;
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
_items_fix(data);
|
|
|
|
elm_layout_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: take off later. maybe this show region coords belong in the
|
|
|
|
* interface (new api functions, set/get)? */
|
|
|
|
static void
|
2012-11-25 22:32:53 -08:00
|
|
|
_show_region_hook(void *data EINA_UNUSED,
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj)
|
2010-10-05 12:10:00 -07:00
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2010-10-05 12:10:00 -07:00
|
|
|
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_content_region_set(x, y, w, h));
|
2010-10-05 12:10:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_disable(Eo *obj, Elm_List_Data *sd)
|
2010-11-18 02:01:05 -08:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-04-03 08:32:21 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_disable());
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2010-11-18 02:01:05 -08:00
|
|
|
if (elm_widget_disabled_get(obj))
|
|
|
|
{
|
|
|
|
elm_widget_scroll_freeze_push(obj);
|
|
|
|
elm_widget_scroll_hold_push(obj);
|
2011-08-25 10:19:22 -07:00
|
|
|
/* FIXME: if we get to have a way to only un-highlight items
|
2010-11-18 02:01:05 -08:00
|
|
|
* in the future, keeping them selected... */
|
2012-07-04 14:43:05 -07:00
|
|
|
_all_items_unselect(sd);
|
2010-11-18 02:01:05 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_widget_scroll_freeze_pop(obj);
|
|
|
|
elm_widget_scroll_hold_pop(obj);
|
|
|
|
}
|
2010-10-05 12:10:00 -07:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-09 11:53:36 -07:00
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool rtl)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2011-02-08 04:08:28 -08:00
|
|
|
Eina_List *n;
|
|
|
|
|
2012-07-17 07:56:32 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_mirrored_set(rtl));
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, n, eo_it)
|
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
edje_object_mirrored_set(VIEW(it), rtl);
|
|
|
|
}
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_theme_apply(Eo *obj, Elm_List_Data *sd)
|
2010-01-15 01:32:43 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2010-01-15 01:32:43 -08:00
|
|
|
Eina_List *n;
|
2010-10-15 04:34:22 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-04-03 08:32:21 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, n, eo_it)
|
2010-01-15 01:32:43 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
edje_object_scale_set
|
|
|
|
(VIEW(it), elm_widget_scale_get(obj) * elm_config_scale_get());
|
2013-01-02 10:36:22 -08:00
|
|
|
it->fixed = EINA_FALSE;
|
2010-01-15 01:32:43 -08:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
_items_fix(obj);
|
2014-02-21 11:09:46 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2010-10-05 12:10:08 -07:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-02-18 06:40:48 -08:00
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_focused(Elm_Object_Item *eo_it)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-05-11 01:53:00 -07:00
|
|
|
Evas_Coord x, y, w, h, sx, sy, sw, sh;
|
2014-02-18 06:40:48 -08:00
|
|
|
const char *focus_raise;
|
|
|
|
|
2014-08-21 10:57:57 -07:00
|
|
|
if ((!sd) || _is_no_select(it) ||
|
2014-09-27 22:15:48 -07:00
|
|
|
(eo_it == sd->focused_item))
|
2014-02-18 06:40:48 -08:00
|
|
|
return;
|
2014-05-11 01:53:00 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
|
|
|
evas_object_geometry_get(sd->hit_rect, &sx, &sy, &sw, &sh);
|
2014-05-11 07:06:59 -07:00
|
|
|
if (!ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h))
|
2014-05-11 01:53:00 -07:00
|
|
|
{
|
2014-05-11 06:42:45 -07:00
|
|
|
switch (_elm_config->focus_autoscroll_mode)
|
|
|
|
{
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_show(eo_it);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_bring_in(eo_it);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-05-11 01:53:00 -07:00
|
|
|
}
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->focused_item = eo_it;
|
2014-02-18 06:40:48 -08:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(WIDGET(it)))
|
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,focused", "elm");
|
|
|
|
}
|
|
|
|
focus_raise = edje_object_data_get(VIEW(it), "focusraise");
|
|
|
|
if ((focus_raise) && (!strcmp(focus_raise, "on")))
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
evas_object_smart_callback_call
|
2014-09-27 22:15:48 -07:00
|
|
|
(WIDGET(it), SIG_ITEM_FOCUSED, eo_it);
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_unfocused(Elm_Object_Item *eo_it)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 07:29:16 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2014-02-18 06:40:48 -08:00
|
|
|
|
2014-03-15 14:38:12 -07:00
|
|
|
if ((!sd) || (!sd->focused_item) ||
|
2014-09-27 22:15:48 -07:00
|
|
|
(eo_it != sd->focused_item))
|
2014-03-01 07:26:08 -08:00
|
|
|
return;
|
|
|
|
|
2014-08-21 10:57:57 -07:00
|
|
|
if (_is_no_select(it))
|
2014-02-18 06:40:48 -08:00
|
|
|
return;
|
2014-03-01 07:26:08 -08:00
|
|
|
|
2014-03-23 07:29:16 -07:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj))
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2014-03-23 07:29:16 -07:00
|
|
|
edje_object_signal_emit
|
2014-09-27 22:15:48 -07:00
|
|
|
(VIEW(focus_it), "elm,state,unfocused", "elm");
|
2014-03-23 07:29:16 -07:00
|
|
|
}
|
2014-03-01 07:26:08 -08:00
|
|
|
|
|
|
|
sd->focused_item = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, eo_it);
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:16:23 -07:00
|
|
|
/*
|
|
|
|
* This function searches the nearest visible item based on the given item.
|
|
|
|
* If the given item is in the list viewport, this returns the given item.
|
|
|
|
* Or this searches other items and checks the nearest fully visible item
|
|
|
|
* according to the given item's position.
|
|
|
|
*/
|
2014-09-27 22:15:48 -07:00
|
|
|
static Elm_List_Item_Data *
|
|
|
|
_elm_list_nearest_visible_item_get(Evas_Object *obj, Elm_List_Item_Data *it)
|
2014-03-23 02:16:23 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vx = 0, vy = 0, vw = 0, vh = 0; // list viewport geometry
|
|
|
|
Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry
|
|
|
|
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry
|
|
|
|
Eina_List *item_list = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *item = NULL;
|
2014-03-23 02:16:23 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2014-03-23 09:51:37 -07:00
|
|
|
Eina_Bool search_next = EINA_FALSE;
|
2014-03-23 02:16:23 -07:00
|
|
|
|
|
|
|
if (!it) return NULL;
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &vx, &vy, &vw, &vh);
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
item_list = eina_list_data_find_list(sd->items, EO_OBJ(it));
|
2014-03-23 02:16:23 -07:00
|
|
|
|
2014-03-23 09:51:37 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
if (!elm_object_item_disabled_get(EO_OBJ(it)))
|
2014-03-23 09:51:37 -07:00
|
|
|
return it;
|
|
|
|
else
|
|
|
|
search_next = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-03-23 02:16:23 -07:00
|
|
|
if ((!sd->h_mode && (iy < vy)) ||
|
2014-03-23 09:51:37 -07:00
|
|
|
(sd->h_mode && (iw < vw)) ||
|
|
|
|
search_next)
|
2014-03-23 02:16:23 -07:00
|
|
|
{
|
|
|
|
while ((item_list = eina_list_next(item_list)))
|
|
|
|
{
|
2014-11-24 00:38:36 -08:00
|
|
|
item = eo_data_scope_get(eina_list_data_get(item_list), ELM_LIST_ITEM_CLASS);
|
2014-03-23 02:16:23 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 09:51:37 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:48 -07:00
|
|
|
!elm_object_item_disabled_get(EO_OBJ(item)))
|
2014-03-23 02:16:23 -07:00
|
|
|
return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while ((item_list = eina_list_prev(item_list)))
|
|
|
|
{
|
2014-11-24 00:38:36 -08:00
|
|
|
item = eo_data_scope_get(eina_list_data_get(item_list), ELM_LIST_ITEM_CLASS);
|
2014-03-23 02:16:23 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 09:51:37 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:48 -07:00
|
|
|
!elm_object_item_disabled_get(EO_OBJ(item)))
|
2014-03-23 02:16:23 -07:00
|
|
|
return item;
|
|
|
|
}
|
|
|
|
}
|
2014-04-03 20:04:04 -07:00
|
|
|
return it;
|
2014-03-23 02:16:23 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_on_focus(Eo *obj, Elm_List_Data *sd)
|
2009-01-25 15:18:25 -08:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-03-23 02:16:23 -07:00
|
|
|
Eina_Bool is_sel = EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-04-03 08:32:21 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_on_focus());
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
if (elm_widget_focus_get(obj) && sd->selected && !sd->last_selected_item)
|
2014-09-27 22:15:48 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *sel = eina_list_data_get(sd->selected);
|
2014-08-19 00:52:24 -07:00
|
|
|
sd->last_selected_item = eo_data_scope_get(sel, ELM_LIST_ITEM_CLASS);
|
2014-09-27 22:15:48 -07:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!sd->items) return EINA_FALSE;
|
2014-02-27 20:46:13 -08:00
|
|
|
|
2014-03-23 00:48:10 -07:00
|
|
|
if (elm_widget_focus_get(obj) && !sd->mouse_down)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-03-18 13:15:36 -07:00
|
|
|
if (sd->last_focused_item)
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = sd->last_focused_item;
|
2014-03-18 13:15:36 -07:00
|
|
|
else if (sd->last_selected_item)
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = sd->last_selected_item;
|
2014-07-21 02:55:55 -07:00
|
|
|
else if (_elm_config->first_item_focus_on_first_focus_in &&
|
|
|
|
elm_widget_focus_highlight_enabled_get(obj))
|
2014-03-23 02:16:23 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_it = elm_list_first_item_get(obj);
|
2014-03-23 02:16:23 -07:00
|
|
|
is_sel = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (eo_it)
|
2014-03-23 02:16:23 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 02:16:23 -07:00
|
|
|
it = _elm_list_nearest_visible_item_get(obj, it);
|
|
|
|
if (it)
|
|
|
|
{
|
2014-04-05 08:10:55 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable && is_sel)
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(EO_OBJ(it), EINA_TRUE);
|
2014-03-23 02:16:23 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2014-03-23 02:16:23 -07:00
|
|
|
}
|
|
|
|
}
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->last_focused_item = sd->focused_item;
|
2014-02-27 20:46:13 -08:00
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_unfocused(sd->focused_item);
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_sub_object_del(Eo *obj, Elm_List_Data *sd, Evas_Object *sobj)
|
2009-01-25 15:18:25 -08:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2009-02-25 11:50:45 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-04-03 08:32:21 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_sub_object_del(sobj));
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
if ((sobj == sd->box) || (sobj == obj)) goto end;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_it)
|
2009-01-25 15:18:25 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
if ((sobj == it->icon) || (sobj == it->end))
|
2010-03-13 19:48:22 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (it->icon == sobj) it->icon = NULL;
|
|
|
|
if (it->end == sobj) it->end = NULL;
|
2011-06-09 01:36:55 -07:00
|
|
|
evas_object_event_callback_del_full
|
2012-07-04 14:43:05 -07:00
|
|
|
(sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb,
|
|
|
|
obj);
|
|
|
|
if (!sd->walking)
|
2010-03-13 19:48:22 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
_items_fix(obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
2010-03-13 19:48:22 -08:00
|
|
|
}
|
2011-06-09 01:36:55 -07:00
|
|
|
else
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->fix_pending = EINA_TRUE;
|
2011-06-09 01:36:55 -07:00
|
|
|
break;
|
2010-03-13 19:48:22 -08:00
|
|
|
}
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
end:
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_TRUE;
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_item_highlight(Elm_List_Item_Data *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
const char *select_raise;
|
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2014-08-21 10:57:57 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-09-27 22:15:48 -07:00
|
|
|
(it->highlighted) || (it->base->disabled))
|
2014-08-21 08:12:40 -07:00
|
|
|
return;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_HIGHLIGHTED, EO_OBJ(it));
|
2012-07-04 14:43:05 -07:00
|
|
|
select_raise = edje_object_data_get(VIEW(it), "selectraise");
|
|
|
|
if ((select_raise) && (!strcmp(select_raise, "on")))
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_raise(VIEW(it));
|
2011-08-25 10:19:22 -07:00
|
|
|
it->highlighted = EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_item_select(Elm_List_Item_Data *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2014-11-25 04:55:37 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (it->base->disabled || _is_no_select(it))
|
2012-07-04 14:43:05 -07:00
|
|
|
return;
|
2014-07-14 20:09:49 -07:00
|
|
|
if (!sd->focus_on_selection_enabled)
|
2014-06-10 22:14:28 -07:00
|
|
|
{
|
2014-07-14 20:09:49 -07:00
|
|
|
if (it->icon && elm_object_widget_check(it->icon) &&
|
|
|
|
elm_object_focus_get(it->icon))
|
2014-06-10 22:14:28 -07:00
|
|
|
{
|
|
|
|
elm_object_focus_set(obj, EINA_FALSE);
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
|
|
}
|
2014-07-14 20:09:49 -07:00
|
|
|
else if (it->end && elm_object_widget_check(it->end) &&
|
|
|
|
elm_object_focus_get(it->end))
|
2014-06-10 22:14:28 -07:00
|
|
|
{
|
|
|
|
elm_object_focus_set(obj, EINA_FALSE);
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
2009-04-26 18:29:02 -07:00
|
|
|
if (it->selected)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS) goto call;
|
2010-10-15 04:51:15 -07:00
|
|
|
return;
|
2009-04-26 18:29:02 -07:00
|
|
|
}
|
2013-02-20 02:00:49 -08:00
|
|
|
|
2014-03-07 10:27:09 -08:00
|
|
|
_elm_list_item_content_focus_set(it, ELM_FOCUS_PREVIOUS, sd->h_mode);
|
2013-02-20 02:00:49 -08:00
|
|
|
|
2009-06-17 08:35:19 -07:00
|
|
|
it->selected = EINA_TRUE;
|
2014-11-25 04:55:37 -08:00
|
|
|
sd->selected = eina_list_append(sd->selected, eo_it);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
|
|
|
call:
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2014-11-25 04:55:37 -08:00
|
|
|
if (it->func) it->func((void *)WIDGET_ITEM_DATA_GET(eo_it), WIDGET(it), eo_it);
|
|
|
|
evas_object_smart_callback_call(obj, SIG_SELECTED, eo_it);
|
|
|
|
sd->last_selected_item = eo_it;
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_item_unhighlight(Elm_List_Item_Data *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2013-11-04 21:11:40 -08:00
|
|
|
Evas_Object *obj;
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *stacking, *select_raise;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
2013-11-04 21:11:40 -08:00
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
// if ((!it->highlighted) || (it->base->disabled) ||
|
2013-11-16 00:50:11 -08:00
|
|
|
// (sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE)) return;
|
|
|
|
if (!it->highlighted) return;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_UNHIGHLIGHTED, EO_OBJ(it));
|
2011-10-20 18:08:01 -07:00
|
|
|
stacking = edje_object_data_get(VIEW(it), "stacking");
|
2012-07-04 14:43:05 -07:00
|
|
|
select_raise = edje_object_data_get(VIEW(it), "selectraise");
|
|
|
|
if ((select_raise) && (!strcmp(select_raise, "on")))
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if ((stacking) && (!strcmp(stacking, "below")))
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_lower(VIEW(it));
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2011-08-25 10:19:22 -07:00
|
|
|
it->highlighted = EINA_FALSE;
|
2013-11-04 21:11:40 -08:00
|
|
|
|
|
|
|
_elm_list_unwalk(obj, sd);
|
|
|
|
evas_object_unref(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_item_unselect(Elm_List_Item_Data *it)
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
// if (it->base->disabled || (sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE))
|
2013-11-16 00:50:11 -08:00
|
|
|
// return;
|
2013-11-04 21:11:40 -08:00
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(sd);
|
|
|
|
|
2014-02-18 06:40:48 -08:00
|
|
|
if (sd->focus_on_selection_enabled)
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
|
|
|
if (it->icon) elm_object_focus_set(it->icon, EINA_FALSE);
|
|
|
|
if (it->end) elm_object_focus_set(it->end, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2009-05-12 03:16:49 -07:00
|
|
|
if (it->selected)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
it->selected = EINA_FALSE;
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, EO_OBJ(it));
|
|
|
|
if (!(it->base->disabled ||
|
2013-11-16 00:50:11 -08:00
|
|
|
(sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE)))
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, EO_OBJ(it));
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
|
|
|
|
2010-10-15 04:25:02 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_swipe_cancel(void *data)
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = data;
|
2010-10-15 04:25:02 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it, ECORE_CALLBACK_CANCEL);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2010-10-15 04:25:02 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
sd->movements = 0;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
|
|
|
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_edge_left_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2011-10-20 09:42:42 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_edge_right_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2011-10-20 09:42:42 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_edge_top_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2011-10-20 09:42:42 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_edge_bottom_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2011-10-20 09:42:42 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool
|
2012-07-04 14:43:05 -07:00
|
|
|
_long_press_cb(void *data)
|
2009-09-01 03:42:52 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = data;
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it, ECORE_CALLBACK_CANCEL);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2010-10-19 13:19:57 -07:00
|
|
|
|
2009-09-01 03:42:52 -07:00
|
|
|
it->long_timer = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
if (it->base->disabled) goto end;
|
2010-10-19 13:19:57 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->longpressed = EINA_TRUE;
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, EO_OBJ(it));
|
2010-10-19 13:19:57 -07:00
|
|
|
|
2011-04-01 04:26:58 -07:00
|
|
|
end:
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2009-09-01 03:42:52 -07:00
|
|
|
}
|
|
|
|
|
2010-10-15 04:25:02 -07:00
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_swipe_do(Elm_List_Item_Data *it)
|
2010-10-15 04:25:02 -07:00
|
|
|
{
|
|
|
|
int i, sum = 0;
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
for (i = 0; i < sd->movements; i++)
|
2010-10-15 04:25:02 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
sum += sd->history[i].x;
|
|
|
|
if (abs(sd->history[0].y - sd->history[i].y) > 10) return;
|
2010-10-15 04:25:02 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sum /= sd->movements;
|
|
|
|
if (abs(sum - sd->history[0].x) <= 10) return;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, EO_OBJ(it));
|
2010-10-15 04:25:02 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:22:47 -07:00
|
|
|
static void
|
|
|
|
_mouse_in_cb(void *data,
|
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *o EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = data;
|
|
|
|
if (!elm_object_item_disabled_get(EO_OBJ(it)) &&
|
2014-04-01 04:22:47 -07:00
|
|
|
(_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN))
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2014-04-01 04:22:47 -07:00
|
|
|
}
|
|
|
|
|
2009-05-12 03:16:49 -07:00
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_mouse_move_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *o EINA_UNUSED,
|
2012-07-04 14:43:05 -07:00
|
|
|
void *event_info)
|
2009-05-12 03:16:49 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = data;
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(sd);
|
|
|
|
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
|
|
|
if (!sd->on_hold)
|
|
|
|
{
|
|
|
|
sd->on_hold = EINA_TRUE;
|
2013-05-29 05:00:12 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!sd->was_selected)
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
|
|
|
_item_unhighlight(it);
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
}
|
2012-07-31 15:06:36 -07:00
|
|
|
if (sd->movements == ELM_LIST_SWIPE_MOVES) sd->swipe = EINA_TRUE;
|
2012-07-04 14:43:05 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->history[sd->movements].x = ev->cur.canvas.x;
|
|
|
|
sd->history[sd->movements].y = ev->cur.canvas.y;
|
|
|
|
if (abs((sd->history[sd->movements].x - sd->history[0].x)) > 40)
|
|
|
|
sd->swipe = EINA_TRUE;
|
|
|
|
else
|
|
|
|
sd->movements++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_unref(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mouse_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *o EINA_UNUSED,
|
2012-07-04 14:43:05 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
2009-05-12 03:16:49 -07:00
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = data;
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2009-09-01 03:42:52 -07:00
|
|
|
if (ev->button != 1) return;
|
2012-07-04 14:43:05 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->on_hold) return;
|
2014-03-22 02:01:22 -07:00
|
|
|
sd->mouse_down = EINA_TRUE;
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->was_selected = it->selected;
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(sd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-08-25 10:19:22 -07:00
|
|
|
_item_highlight(it);
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(it->long_timer);
|
2012-07-04 14:43:05 -07:00
|
|
|
it->long_timer = ecore_timer_add
|
|
|
|
(_elm_config->longpress_timeout, _long_press_cb, it);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(it->swipe_timer);
|
2014-01-23 06:11:12 -08:00
|
|
|
it->swipe_timer = ecore_timer_add(ELM_LIST_SWIPE_TIME, _swipe_cancel, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2009-11-28 16:01:13 -08:00
|
|
|
/* Always call the callbacks last - the user may delete our context! */
|
|
|
|
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
2011-07-25 18:49:24 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, EO_OBJ(it));
|
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, EO_OBJ(it));
|
2011-07-25 18:49:24 -07:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
sd->movements = 0;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_mouse_up_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *o EINA_UNUSED,
|
2012-07-04 14:43:05 -07:00
|
|
|
void *event_info)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = data;
|
2009-01-07 05:49:08 -08:00
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
2009-09-01 03:42:52 -07:00
|
|
|
if (ev->button != 1) return;
|
2012-07-04 14:43:05 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2014-03-22 02:01:22 -07:00
|
|
|
|
|
|
|
sd->mouse_down = EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
2013-05-29 05:00:12 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(it->swipe_timer, ecore_timer_del);
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->on_hold)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->swipe) _swipe_do(data);
|
|
|
|
sd->on_hold = EINA_FALSE;
|
2010-10-15 04:51:15 -07:00
|
|
|
return;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->longpressed)
|
2009-09-01 03:42:52 -07:00
|
|
|
{
|
2013-11-04 21:11:40 -08:00
|
|
|
if (!sd->was_selected)
|
|
|
|
{
|
|
|
|
_item_unhighlight(it);
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->was_selected = 0;
|
2009-09-01 03:42:52 -07:00
|
|
|
return;
|
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (it->base->disabled)
|
2010-10-19 13:19:57 -07:00
|
|
|
return;
|
2010-11-08 22:07:07 -08:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(sd);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (sd->focused_item != EO_OBJ(it))
|
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2014-03-18 13:37:31 -07:00
|
|
|
|
2013-11-05 20:36:34 -08:00
|
|
|
if (sd->multi &&
|
|
|
|
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
|
|
|
(evas_key_modifier_is_set(ev->modifiers, "Control"))))
|
2009-01-08 23:35:52 -08:00
|
|
|
{
|
2013-11-05 20:36:34 -08:00
|
|
|
if (!it->selected)
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2013-11-05 20:36:34 -08:00
|
|
|
_item_highlight(it);
|
|
|
|
_item_select(it);
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2013-11-04 21:11:40 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_item_unhighlight(it);
|
2013-11-05 20:36:34 -08:00
|
|
|
_item_unselect(it);
|
2013-11-04 21:11:40 -08:00
|
|
|
}
|
2009-01-08 23:35:52 -08:00
|
|
|
}
|
|
|
|
else
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
while (sd->selected)
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it2 = sd->selected->data;
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it2, it2);
|
2013-11-16 00:50:11 -08:00
|
|
|
sd->selected = eina_list_remove_list
|
|
|
|
(sd->selected, sd->selected);
|
|
|
|
_item_unhighlight(it2);
|
|
|
|
_item_unselect(it2);
|
2013-11-04 21:11:40 -08:00
|
|
|
}
|
2011-08-25 10:19:22 -07:00
|
|
|
_item_highlight(it);
|
2010-10-15 04:51:15 -07:00
|
|
|
_item_select(it);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it2;
|
2010-10-15 04:51:15 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_it2)
|
|
|
|
if (eo_it2 != EO_OBJ(it))
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it2, it2);
|
2013-11-04 21:11:40 -08:00
|
|
|
_item_unhighlight(it2);
|
|
|
|
_item_unselect(it2);
|
|
|
|
}
|
2011-08-25 10:19:22 -07:00
|
|
|
_item_highlight(it);
|
2010-10-15 04:51:15 -07:00
|
|
|
_item_select(it);
|
|
|
|
}
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 01:35:07 -07:00
|
|
|
static void
|
|
|
|
_elm_list_looping_left_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *list = data;
|
2014-07-21 23:11:17 -07:00
|
|
|
|
|
|
|
ELM_LIST_DATA_GET(list, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *it = elm_list_last_item_get(list);
|
2014-04-05 08:10:55 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(it, EINA_TRUE);
|
2014-04-03 03:11:57 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-03-24 01:35:07 -07:00
|
|
|
elm_layout_signal_emit(list, "elm,action,looping,left,end", "elm");
|
2014-07-21 23:11:17 -07:00
|
|
|
sd->item_looping_on = EINA_FALSE;
|
2014-03-24 01:35:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_list_looping_right_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *list = data;
|
2014-07-21 23:11:17 -07:00
|
|
|
|
|
|
|
ELM_LIST_DATA_GET(list, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *it = elm_list_first_item_get(list);
|
2014-04-05 08:10:55 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(it, EINA_TRUE);
|
2014-04-03 03:11:57 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-03-24 01:35:07 -07:00
|
|
|
elm_layout_signal_emit(list, "elm,action,looping,right,end", "elm");
|
2014-07-21 23:11:17 -07:00
|
|
|
sd->item_looping_on = EINA_FALSE;
|
2014-03-24 01:35:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_list_looping_up_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *list = data;
|
2014-07-21 23:11:17 -07:00
|
|
|
|
|
|
|
ELM_LIST_DATA_GET(list, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *it = elm_list_last_item_get(list);
|
2014-04-05 08:10:55 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(it, EINA_TRUE);
|
2014-04-03 03:11:57 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-03-24 01:35:07 -07:00
|
|
|
elm_layout_signal_emit(list, "elm,action,looping,up,end", "elm");
|
2014-07-21 23:11:17 -07:00
|
|
|
sd->item_looping_on = EINA_FALSE;
|
2014-03-24 01:35:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_list_looping_down_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *list = data;
|
2014-07-21 23:11:17 -07:00
|
|
|
|
|
|
|
ELM_LIST_DATA_GET(list, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *it = elm_list_first_item_get(list);
|
2014-04-05 08:10:55 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_list_item_selected_set(it, EINA_TRUE);
|
2014-04-03 03:11:57 -07:00
|
|
|
else
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-03-24 01:35:07 -07:00
|
|
|
elm_layout_signal_emit(list, "elm,action,looping,down,end", "elm");
|
2014-07-21 23:11:17 -07:00
|
|
|
sd->item_looping_on = EINA_FALSE;
|
2014-03-24 01:35:07 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_elm_widget_item_disable(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item)
|
2012-01-02 20:17:32 -08:00
|
|
|
{
|
2013-11-16 00:50:11 -08:00
|
|
|
_item_unhighlight(item);
|
|
|
|
_item_unselect(item);
|
2014-09-27 22:15:48 -07:00
|
|
|
if (item->base->disabled)
|
2012-01-12 00:25:12 -08:00
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,disabled", "elm");
|
2012-01-02 20:17:32 -08:00
|
|
|
else
|
2012-01-12 00:25:12 -08:00
|
|
|
edje_object_signal_emit(VIEW(item), "elm,state,enabled", "elm");
|
2012-01-02 20:17:32 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_elm_widget_item_part_content_set(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item,
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *part,
|
|
|
|
Evas_Object *content)
|
2012-01-03 05:13:39 -08:00
|
|
|
{
|
|
|
|
Evas_Object **icon_p = NULL;
|
|
|
|
Eina_Bool dummy = EINA_FALSE;
|
2012-01-11 23:51:15 -08:00
|
|
|
|
2012-01-03 05:13:39 -08:00
|
|
|
if ((!part) || (!strcmp(part, "start")))
|
|
|
|
{
|
2012-01-11 23:51:15 -08:00
|
|
|
icon_p = &(item->icon);
|
|
|
|
dummy = item->dummy_icon;
|
2012-03-21 03:41:42 -07:00
|
|
|
if (!content) item->dummy_icon = EINA_TRUE;
|
|
|
|
else item->dummy_icon = EINA_FALSE;
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
|
|
|
else if (!strcmp(part, "end"))
|
|
|
|
{
|
2012-01-11 23:51:15 -08:00
|
|
|
icon_p = &(item->end);
|
|
|
|
dummy = item->dummy_end;
|
2012-03-21 03:41:42 -07:00
|
|
|
if (!content) item->dummy_end = EINA_TRUE;
|
|
|
|
else item->dummy_end = EINA_FALSE;
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return;
|
2012-01-11 23:51:15 -08:00
|
|
|
|
2012-01-03 05:13:39 -08:00
|
|
|
if (content == *icon_p) return;
|
|
|
|
if ((dummy) && (!content)) return;
|
|
|
|
if (dummy) evas_object_del(*icon_p);
|
|
|
|
if (!content)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
content =
|
|
|
|
evas_object_rectangle_add(evas_object_evas_get(WIDGET(item)));
|
2012-01-03 05:13:39 -08:00
|
|
|
evas_object_color_set(content, 0, 0, 0, 0);
|
|
|
|
}
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(*icon_p);
|
2012-01-03 05:13:39 -08:00
|
|
|
*icon_p = content;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2012-01-11 23:51:15 -08:00
|
|
|
if (VIEW(item))
|
2013-07-12 23:45:44 -07:00
|
|
|
{
|
2013-08-11 01:11:03 -07:00
|
|
|
if ((!part) || !strcmp(part, "start"))
|
2013-07-12 23:45:44 -07:00
|
|
|
edje_object_part_swallow(VIEW(item), "elm.swallow.icon", content);
|
|
|
|
else
|
|
|
|
edje_object_part_swallow(VIEW(item), "elm.swallow.end", content);
|
|
|
|
}
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_list_item_elm_widget_item_part_content_get(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item,
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *part)
|
2012-01-03 05:13:39 -08:00
|
|
|
{
|
|
|
|
if ((!part) || (!strcmp(part, "start")))
|
|
|
|
{
|
2012-01-11 23:51:15 -08:00
|
|
|
if (item->dummy_icon) return NULL;
|
|
|
|
return item->icon;
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
|
|
|
else if (!strcmp(part, "end"))
|
|
|
|
{
|
2012-01-11 23:51:15 -08:00
|
|
|
if (item->dummy_end) return NULL;
|
|
|
|
return item->end;
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2012-01-03 05:13:39 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_list_item_elm_widget_item_part_content_unset(Eo *eo_it EINA_UNUSED, Elm_List_Item_Data *item,
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *part)
|
2012-01-03 05:13:39 -08:00
|
|
|
{
|
|
|
|
if ((!part) || (!strcmp(part, "start")))
|
|
|
|
{
|
2012-01-12 00:25:12 -08:00
|
|
|
Evas_Object *obj = item->icon;
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_do(eo_it, elm_wdg_item_part_content_set(part, NULL));
|
2012-01-03 05:13:39 -08:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
else if (!strcmp(part, "end"))
|
|
|
|
{
|
2012-01-12 00:25:12 -08:00
|
|
|
Evas_Object *obj = item->end;
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_do(eo_it, elm_wdg_item_part_content_set(part, NULL));
|
2012-01-03 05:13:39 -08:00
|
|
|
return obj;
|
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2012-01-03 05:13:39 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_elm_widget_item_part_text_set(Eo *eo_list_it, Elm_List_Item_Data *list_it,
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *part,
|
|
|
|
const char *text)
|
2012-01-03 05:13:39 -08:00
|
|
|
{
|
2013-09-16 03:18:24 -07:00
|
|
|
if (part && strcmp(part, "default"))
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
eo_do(eo_list_it, elm_wdg_item_part_text_custom_set(part, text));
|
2013-09-16 03:18:24 -07:00
|
|
|
edje_object_part_text_escaped_set(VIEW(list_it), part, text);
|
|
|
|
return;
|
|
|
|
}
|
2012-01-11 23:51:15 -08:00
|
|
|
if (!eina_stringshare_replace(&list_it->label, text)) return;
|
|
|
|
if (VIEW(list_it))
|
2012-04-20 05:51:10 -07:00
|
|
|
edje_object_part_text_escaped_set(VIEW(list_it), "elm.text", text);
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_list_item_elm_widget_item_part_text_get(Eo *eo_it, Elm_List_Item_Data *it,
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *part)
|
2012-01-03 05:13:39 -08:00
|
|
|
{
|
2013-09-17 15:46:46 -07:00
|
|
|
if (part && strcmp(part, "default"))
|
2014-09-27 22:15:48 -07:00
|
|
|
return eo_do(eo_it, elm_wdg_item_part_text_custom_get(part));
|
|
|
|
return it->label;
|
2012-01-03 05:13:39 -08:00
|
|
|
}
|
|
|
|
|
2014-05-10 07:41:10 -07:00
|
|
|
/* FIXME: this _item_del_pre_hook is never been called at all!
|
|
|
|
To fix this,
|
|
|
|
1. it->walking concept should be adopted.
|
|
|
|
2. elm_widget_item_del() should be called instead of the combination of
|
|
|
|
_elm_list_item_free() + elm_widget_item_free()
|
|
|
|
*/
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_item_elm_widget_item_del_pre(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item)
|
2012-01-29 22:06:03 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Evas_Object *obj = WIDGET(item);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2012-01-29 22:06:03 -08:00
|
|
|
|
2013-11-04 21:11:40 -08:00
|
|
|
if (item->selected)
|
|
|
|
{
|
|
|
|
_item_unhighlight(item);
|
|
|
|
_item_unselect(item);
|
|
|
|
}
|
2012-01-29 22:06:03 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->walking > 0)
|
2012-01-29 22:06:03 -08:00
|
|
|
{
|
|
|
|
if (item->deleted) return EINA_FALSE;
|
|
|
|
item->deleted = EINA_TRUE;
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->to_delete = eina_list_append(sd->to_delete, item);
|
2012-01-29 22:06:03 -08:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->items = eina_list_remove_list(sd->items, item->node);
|
2012-01-29 22:06:03 -08:00
|
|
|
|
|
|
|
evas_object_ref(obj);
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
2012-01-29 22:06:03 -08:00
|
|
|
|
|
|
|
_elm_list_item_free(item);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-01-29 22:06:03 -08:00
|
|
|
evas_object_unref(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void _elm_list_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED, Elm_List_Item_Data *it,
|
2013-05-26 21:25:18 -07:00
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), emission, source);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_elm_widget_item_focus_set(Eo *eo_it, Elm_List_Item_Data *it, Eina_Bool focused)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (focused)
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->last_focused_item = eo_it;
|
2014-02-18 06:40:48 -08:00
|
|
|
if (!elm_object_focus_get(obj))
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
2014-09-27 22:15:48 -07:00
|
|
|
if (eo_it != sd->focused_item)
|
2014-03-01 07:26:08 -08:00
|
|
|
{
|
2014-03-03 07:30:44 -08:00
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_unfocused(sd->focused_item);
|
|
|
|
_elm_list_item_focused(eo_it);
|
2014-03-01 07:26:08 -08:00
|
|
|
}
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
|
|
|
else
|
2014-03-03 07:30:44 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
if (eo_it)
|
|
|
|
_elm_list_item_unfocused(eo_it);
|
2014-03-03 07:30:44 -08:00
|
|
|
}
|
2014-02-18 06:40:48 -08:00
|
|
|
_elm_widget_focus_highlight_start(obj);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_item_elm_widget_item_focus_get(Eo *eo_it, Elm_List_Item_Data *it)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_LIST_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
2014-02-18 06:40:48 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-06-29 23:21:14 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-06-29 23:21:14 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = (Elm_List_Item_Data *)data;
|
2012-07-04 14:43:05 -07:00
|
|
|
const char *txt = NULL;
|
2012-06-29 23:21:14 -07:00
|
|
|
if (!it) return NULL;
|
|
|
|
|
|
|
|
if (!txt) txt = it->label;
|
|
|
|
if (txt) return strdup(txt);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2012-06-29 23:21:14 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-06-29 23:21:14 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it = (Elm_List_Item_Data *)data;
|
2012-06-29 23:21:14 -07:00
|
|
|
if (!it) return NULL;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (it->base->disabled)
|
2012-07-04 14:43:05 -07:00
|
|
|
return strdup(E_("State: Disabled"));
|
2012-06-29 23:21:14 -07:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_on_highlight_cb(void *data)
|
|
|
|
{
|
2014-08-19 00:52:24 -07:00
|
|
|
Elm_Object_Item *it = data;
|
2012-06-29 23:21:14 -07:00
|
|
|
if (!it) return;
|
|
|
|
|
|
|
|
elm_list_item_bring_in(it);
|
|
|
|
}
|
|
|
|
|
2012-11-19 05:40:24 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_activate_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *part_obj EINA_UNUSED,
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it)
|
2012-11-19 05:40:24 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-11-19 05:40:24 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
obj = WIDGET(it);
|
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(sd);
|
|
|
|
|
|
|
|
if (sd->multi)
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
_item_highlight(it);
|
|
|
|
_item_select(it);
|
|
|
|
}
|
2013-11-04 21:11:40 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_item_unhighlight(it);
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
2012-11-19 05:40:24 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_sel, sel);
|
|
|
|
_item_unhighlight(sel);
|
|
|
|
_item_unselect(sel);
|
2013-11-04 21:11:40 -08:00
|
|
|
}
|
2012-11-19 05:40:24 -08:00
|
|
|
_item_highlight(it);
|
|
|
|
_item_select(it);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it2;
|
2012-11-19 05:40:24 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_it2)
|
|
|
|
if (eo_it2 != EO_OBJ(it))
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it2, it2);
|
2013-11-04 21:11:40 -08:00
|
|
|
_item_unhighlight(it2);
|
|
|
|
_item_unselect(it2);
|
|
|
|
}
|
2012-11-19 05:40:24 -08:00
|
|
|
_item_highlight(it);
|
|
|
|
_item_select(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-11-19 05:40:24 -08:00
|
|
|
evas_object_unref(obj);
|
|
|
|
}
|
|
|
|
|
2012-11-19 05:08:54 -08:00
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_access_widget_item_register(Elm_List_Item_Data *it, Eina_Bool is_access)
|
2012-11-19 05:08:54 -08:00
|
|
|
{
|
|
|
|
Elm_Access_Info *ai;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
if (!is_access) _elm_access_widget_item_unregister(it->base);
|
2012-11-19 05:08:54 -08:00
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_access_widget_item_register(it->base);
|
2012-11-19 05:08:54 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
ai = _elm_access_info_get(it->base->access_obj);
|
2012-11-19 05:08:54 -08:00
|
|
|
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, EO_OBJ(it));
|
|
|
|
_elm_access_activate_callback_set(ai, _access_activate_cb, EO_OBJ(it));
|
2012-11-19 05:08:54 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_eo_base_constructor(Eo *eo_it, Elm_List_Item_Data *it)
|
|
|
|
{
|
|
|
|
eo_do_super(eo_it, ELM_LIST_ITEM_CLASS, eo_constructor());
|
|
|
|
it->base = eo_data_scope_get(eo_it, ELM_WIDGET_ITEM_CLASS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_List_Item_Data *
|
2012-07-04 14:43:05 -07:00
|
|
|
_item_new(Evas_Object *obj,
|
|
|
|
const char *label,
|
|
|
|
Evas_Object *icon,
|
|
|
|
Evas_Object *end,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Eo *eo_it = eo_add(ELM_LIST_ITEM_CLASS, obj);
|
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
it->label = eina_stringshare_add(label);
|
|
|
|
it->icon = icon;
|
|
|
|
it->end = end;
|
|
|
|
it->func = func;
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(EO_OBJ(it), data);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
VIEW(it) = edje_object_add(evas_object_evas_get(obj));
|
2012-06-29 23:21:14 -07:00
|
|
|
|
2012-11-19 05:08:54 -08:00
|
|
|
/* access */
|
2012-11-08 00:02:12 -08:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
2012-11-19 05:08:54 -08:00
|
|
|
_access_widget_item_register(it, EINA_TRUE);
|
2012-06-29 23:21:14 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj));
|
2012-07-17 08:02:22 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, it);
|
2014-04-01 04:22:47 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_IN, _mouse_in_cb, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2012-07-04 14:43:05 -07:00
|
|
|
edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj));
|
|
|
|
|
2009-01-25 15:18:25 -08:00
|
|
|
if (it->icon)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
elm_widget_sub_object_add(obj, it->icon);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb,
|
|
|
|
obj);
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
|
|
|
if (it->end)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
elm_widget_sub_object_add(obj, it->end);
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb,
|
|
|
|
obj);
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
2010-10-19 13:19:12 -07:00
|
|
|
static void
|
2012-07-04 14:43:05 -07:00
|
|
|
_resize_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2010-10-19 13:19:12 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
|
|
|
}
|
2010-10-19 13:19:12 -07:00
|
|
|
|
2013-04-09 06:22:37 -07:00
|
|
|
static Eina_Bool _elm_list_smart_focus_next_enable = EINA_FALSE;
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_List_Data *sd EINA_UNUSED)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return _elm_list_smart_focus_next_enable;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_List_Data *sd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_focus_next(Eo *obj, Elm_List_Data *sd, Elm_Focus_Direction dir, Evas_Object **next)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Eina_List *items = NULL;
|
|
|
|
Eina_List *elist = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_ON) return EINA_FALSE;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, elist, eo_it)
|
2010-10-19 13:19:12 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
items = eina_list_append(items, it->base->access_obj);
|
2012-07-04 14:43:05 -07:00
|
|
|
if (it->icon) items = eina_list_append(items, it->icon);
|
|
|
|
if (it->end) items = eina_list_append(items, it->end);
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
return elm_widget_focus_list_next_get
|
2012-07-04 14:43:05 -07:00
|
|
|
(obj, items, eina_list_data_get, dir, next);
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_list_evas_object_smart_add(Eo *obj, Elm_List_Data *priv)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2012-07-17 08:02:22 -07:00
|
|
|
Evas_Coord minw, minh;
|
|
|
|
|
2013-10-05 01:14:47 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
priv->mode = ELM_LIST_SCROLL;
|
2012-07-17 08:02:22 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "list", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-07-17 08:02:22 -07:00
|
|
|
|
|
|
|
priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
2012-07-19 02:25:04 -07:00
|
|
|
evas_object_data_set(priv->hit_rect, "_elm_leaveme", obj);
|
2012-07-17 08:02:22 -07:00
|
|
|
evas_object_smart_member_add(priv->hit_rect, obj);
|
|
|
|
elm_widget_sub_object_add(obj, priv->hit_rect);
|
|
|
|
|
|
|
|
/* common scroller hit rectangle setup */
|
|
|
|
evas_object_color_set(priv->hit_rect, 0, 0, 0, 0);
|
|
|
|
evas_object_show(priv->hit_rect);
|
|
|
|
evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2014-03-17 04:44:40 -07:00
|
|
|
elm_interface_scrollable_edge_left_cb_set(_edge_left_cb),
|
|
|
|
elm_interface_scrollable_edge_right_cb_set(_edge_right_cb),
|
|
|
|
elm_interface_scrollable_edge_top_cb_set(_edge_top_cb),
|
|
|
|
elm_interface_scrollable_edge_bottom_cb_set(_edge_bottom_cb),
|
|
|
|
elm_interface_scrollable_content_min_limit_cb_set(_elm_list_content_min_limit_cb),
|
|
|
|
elm_interface_scrollable_objects_set(wd->resize_obj, priv->hit_rect));
|
2012-07-17 08:02:22 -07:00
|
|
|
|
|
|
|
/* the scrollable interface may set this */
|
|
|
|
evas_object_event_callback_add
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2012-07-17 08:02:22 -07:00
|
|
|
_size_hints_changed_cb, obj);
|
|
|
|
|
|
|
|
edje_object_size_min_calc
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, &minw, &minh);
|
2012-07-17 08:02:22 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
|
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_bounce_allow_set(EINA_FALSE, _elm_config->thumbscroll_bounce_enable));
|
2012-07-17 08:02:22 -07:00
|
|
|
|
|
|
|
priv->box = elm_box_add(obj);
|
|
|
|
evas_object_size_hint_weight_set(priv->box, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(priv->box, EVAS_HINT_FILL, 0.0);
|
|
|
|
|
|
|
|
/* FIXME: change this ugly code path later */
|
|
|
|
elm_widget_on_show_region_hook_set(priv->box, _show_region_hook, obj);
|
|
|
|
elm_widget_sub_object_add(obj, priv->box);
|
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_content_set(priv->box));
|
2012-07-17 08:02:22 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_size_hints_changed_cb, obj);
|
2014-03-24 01:35:07 -07:00
|
|
|
|
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,looping,left,done", "elm", _elm_list_looping_left_cb, obj);
|
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,looping,right,done", "elm", _elm_list_looping_right_cb, obj);
|
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,looping,up,done", "elm", _elm_list_looping_up_cb, obj);
|
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,looping,down,done", "elm", _elm_list_looping_down_cb, obj);
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_list_evas_object_smart_del(Eo *obj, Elm_List_Data *sd)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2009-02-25 11:50:45 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->walking)
|
|
|
|
ERR("ERROR: list deleted while walking.\n");
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-08-29 16:38:58 -07:00
|
|
|
sd->delete_me = EINA_TRUE;
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_it)
|
2009-01-08 06:29:13 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2010-10-15 04:51:15 -07:00
|
|
|
if (it->icon)
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_event_callback_del
|
|
|
|
(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_size_hints_changed_cb);
|
2010-10-15 04:51:15 -07:00
|
|
|
if (it->end)
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_event_callback_del
|
|
|
|
(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_size_hints_changed_cb);
|
2009-01-08 06:29:13 -08:00
|
|
|
}
|
2012-06-14 00:55:55 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_event_callback_del
|
|
|
|
(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_size_hints_changed_cb);
|
|
|
|
evas_object_event_callback_del
|
|
|
|
(sd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
2010-10-19 13:19:57 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FREE(sd->items, eo_it)
|
2012-07-04 14:43:05 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
/* issuing free because of "locking" item del pre hook */
|
|
|
|
_elm_list_item_free(it);
|
2014-09-17 06:44:05 -07:00
|
|
|
WIDGET(it) = NULL;
|
2014-11-24 00:40:06 -08:00
|
|
|
eo_del(eo_it);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
if (sd->to_delete)
|
|
|
|
ERR("ERROR: leaking nodes!\n");
|
2010-10-19 13:19:12 -07:00
|
|
|
|
2013-04-10 04:28:22 -07:00
|
|
|
sd->selected = eina_list_free(sd->selected);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_list_evas_object_smart_move(Eo *obj, Elm_List_Data *sd, Evas_Coord x, Evas_Coord y)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_move(x, y));
|
2009-09-07 23:20:32 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_move(sd->hit_rect, x, y);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_list_evas_object_smart_resize(Eo *obj, Elm_List_Data *sd, Evas_Coord w, Evas_Coord h)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h));
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
evas_object_resize(sd->hit_rect, w, h);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_list_evas_object_smart_member_add(Eo *obj, Elm_List_Data *sd, Evas_Object *member)
|
2010-10-05 12:10:00 -07:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_member_add(member));
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
2010-10-05 12:10:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_elm_widget_access(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool acs)
|
2012-11-19 05:08:54 -08:00
|
|
|
{
|
|
|
|
Eina_List *elist = NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2014-03-31 05:59:55 -07:00
|
|
|
_elm_list_smart_focus_next_enable = acs;
|
2012-11-19 05:08:54 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, elist, eo_it)
|
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
_access_widget_item_register(it, _elm_list_smart_focus_next_enable);
|
|
|
|
}
|
2012-11-19 05:08:54 -08:00
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_list_add(Evas_Object *parent)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
|
|
|
return obj;
|
|
|
|
}
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_eo_base_constructor(Eo *obj, Elm_List_Data *sd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
2014-06-10 19:07:15 -07:00
|
|
|
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks),
|
|
|
|
elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_LIST));
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_go(Eo *obj, Elm_List_Data *sd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
_items_fix(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_multi_select_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool multi)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->multi = multi;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_multi_select_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2010-01-05 11:42:04 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->multi;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_multi_select_mode_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Elm_Object_Multi_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-04 16:22:25 -08:00
|
|
|
if (mode >= ELM_OBJECT_MULTI_SELECT_MODE_MAX)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (sd->multi_select_mode != mode)
|
|
|
|
sd->multi_select_mode = mode;
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Multi_Select_Mode
|
|
|
|
_elm_list_multi_select_mode_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2013-11-04 16:22:25 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->multi_select_mode;
|
2013-11-04 16:22:25 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_mode_set(Eo *obj, Elm_List_Data *sd, Elm_List_Mode mode)
|
2013-11-04 16:22:25 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (sd->mode == mode)
|
2010-10-19 13:19:12 -07:00
|
|
|
return;
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->mode = mode;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_mode_set_internal(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_List_Mode
|
|
|
|
_elm_list_mode_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_horizontal_set(Eo *obj, Elm_List_Data *sd, Eina_Bool horizontal)
|
2010-10-19 13:19:12 -07:00
|
|
|
{
|
2010-10-21 12:57:43 -07:00
|
|
|
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
|
2010-10-19 13:19:12 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
horizontal = !!horizontal;
|
|
|
|
|
|
|
|
if (sd->h_mode == horizontal)
|
2010-10-19 13:19:12 -07:00
|
|
|
return;
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->h_mode = horizontal;
|
|
|
|
elm_box_horizontal_set(sd->box, horizontal);
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
if (horizontal)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_size_hint_weight_set(sd->box, 0.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(sd->box, 0.0, EVAS_HINT_FILL);
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_bounce_allow_set(bounce, EINA_FALSE));
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
evas_object_size_hint_weight_set(sd->box, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(sd->box, EVAS_HINT_FILL, 0.0);
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_bounce_allow_set(EINA_FALSE, bounce));
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_mode_set_internal(obj);
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_horizontal_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->h_mode;
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_select_mode_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Elm_Object_Select_Mode mode)
|
2009-04-26 18:29:02 -07:00
|
|
|
{
|
2012-03-07 07:22:12 -08:00
|
|
|
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
|
|
|
return;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
if (sd->select_mode != mode)
|
|
|
|
sd->select_mode = mode;
|
2009-04-26 18:29:02 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
|
|
|
_elm_list_select_mode_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-03-07 07:22:12 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->select_mode;
|
2012-03-07 07:22:12 -08:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EAPI void
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_list_bounce_set(Evas_Object *obj,
|
|
|
|
Eina_Bool h_bounce,
|
|
|
|
Eina_Bool v_bounce)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_CHECK(obj);
|
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_bounce_allow_set(h_bounce, v_bounce));
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_list_bounce_get(const Evas_Object *obj,
|
|
|
|
Eina_Bool *h_bounce,
|
|
|
|
Eina_Bool *v_bounce)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_CHECK(obj);
|
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do((Eo *) obj, elm_interface_scrollable_bounce_allow_get(h_bounce, v_bounce));
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_list_scroller_policy_set(Evas_Object *obj,
|
|
|
|
Elm_Scroller_Policy policy_h,
|
|
|
|
Elm_Scroller_Policy policy_v)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_CHECK(obj);
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(obj, elm_interface_scrollable_policy_set(policy_h, policy_v));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_elm_interface_scrollable_policy_set(Eo *obj, Elm_List_Data *sd EINA_UNUSED, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-01-02 21:28:34 -08:00
|
|
|
if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
|
|
|
|
(policy_v >= ELM_SCROLLER_POLICY_LAST))
|
|
|
|
return;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, elm_interface_scrollable_policy_set(policy_h, policy_v));
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_list_scroller_policy_get(const Evas_Object *obj,
|
|
|
|
Elm_Scroller_Policy *policy_h,
|
|
|
|
Elm_Scroller_Policy *policy_v)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_CHECK(obj);
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do((Eo *) obj, elm_interface_scrollable_policy_get(policy_h, policy_v));
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_clear(Eo *obj, Elm_List_Data *sd)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2012-01-02 21:28:34 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!sd->items) return;
|
2012-01-02 21:28:34 -08:00
|
|
|
|
2013-04-10 04:28:22 -07:00
|
|
|
sd->selected = eina_list_free(sd->selected);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
if (sd->walking > 0)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
|
|
|
Eina_List *n;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, n, eo_it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-01-02 21:28:34 -08:00
|
|
|
if (it->deleted) continue;
|
|
|
|
it->deleted = EINA_TRUE;
|
2012-07-04 14:43:05 -07:00
|
|
|
sd->to_delete = eina_list_append(sd->to_delete, it);
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FREE(sd->items, eo_it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-04 14:43:05 -07:00
|
|
|
/* issuing free because of "locking" item del pre hook */
|
2012-01-02 21:28:34 -08:00
|
|
|
_elm_list_item_free(it);
|
2014-11-24 00:40:06 -08:00
|
|
|
eo_del(eo_it);
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
_items_fix(obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-01-02 21:28:34 -08:00
|
|
|
|
|
|
|
evas_object_unref(obj);
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_list_items_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->items;
|
2009-01-08 23:35:52 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_selected_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-08-19 00:52:24 -07:00
|
|
|
if (sd->selected) return sd->selected->data;
|
2014-03-31 05:59:55 -07:00
|
|
|
else return NULL;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_list_selected_items_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->selected;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_item_append(Eo *obj, Elm_List_Data *sd, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->items = eina_list_append(sd->items, EO_OBJ(it));
|
2012-07-04 14:43:05 -07:00
|
|
|
it->node = eina_list_last(sd->items);
|
|
|
|
elm_box_pack_end(sd->box, VIEW(it));
|
2012-01-02 21:28:34 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_item_prepend(Eo *obj, Elm_List_Data *sd, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->items = eina_list_prepend(sd->items, EO_OBJ(it));
|
2012-07-04 14:43:05 -07:00
|
|
|
it->node = sd->items;
|
|
|
|
elm_box_pack_start(sd->box, VIEW(it));
|
2012-01-02 21:28:34 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_insert_before(Eo *obj, Elm_List_Data *sd, Elm_Object_Item *eo_before, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it;
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_before, before_it);
|
2012-01-11 19:03:56 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(before_it, NULL);
|
2012-01-11 19:03:56 -08:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!before_it->node) return NULL;
|
2012-01-11 19:03:56 -08:00
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->items = eina_list_prepend_relative_list(sd->items, EO_OBJ(it), before_it->node);
|
2012-01-11 19:03:56 -08:00
|
|
|
it->node = before_it->node->prev;
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_box_pack_before(sd->box, VIEW(it), VIEW(before_it));
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return EO_OBJ(it);
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_insert_after(Eo *obj, Elm_List_Data *sd, Elm_Object_Item *eo_after, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it;
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_after, after_it);
|
2012-01-11 19:03:56 -08:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(after_it, NULL);
|
2012-01-11 19:03:56 -08:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!after_it->node) return NULL;
|
2012-01-11 19:03:56 -08:00
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->items = eina_list_append_relative_list(sd->items, EO_OBJ(it), after_it->node);
|
2012-01-11 19:03:56 -08:00
|
|
|
it->node = after_it->node->next;
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_box_pack_after(sd->box, VIEW(it), VIEW(after_it));
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_item_sorted_insert(Eo *obj, Elm_List_Data *sd, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_List_Item_Data *it;
|
2012-01-02 21:28:34 -08:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
sd->items = eina_list_sorted_insert(sd->items, cmp_func, EO_OBJ(it));
|
|
|
|
l = eina_list_data_find_list(sd->items, EO_OBJ(it));
|
2012-01-02 21:28:34 -08:00
|
|
|
l = eina_list_next(l);
|
|
|
|
if (!l)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
it->node = eina_list_last(sd->items);
|
|
|
|
elm_box_pack_end(sd->box, VIEW(it));
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_before = eina_list_data_get(l);
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_before, before);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
it->node = before->node->prev;
|
2012-07-04 14:43:05 -07:00
|
|
|
elm_box_pack_before(sd->box, VIEW(it), VIEW(before));
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return EO_OBJ(it);
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_separator_set(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *it,
|
|
|
|
Eina_Bool setting)
|
2010-07-01 16:48:10 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
it->is_separator = !!setting;
|
2010-07-01 16:48:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_item_separator_get(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *it)
|
2010-07-01 16:48:10 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return it->is_separator;
|
2010-07-01 16:48:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item,
|
|
|
|
Eina_Bool selected)
|
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(item);
|
|
|
|
obj = WIDGET(item);
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_DATA_GET(obj, sd);
|
2010-11-18 02:01:05 -08:00
|
|
|
|
2009-02-25 07:54:26 -08:00
|
|
|
selected = !!selected;
|
2012-01-11 19:03:56 -08:00
|
|
|
if (item->selected == selected) return;
|
2009-02-25 07:54:26 -08:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2012-07-04 14:43:05 -07:00
|
|
|
_elm_list_walk(sd);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2009-01-08 23:35:52 -08:00
|
|
|
if (selected)
|
2009-01-08 06:29:13 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
if (!sd->multi)
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
while (sd->selected)
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_sel, sel);
|
|
|
|
_item_unhighlight(sel);
|
|
|
|
_item_unselect(sel);
|
2013-11-04 21:11:40 -08:00
|
|
|
}
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2012-01-11 19:03:56 -08:00
|
|
|
_item_highlight(item);
|
2014-09-27 22:15:48 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(item), EINA_TRUE);
|
2014-07-17 00:58:36 -07:00
|
|
|
_item_select(item);
|
2009-01-08 06:29:13 -08:00
|
|
|
}
|
2009-02-25 07:54:26 -08:00
|
|
|
else
|
2013-11-04 21:11:40 -08:00
|
|
|
{
|
|
|
|
_item_unhighlight(item);
|
|
|
|
_item_unselect(item);
|
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_list_unwalk(obj, sd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_item_selected_get(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *it)
|
2010-01-07 08:34:19 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return it->selected;
|
2010-01-07 08:34:19 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_show(Eo *eo_it EINA_UNUSED, Elm_List_Item_Data *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2009-01-08 23:35:52 -08:00
|
|
|
Evas_Coord bx, by, bw, bh;
|
|
|
|
Evas_Coord x, y, w, h;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(sd->box));
|
|
|
|
evas_object_geometry_get(sd->box, &bx, &by, &bw, &bh);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
2009-01-08 23:35:52 -08:00
|
|
|
x -= bx;
|
|
|
|
y -= by;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(WIDGET(it), elm_interface_scrollable_content_region_show(x, y, w, h));
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_item_bring_in(Eo *eo_it EINA_UNUSED, Elm_List_Item_Data *it)
|
2010-10-05 12:10:06 -07:00
|
|
|
{
|
|
|
|
Evas_Coord bx, by, bw, bh;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-04 14:43:05 -07:00
|
|
|
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(sd->box));
|
|
|
|
evas_object_geometry_get(sd->box, &bx, &by, &bw, &bh);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
2010-10-05 12:10:06 -07:00
|
|
|
x -= bx;
|
|
|
|
y -= by;
|
2012-07-04 14:43:05 -07:00
|
|
|
|
2014-03-17 04:44:40 -07:00
|
|
|
eo_do(WIDGET(it), elm_interface_scrollable_region_bring_in(x, y, w, h));
|
2010-10-05 12:10:06 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_list_item_object_get(Eo *eo_it EINA_UNUSED, Elm_List_Item_Data *it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-07-04 14:43:05 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
return VIEW(it);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_list_item_prev_get(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item)
|
|
|
|
{
|
|
|
|
if (item->node->prev)
|
|
|
|
return item->node->prev->data;
|
|
|
|
return NULL;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_list_item_next_get(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item)
|
|
|
|
{
|
|
|
|
if (item->node->next)
|
|
|
|
return item->node->next->data;
|
|
|
|
return NULL;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
2012-03-19 00:27:53 -07:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_first_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!sd->items) return NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
else
|
|
|
|
return eina_list_data_get(sd->items);
|
|
|
|
return NULL;
|
2012-03-19 00:27:53 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_last_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2013-03-16 23:36:30 -07:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
if (!sd->items) return NULL;
|
2014-09-27 22:15:48 -07:00
|
|
|
else
|
|
|
|
return eina_list_data_get(eina_list_last(sd->items));
|
|
|
|
return NULL;
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_at_xy_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Evas_Coord x, Evas_Coord y, int *posret)
|
2013-03-16 23:36:30 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2014-09-27 22:15:48 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2013-03-16 23:36:30 -07:00
|
|
|
Evas_Coord lasty;
|
|
|
|
evas_object_geometry_get(sd->hit_rect, &lasty, NULL, NULL, NULL);
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, eo_it)
|
2013-03-16 23:36:30 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(eo_it, it);
|
2013-03-16 23:36:30 -07:00
|
|
|
Evas_Coord itx, ity;
|
|
|
|
Evas_Object *vit = VIEW(it);
|
|
|
|
Evas_Coord vx, vy, vw, vh;
|
|
|
|
evas_object_geometry_get(vit, &vx, &vy, &vw, &vh);
|
|
|
|
|
|
|
|
itx = vx;
|
|
|
|
ity = vy;
|
|
|
|
if (ELM_RECTS_INTERSECT
|
|
|
|
(itx, ity, vw, vh, x, y, 1, 1))
|
|
|
|
{
|
|
|
|
if (posret)
|
|
|
|
{
|
|
|
|
if (y <= (ity + (vh / 4))) *posret = -1;
|
|
|
|
else if (y >= (ity + vh - (vh / 4)))
|
|
|
|
*posret = 1;
|
|
|
|
else *posret = 0;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:48 -07:00
|
|
|
return EO_OBJ(it);
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
lasty = ity + vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (posret)
|
|
|
|
{
|
|
|
|
if (y > lasty) *posret = 1;
|
|
|
|
else *posret = -1;
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
return NULL;
|
2013-02-20 02:00:49 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_focus_on_selection_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool enabled)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
|
|
|
sd->focus_on_selection_enabled = !!enabled;
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_focus_on_selection_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->focus_on_selection_enabled;
|
2013-02-20 02:00:49 -08:00
|
|
|
}
|
|
|
|
|
2014-02-18 06:40:48 -08:00
|
|
|
static void
|
2014-09-27 22:15:48 -07:00
|
|
|
_elm_list_item_coordinates_adjust(Elm_List_Item_Data *it,
|
2014-02-18 06:40:48 -08:00
|
|
|
Evas_Coord *x,
|
|
|
|
Evas_Coord *y,
|
|
|
|
Evas_Coord *w,
|
|
|
|
Evas_Coord *h)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_LIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-02-18 06:40:48 -08:00
|
|
|
|
|
|
|
Evas_Coord ix, iy, iw, ih, vx, vy, vw, vh;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->hit_rect, &vx, &vy, &vw, &vh);
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
|
|
|
*x = ix;
|
|
|
|
*y = iy;
|
|
|
|
*w = iw;
|
|
|
|
*h = ih;
|
|
|
|
if (!sd->h_mode)
|
|
|
|
{
|
|
|
|
//TODO: Enhance it later. declare a macro in elm_macros.h
|
|
|
|
if ((ix < vx) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
|
|
|
|
*y = iy - ih;
|
|
|
|
else if (iy < vy)
|
|
|
|
*y = iy + ih;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//TODO: Enhance it later. declare a macro in elm_macros.h
|
|
|
|
if ((iy < vy) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
|
|
|
|
*x = ix - iw;
|
|
|
|
else if (ix < vx)
|
|
|
|
*x = ix + iw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
2014-05-06 22:13:19 -07:00
|
|
|
_elm_list_elm_widget_focus_highlight_geometry_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-05-06 22:13:19 -07:00
|
|
|
if (sd->focused_item)
|
2014-05-06 22:08:04 -07:00
|
|
|
{
|
2014-09-27 22:15:48 -07:00
|
|
|
ELM_LIST_ITEM_DATA_GET(sd->focused_item, focus_it);
|
|
|
|
_elm_list_item_coordinates_adjust(focus_it, x, y, w, h);
|
|
|
|
elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), x, y, w, h);
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_list_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2014-02-18 06:40:48 -08:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->focused_item;
|
2014-02-18 06:40:48 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_list_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool enable)
|
2014-03-24 01:35:07 -07:00
|
|
|
{
|
|
|
|
sd->item_loop_enable = !!enable;
|
|
|
|
}
|
|
|
|
|
2014-03-31 05:59:55 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_list_elm_widget_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
2014-03-24 01:35:07 -07:00
|
|
|
{
|
2014-03-31 05:59:55 -07:00
|
|
|
return sd->item_loop_enable;
|
2014-03-24 01:35:07 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2014-03-31 05:59:55 -07:00
|
|
|
_elm_list_class_constructor(Eo_Class *klass)
|
|
|
|
{
|
2013-03-12 22:05:00 -07:00
|
|
|
if (_elm_config->access_mode)
|
|
|
|
_elm_list_smart_focus_next_enable = EINA_TRUE;
|
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2014-07-25 01:33:19 -07:00
|
|
|
|
|
|
|
EOLIAN const Elm_Atspi_Action *
|
|
|
|
_elm_list_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_List_Data *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "move,prior", "move", "prior", _key_action_move},
|
|
|
|
{ "move,next", "move", "next", _key_action_move},
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,left,multi", "move", "left_multi", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "move,right,multi", "move", "right_multi", _key_action_move},
|
|
|
|
{ "move,up", "move", "up", _key_action_move},
|
|
|
|
{ "move,up,multi", "move", "up_multi", _key_action_move},
|
|
|
|
{ "move,down", "move", "down", _key_action_move},
|
|
|
|
{ "move,down,multi", "move", "down_multi", _key_action_move},
|
|
|
|
{ "move,first", "move", "first", _key_action_move},
|
|
|
|
{ "move,last", "move", "last", _key_action_move},
|
|
|
|
{ "select", "select", NULL, _key_action_select},
|
|
|
|
{ "escape", "escape", NULL, _key_action_escape},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
2014-03-31 05:59:55 -07:00
|
|
|
#include "elm_list.eo.c"
|
2014-09-27 22:15:48 -07:00
|
|
|
#include "elm_list_item.eo.c"
|