2009-01-07 05:49:08 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2011-10-06 22:56:07 -07:00
|
|
|
#include "els_scroller.h"
|
2009-01-07 05:49:08 -08:00
|
|
|
|
2010-10-15 04:25:02 -07:00
|
|
|
#define SWIPE_MOVES 12
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
typedef struct _Widget_Data Widget_Data;
|
2012-01-11 19:03:56 -08:00
|
|
|
typedef struct _Elm_List_Item Elm_List_Item;
|
2009-01-07 05:49:08 -08:00
|
|
|
|
|
|
|
struct _Widget_Data
|
|
|
|
{
|
2009-12-02 10:59:41 -08:00
|
|
|
Evas_Object *scr, *box, *self;
|
|
|
|
Eina_List *items, *selected, *to_delete;
|
2012-01-11 19:18:43 -08:00
|
|
|
Elm_Object_Item *last_selected_item;
|
2009-03-14 21:13:08 -07:00
|
|
|
Elm_List_Mode mode;
|
2010-10-19 13:19:12 -07:00
|
|
|
Elm_List_Mode h_mode;
|
2009-01-08 06:29:13 -08:00
|
|
|
Evas_Coord minw[2], minh[2];
|
2010-10-05 12:10:00 -07:00
|
|
|
Eina_Bool scr_minw : 1;
|
|
|
|
Eina_Bool scr_minh : 1;
|
2009-12-02 10:59:41 -08:00
|
|
|
int walking;
|
2010-10-15 04:25:02 -07:00
|
|
|
int movements;
|
2011-03-08 03:48:12 -08:00
|
|
|
struct {
|
2011-04-01 04:26:58 -07:00
|
|
|
Evas_Coord x, y;
|
2010-10-15 04:25:02 -07:00
|
|
|
} history[SWIPE_MOVES];
|
|
|
|
Eina_Bool swipe : 1;
|
2009-12-02 10:59:41 -08:00
|
|
|
Eina_Bool fix_pending : 1;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_Bool on_hold : 1;
|
|
|
|
Eina_Bool multi : 1;
|
|
|
|
Eina_Bool always_select : 1;
|
2009-09-01 03:42:52 -07:00
|
|
|
Eina_Bool longpressed : 1;
|
|
|
|
Eina_Bool wasselected : 1;
|
2009-01-07 05:49:08 -08:00
|
|
|
};
|
|
|
|
|
2009-02-25 07:54:26 -08:00
|
|
|
struct _Elm_List_Item
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2011-10-20 17:45:19 -07:00
|
|
|
ELM_WIDGET_ITEM;
|
2010-10-05 12:10:08 -07:00
|
|
|
Widget_Data *wd;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_List *node;
|
2009-01-07 05:49:08 -08:00
|
|
|
const char *label;
|
2009-01-08 06:29:13 -08:00
|
|
|
Evas_Object *icon, *end;
|
2010-03-16 08:31:38 -07:00
|
|
|
Evas_Smart_Cb func;
|
2009-09-01 03:42:52 -07:00
|
|
|
Ecore_Timer *long_timer;
|
2010-10-15 04:25:02 -07:00
|
|
|
Ecore_Timer *swipe_timer;
|
2009-12-02 10:59:41 -08:00
|
|
|
Eina_Bool deleted : 1;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_Bool even : 1;
|
|
|
|
Eina_Bool is_even : 1;
|
2010-07-01 16:48:10 -07:00
|
|
|
Eina_Bool is_separator : 1;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_Bool fixed : 1;
|
|
|
|
Eina_Bool selected : 1;
|
2011-08-25 10:19:22 -07:00
|
|
|
Eina_Bool highlighted : 1;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_Bool dummy_icon : 1;
|
|
|
|
Eina_Bool dummy_end : 1;
|
2009-01-07 05:49:08 -08:00
|
|
|
};
|
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2009-01-07 05:49:08 -08:00
|
|
|
static void _del_hook(Evas_Object *obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
2010-01-15 01:32:43 -08:00
|
|
|
static void _theme_hook(Evas_Object *obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
2010-11-18 02:01:05 -08:00
|
|
|
static void _disable_hook(Evas_Object *obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
static void _on_focus_hook(void *data, Evas_Object *obj);
|
2010-11-18 02:01:05 -08:00
|
|
|
static void _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source);
|
2009-01-25 15:18:25 -08:00
|
|
|
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
|
|
|
static void _fix_items(Evas_Object *obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
|
|
|
static void _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
|
|
|
static void _mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
2011-10-20 09:42:42 -07:00
|
|
|
static void _edge_left(void *data, Evas_Object *scr, void *event_info);
|
|
|
|
static void _edge_right(void *data, Evas_Object *scr, void *event_info);
|
|
|
|
static void _edge_top(void *data, Evas_Object *scr, void *event_info);
|
|
|
|
static void _edge_bottom(void *data, Evas_Object *scr, void *event_info);
|
2010-10-05 12:10:08 -07:00
|
|
|
static Eina_Bool _item_multi_select_up(Widget_Data *wd);
|
|
|
|
static Eina_Bool _item_multi_select_down(Widget_Data *wd);
|
|
|
|
static Eina_Bool _item_single_select_up(Widget_Data *wd);
|
|
|
|
static Eina_Bool _item_single_select_down(Widget_Data *wd);
|
2010-10-05 12:10:03 -07:00
|
|
|
static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
|
|
|
|
Evas_Callback_Type type, void *event_info);
|
2010-10-27 07:38:54 -07:00
|
|
|
static Eina_Bool _deselect_all_items(Widget_Data *wd);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
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";
|
2011-04-21 08:57:03 -07:00
|
|
|
|
|
|
|
static const Evas_Smart_Cb_Description _signals[] = {
|
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, ""},
|
2011-04-21 08:57:03 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
|
|
|
#define ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ...) \
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, __VA_ARGS__); \
|
|
|
|
if (((Elm_List_Item *) it)->deleted) \
|
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
|
|
|
{ \
|
|
|
|
ERR("ERROR: "#it" has been DELETED.\n"); \
|
|
|
|
return __VA_ARGS__; \
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
static inline void
|
|
|
|
_elm_list_item_free(Elm_List_Item *it)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full
|
2011-10-20 18:08:01 -07:00
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, it);
|
2009-12-02 10:59:41 -08:00
|
|
|
evas_object_event_callback_del_full
|
2011-10-20 18:08:01 -07:00
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_UP, _mouse_up, it);
|
2009-12-02 10:59:41 -08:00
|
|
|
evas_object_event_callback_del_full
|
2011-10-20 18:08:01 -07:00
|
|
|
(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, it);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
if (it->icon)
|
|
|
|
evas_object_event_callback_del_full
|
2011-04-01 04:26:58 -07:00
|
|
|
(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2011-10-20 18:08:01 -07:00
|
|
|
_changed_size_hints, WIDGET(it));
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
if (it->end)
|
|
|
|
evas_object_event_callback_del_full
|
2011-04-01 04:26:58 -07:00
|
|
|
(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2011-10-20 18:08:01 -07:00
|
|
|
_changed_size_hints, WIDGET(it));
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
eina_stringshare_del(it->label);
|
|
|
|
|
2010-10-15 04:25:02 -07:00
|
|
|
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
|
2009-12-02 10:59:41 -08:00
|
|
|
if (it->long_timer) ecore_timer_del(it->long_timer);
|
|
|
|
if (it->icon) evas_object_del(it->icon);
|
|
|
|
if (it->end) evas_object_del(it->end);
|
2010-09-09 19:05:45 -07:00
|
|
|
|
|
|
|
elm_widget_item_del(it);
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:03 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
|
|
|
|
{
|
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
2010-10-27 07:38:57 -07:00
|
|
|
if (!wd->items) return EINA_FALSE;
|
2010-10-05 12:10:03 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
|
|
|
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
|
|
|
|
|
|
|
|
Elm_List_Item *it = NULL;
|
|
|
|
Evas_Coord x = 0;
|
|
|
|
Evas_Coord y = 0;
|
|
|
|
Evas_Coord step_x = 0;
|
|
|
|
Evas_Coord step_y = 0;
|
|
|
|
Evas_Coord v_w = 0;
|
|
|
|
Evas_Coord v_h = 0;
|
|
|
|
Evas_Coord page_x = 0;
|
|
|
|
Evas_Coord page_y = 0;
|
|
|
|
|
|
|
|
elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
|
|
|
|
elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
|
|
|
|
elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
|
|
|
|
elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
|
|
|
|
|
2010-10-19 13:19:12 -07:00
|
|
|
/* TODO: fix logic for horizontal mode */
|
2010-11-29 05:56:33 -08:00
|
|
|
if ((!strcmp(ev->keyname, "Left")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Left")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2010-11-10 10:04:51 -08:00
|
|
|
if ((wd->h_mode) &&
|
|
|
|
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
|
|
|
(_item_multi_select_up(wd)))
|
|
|
|
|| (_item_single_select_up(wd))))
|
|
|
|
{
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
x -= step_x;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "Right")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Right")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2010-11-10 10:04:51 -08:00
|
|
|
if ((wd->h_mode) &&
|
|
|
|
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
|
|
|
(_item_multi_select_down(wd)))
|
|
|
|
|| (_item_single_select_down(wd))))
|
|
|
|
{
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
x += step_x;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "Up")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Up")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2010-11-10 10:04:51 -08:00
|
|
|
if ((!wd->h_mode) &&
|
|
|
|
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
|
|
|
(_item_multi_select_up(wd)))
|
|
|
|
|| (_item_single_select_up(wd))))
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
y -= step_y;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "Down")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Down")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2010-11-10 10:04:51 -08:00
|
|
|
if ((!wd->h_mode) &&
|
|
|
|
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
|
|
|
(_item_multi_select_down(wd)))
|
|
|
|
|| (_item_single_select_down(wd))))
|
2010-10-05 12:10:08 -07:00
|
|
|
{
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
y += step_y;
|
2010-10-05 12:10:03 -07:00
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "Home")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Home")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
|
|
|
it = eina_list_data_get(wd->items);
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_bring_in((Elm_Object_Item *) it);
|
2010-10-05 12:10:03 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "End")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_End")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
|
|
|
it = eina_list_data_get(eina_list_last(wd->items));
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_bring_in((Elm_Object_Item *) it);
|
2010-10-05 12:10:03 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "Prior")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Prior")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2010-11-10 10:04:51 -08:00
|
|
|
if (wd->h_mode)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2010-11-29 05:56:33 -08:00
|
|
|
else if ((!strcmp(ev->keyname, "Next")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Next")))
|
2010-10-05 12:10:03 -07:00
|
|
|
{
|
2010-11-10 10:04:51 -08:00
|
|
|
if (wd->h_mode)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2011-07-25 18:49:24 -07:00
|
|
|
else if (((!strcmp(ev->keyname, "Return")) ||
|
|
|
|
(!strcmp(ev->keyname, "KP_Enter")) ||
|
|
|
|
(!strcmp(ev->keyname, "space")))
|
|
|
|
&& (!wd->multi) && (wd->selected))
|
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
it = (Elm_List_Item *) elm_list_selected_item_get(obj);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
|
2011-07-25 18:49:24 -07:00
|
|
|
}
|
2010-10-27 07:38:54 -07:00
|
|
|
else if (!strcmp(ev->keyname, "Escape"))
|
|
|
|
{
|
2011-04-01 04:26:58 -07:00
|
|
|
if (!_deselect_all_items(wd)) return EINA_FALSE;
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return EINA_TRUE;
|
2010-10-27 07:38:54 -07:00
|
|
|
}
|
2010-10-05 12:10:03 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
elm_smart_scroller_child_pos_set(wd->scr, x, y);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-10-19 07:17:14 -07:00
|
|
|
static void
|
|
|
|
_translate_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
evas_object_smart_callback_call(obj, "language,changed", NULL);
|
|
|
|
}
|
|
|
|
|
2010-10-27 07:38:54 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_deselect_all_items(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
if (!wd->selected) return EINA_FALSE;
|
2011-03-08 03:47:45 -08:00
|
|
|
while (wd->selected)
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_selected_set((Elm_Object_Item *) wd->selected->data,
|
|
|
|
EINA_FALSE);
|
2010-10-27 07:38:54 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:08 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_multi_select_up(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
if (!wd->selected) return EINA_FALSE;
|
|
|
|
if (!wd->multi) return EINA_FALSE;
|
|
|
|
|
2012-01-11 19:18:43 -08:00
|
|
|
Elm_Object_Item *prev = elm_list_item_prev(wd->last_selected_item);
|
2010-10-05 12:10:08 -07:00
|
|
|
if (!prev) return EINA_TRUE;
|
|
|
|
|
|
|
|
if (elm_list_item_selected_get(prev))
|
|
|
|
{
|
2012-01-11 19:18:43 -08:00
|
|
|
elm_list_item_selected_set(wd->last_selected_item, EINA_FALSE);
|
|
|
|
wd->last_selected_item = prev;
|
|
|
|
elm_list_item_show(wd->last_selected_item);
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_list_item_selected_set(prev, EINA_TRUE);
|
|
|
|
elm_list_item_show(prev);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_multi_select_down(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
if (!wd->selected) return EINA_FALSE;
|
|
|
|
if (!wd->multi) return EINA_FALSE;
|
|
|
|
|
2012-01-11 19:18:43 -08:00
|
|
|
Elm_Object_Item *next = elm_list_item_next(wd->last_selected_item);
|
2010-10-05 12:10:08 -07:00
|
|
|
if (!next) return EINA_TRUE;
|
|
|
|
|
|
|
|
if (elm_list_item_selected_get(next))
|
|
|
|
{
|
2012-01-11 19:18:43 -08:00
|
|
|
elm_list_item_selected_set(wd->last_selected_item, EINA_FALSE);
|
|
|
|
wd->last_selected_item = next;
|
|
|
|
elm_list_item_show(wd->last_selected_item);
|
2010-10-05 12:10:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_list_item_selected_set(next, EINA_TRUE);
|
|
|
|
elm_list_item_show(next);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_single_select_up(Widget_Data *wd)
|
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_Object_Item *prev;
|
2010-10-27 07:38:57 -07:00
|
|
|
|
|
|
|
if (!wd->selected) prev = eina_list_data_get(eina_list_last(wd->items));
|
2012-01-11 19:18:43 -08:00
|
|
|
else prev = elm_list_item_prev(wd->last_selected_item);
|
2010-10-05 12:10:08 -07:00
|
|
|
if (!prev) return EINA_FALSE;
|
|
|
|
|
2010-10-27 07:38:54 -07:00
|
|
|
_deselect_all_items(wd);
|
2010-10-05 12:10:08 -07:00
|
|
|
|
|
|
|
elm_list_item_selected_set(prev, EINA_TRUE);
|
|
|
|
elm_list_item_show(prev);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_single_select_down(Widget_Data *wd)
|
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_Object_Item *next;
|
2010-10-27 07:38:57 -07:00
|
|
|
|
|
|
|
if (!wd->selected) next = eina_list_data_get(wd->items);
|
2012-01-11 19:18:43 -08:00
|
|
|
else next = elm_list_item_next(wd->last_selected_item);
|
2010-10-05 12:10:08 -07:00
|
|
|
if (!next) return EINA_FALSE;
|
|
|
|
|
2010-10-27 07:38:54 -07:00
|
|
|
_deselect_all_items(wd);
|
2010-10-05 12:10:08 -07:00
|
|
|
|
|
|
|
elm_list_item_selected_set(next, EINA_TRUE);
|
|
|
|
elm_list_item_show(next);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-12-02 10:59:41 -08:00
|
|
|
static void
|
|
|
|
_elm_list_process_deletions(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it;
|
|
|
|
|
|
|
|
wd->walking++; // avoid nested deletion and also _sub_del() fix_items
|
|
|
|
|
|
|
|
EINA_LIST_FREE(wd->to_delete, it)
|
|
|
|
{
|
2010-09-09 19:05:45 -07:00
|
|
|
elm_widget_item_pre_notify_del(it);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2010-10-15 04:51:15 -07:00
|
|
|
wd->items = eina_list_remove_list(wd->items, it->node);
|
|
|
|
_elm_list_item_free(it);
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
wd->walking--;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_elm_list_walk(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
if (wd->walking < 0)
|
|
|
|
{
|
2011-04-01 04:26:58 -07:00
|
|
|
ERR("ERROR: walking was negative. fixed!\n");
|
|
|
|
wd->walking = 0;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
wd->walking++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_elm_list_unwalk(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
wd->walking--;
|
|
|
|
if (wd->walking < 0)
|
|
|
|
{
|
2011-04-01 04:26:58 -07:00
|
|
|
ERR("ERROR: walking became negative. fixed!\n");
|
|
|
|
wd->walking = 0;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (wd->walking)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (wd->to_delete)
|
|
|
|
_elm_list_process_deletions(wd);
|
|
|
|
|
|
|
|
if (wd->fix_pending)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
wd->fix_pending = EINA_FALSE;
|
|
|
|
_fix_items(wd->self);
|
|
|
|
_sizing_eval(wd->self);
|
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
|
|
|
|
_del_pre_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
|
|
|
|
evas_object_event_callback_del(wd->scr,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints);
|
|
|
|
evas_object_event_callback_del(wd->box,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints);
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
static void
|
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-02-25 12:18:38 -08:00
|
|
|
Elm_List_Item *it;
|
2009-12-02 10:59:41 -08:00
|
|
|
Eina_List *n;
|
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-10-22 14:41:27 -07:00
|
|
|
if (wd->walking)
|
2010-10-19 13:19:12 -07:00
|
|
|
ERR("ERROR: list deleted while walking.\n");
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
_elm_list_walk(wd);
|
2010-09-09 19:05:45 -07:00
|
|
|
EINA_LIST_FOREACH(wd->items, n, it) elm_widget_item_pre_notify_del(it);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_unwalk(wd);
|
2010-10-19 13:19:12 -07:00
|
|
|
if (wd->to_delete)
|
|
|
|
ERR("ERROR: leaking nodes!\n");
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
EINA_LIST_FREE(wd->items, it) _elm_list_item_free(it);
|
2009-01-08 23:35:52 -08:00
|
|
|
eina_list_free(wd->selected);
|
2009-01-07 05:49:08 -08:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:00 -07:00
|
|
|
static void
|
|
|
|
_show_region_hook(void *data, Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
|
|
|
Evas_Coord x, y, w, h;
|
2011-01-12 02:04:11 -08:00
|
|
|
if (!wd) return;
|
2010-10-05 12:10:00 -07:00
|
|
|
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
2011-01-24 18:19:03 -08:00
|
|
|
elm_smart_scroller_child_region_set(wd->scr, x, y, w, h);
|
2010-10-05 12:10:00 -07:00
|
|
|
}
|
|
|
|
|
2010-11-18 02:01:05 -08:00
|
|
|
static void
|
|
|
|
_disable_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (elm_widget_disabled_get(obj))
|
|
|
|
{
|
|
|
|
_signal_emit_hook(obj, "elm,state,disabled", "elm");
|
|
|
|
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... */
|
|
|
|
_deselect_all_items(wd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_signal_emit_hook(obj, "elm,state,enabled", "elm");
|
|
|
|
elm_widget_scroll_freeze_pop(obj);
|
|
|
|
elm_widget_scroll_hold_pop(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
2010-10-05 12:10:00 -07:00
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-10-05 12:10:00 -07:00
|
|
|
Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
|
|
|
|
double xw, yw;
|
|
|
|
|
|
|
|
evas_object_size_hint_min_get(wd->box, &minw, &minh);
|
|
|
|
evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
|
|
|
|
evas_object_size_hint_weight_get(wd->box, &xw, &yw);
|
|
|
|
if (!wd->scr) return;
|
|
|
|
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
|
|
|
|
if (xw > 0.0)
|
|
|
|
{
|
|
|
|
if ((minw > 0) && (vw < minw)) vw = minw;
|
|
|
|
else if ((maxw > 0) && (vw > maxw)) vw = maxw;
|
|
|
|
}
|
|
|
|
else if (minw > 0) vw = minw;
|
|
|
|
if (yw > 0.0)
|
2010-03-13 19:48:22 -08:00
|
|
|
{
|
2010-10-05 12:10:00 -07:00
|
|
|
if ((minh > 0) && (vh < minh)) vh = minh;
|
|
|
|
else if ((maxh > 0) && (vh > maxh)) vh = maxh;
|
2010-03-13 19:48:22 -08:00
|
|
|
}
|
2010-10-05 12:10:00 -07:00
|
|
|
else if (minh > 0) vh = minh;
|
|
|
|
evas_object_resize(wd->box, vw, vh);
|
|
|
|
w = -1;
|
|
|
|
h = -1;
|
|
|
|
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
|
|
|
|
&vmw, &vmh);
|
|
|
|
if (wd->scr_minw) w = vmw + minw;
|
|
|
|
if (wd->scr_minh) h = vmh + minh;
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
evas_object_size_hint_max_get(obj, &maxw, &maxh);
|
2010-10-22 14:41:22 -07:00
|
|
|
if ((maxw > 0) && (w > maxw))
|
2010-10-19 13:19:12 -07:00
|
|
|
w = maxw;
|
2010-10-22 14:41:22 -07:00
|
|
|
if ((maxh > 0) && (h > maxh))
|
2010-10-19 13:19:12 -07:00
|
|
|
h = maxh;
|
|
|
|
|
2010-10-05 12:10:00 -07:00
|
|
|
evas_object_size_hint_min_set(obj, w, h);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2010-09-09 11:53:36 -07:00
|
|
|
static void
|
|
|
|
_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-10-29 11:21:58 -07:00
|
|
|
edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
|
|
|
|
emission, source);
|
2010-09-09 11:53:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-02 22:32:17 -07:00
|
|
|
_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
2010-09-09 11:53:36 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-10-29 11:21:58 -07:00
|
|
|
edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
|
|
|
|
emission, source, func_cb, data);
|
2010-09-09 11:53:36 -07:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:21:58 -07:00
|
|
|
static void
|
2011-04-02 22:32:17 -07:00
|
|
|
_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
2010-09-09 11:53:36 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-10-29 11:21:58 -07:00
|
|
|
edje_object_signal_callback_del_full(
|
2011-04-01 04:26:58 -07:00
|
|
|
elm_smart_scroller_edje_object_get(wd->scr),
|
|
|
|
emission, source, func_cb, data);
|
2010-09-09 11:53:36 -07:00
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_List_Item *it;
|
|
|
|
Eina_List *n;
|
|
|
|
|
|
|
|
if (!wd) return;
|
|
|
|
if (wd->scr)
|
|
|
|
elm_smart_scroller_mirrored_set(wd->scr, rtl);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wd->items, n, it)
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_mirrored_set(VIEW(it), rtl);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2010-01-15 01:32:43 -08:00
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_List_Item *it;
|
|
|
|
Eina_List *n;
|
2010-10-15 04:34:22 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2011-02-09 08:14:02 -08:00
|
|
|
_elm_widget_mirrored_reload(obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
|
|
|
|
2010-03-13 19:48:22 -08:00
|
|
|
if (wd->scr)
|
|
|
|
{
|
2010-10-05 12:10:00 -07:00
|
|
|
Evas_Object *edj;
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
elm_smart_scroller_object_theme_set(obj, wd->scr, "list", "base",
|
|
|
|
elm_widget_style_get(obj));
|
2011-04-01 04:26:58 -07:00
|
|
|
// edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
|
2010-10-05 12:10:00 -07:00
|
|
|
edj = elm_smart_scroller_edje_object_get(wd->scr);
|
|
|
|
str = edje_object_data_get(edj, "focus_highlight");
|
2010-10-22 14:41:22 -07:00
|
|
|
if ((str) && (!strcmp(str, "on")))
|
2010-10-05 12:10:00 -07:00
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
|
|
|
|
elm_object_style_set(wd->scr, elm_widget_style_get(obj));
|
2010-03-13 19:48:22 -08:00
|
|
|
}
|
2010-01-15 01:32:43 -08:00
|
|
|
EINA_LIST_FOREACH(wd->items, n, it)
|
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_scale_set(VIEW(it), elm_widget_scale_get(obj) * _elm_config->scale);
|
2010-01-15 01:32:43 -08:00
|
|
|
it->fixed = 0;
|
|
|
|
}
|
|
|
|
_fix_items(obj);
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-04-20 13:03:05 -07:00
|
|
|
if (elm_widget_focus_get(obj))
|
2010-09-29 05:22:30 -07:00
|
|
|
{
|
2010-10-05 12:10:08 -07:00
|
|
|
edje_object_signal_emit(wd->self, "elm,action,focus", "elm");
|
|
|
|
evas_object_focus_set(wd->self, EINA_TRUE);
|
|
|
|
|
2010-10-22 14:41:22 -07:00
|
|
|
if ((wd->selected) && (!wd->last_selected_item))
|
2010-10-05 12:10:08 -07:00
|
|
|
wd->last_selected_item = eina_list_data_get(wd->selected);
|
2010-09-29 05:22:30 -07:00
|
|
|
}
|
2010-04-20 13:03:05 -07:00
|
|
|
else
|
2010-09-29 05:22:30 -07:00
|
|
|
{
|
2010-10-05 12:10:08 -07:00
|
|
|
edje_object_signal_emit(wd->self, "elm,action,unfocus", "elm");
|
|
|
|
evas_object_focus_set(wd->self, EINA_FALSE);
|
2010-09-29 05:22:30 -07:00
|
|
|
}
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2009-01-25 15:18:25 -08:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-01-25 15:18:25 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-10-05 12:10:00 -07:00
|
|
|
_fix_items(data);
|
|
|
|
_sizing_eval(data);
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
|
|
|
|
2009-07-06 23:46:51 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
2009-01-25 15:18:25 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *sub = event_info;
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Elm_List_Item *it;
|
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!sub) abort();
|
2011-06-09 01:36:55 -07:00
|
|
|
if ((sub == wd->box) || (sub == wd->scr)) return;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wd->items, l, it)
|
2009-01-25 15:18:25 -08:00
|
|
|
{
|
2011-06-09 01:36:55 -07:00
|
|
|
if ((sub == it->icon) || (sub == it->end))
|
2010-03-13 19:48:22 -08:00
|
|
|
{
|
2011-06-09 01:36:55 -07:00
|
|
|
if (it->icon == sub) it->icon = NULL;
|
|
|
|
if (it->end == sub) it->end = NULL;
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints,
|
|
|
|
obj);
|
|
|
|
if (!wd->walking)
|
2010-03-13 19:48:22 -08:00
|
|
|
{
|
2011-06-09 01:36:55 -07:00
|
|
|
_fix_items(obj);
|
|
|
|
_sizing_eval(obj);
|
2010-03-13 19:48:22 -08:00
|
|
|
}
|
2011-06-09 01:36:55 -07:00
|
|
|
else
|
|
|
|
wd->fix_pending = EINA_TRUE;
|
|
|
|
break;
|
2010-03-13 19:48:22 -08:00
|
|
|
}
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
static void
|
2011-08-25 10:19:22 -07:00
|
|
|
_item_highlight(Elm_List_Item *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-05-12 03:16:49 -07:00
|
|
|
const char *selectraise;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2012-01-02 20:17:32 -08:00
|
|
|
if ((it->highlighted) || (it->base.disabled)) return;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_walk(wd);
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
|
|
|
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
2009-05-12 03:16:49 -07:00
|
|
|
if ((selectraise) && (!strcmp(selectraise, "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;
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
_elm_list_unwalk(wd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-25 07:54:26 -08:00
|
|
|
_item_select(Elm_List_Item *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2012-01-02 20:17:32 -08:00
|
|
|
if (it->base.disabled) return;
|
2009-04-26 18:29:02 -07:00
|
|
|
if (it->selected)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if (wd->always_select) goto call;
|
|
|
|
return;
|
2009-04-26 18:29:02 -07:00
|
|
|
}
|
2009-06-17 08:35:19 -07:00
|
|
|
it->selected = EINA_TRUE;
|
2009-01-08 23:35:52 -08:00
|
|
|
wd->selected = eina_list_append(wd->selected, it);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
|
|
|
call:
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_walk(wd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
if (it->func) it->func((void *)it->base.data, WIDGET(it), it);
|
2011-04-21 08:57:03 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_SELECTED, it);
|
2012-01-11 19:18:43 -08:00
|
|
|
it->wd->last_selected_item = (Elm_Object_Item *) it;
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
_elm_list_unwalk(wd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-25 07:54:26 -08:00
|
|
|
_item_unselect(Elm_List_Item *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
const char *stacking, *selectraise;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2011-08-25 10:19:22 -07:00
|
|
|
if (!it->highlighted) return;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_walk(wd);
|
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");
|
|
|
|
stacking = edje_object_data_get(VIEW(it), "stacking");
|
|
|
|
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
2009-01-07 05:49:08 -08:00
|
|
|
if ((selectraise) && (!strcmp(selectraise, "on")))
|
|
|
|
{
|
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;
|
2009-05-12 03:16:49 -07:00
|
|
|
if (it->selected)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
it->selected = EINA_FALSE;
|
|
|
|
wd->selected = eina_list_remove(wd->selected, it);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_unwalk(wd);
|
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)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
|
2010-10-15 04:25:02 -07:00
|
|
|
|
|
|
|
if (!wd) return ECORE_CALLBACK_CANCEL;
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL);
|
|
|
|
wd->swipe = EINA_FALSE;
|
|
|
|
wd->movements = 0;
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2009-05-12 03:16:49 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
2009-05-12 03:16:49 -07:00
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj2 = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj2);
|
2009-05-12 03:16:49 -07:00
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj2);
|
|
|
|
_elm_list_walk(wd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2009-05-12 03:16:49 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if (!wd->on_hold)
|
|
|
|
{
|
|
|
|
wd->on_hold = EINA_TRUE;
|
2009-09-24 00:22:58 -07:00
|
|
|
if (it->long_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(it->long_timer);
|
|
|
|
it->long_timer = NULL;
|
|
|
|
}
|
2010-08-05 11:17:05 -07:00
|
|
|
if (!wd->wasselected)
|
|
|
|
_item_unselect(it);
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2010-10-15 04:25:02 -07:00
|
|
|
if (wd->movements == SWIPE_MOVES) wd->swipe = EINA_TRUE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wd->history[wd->movements].x = ev->cur.canvas.x;
|
|
|
|
wd->history[wd->movements].y = ev->cur.canvas.y;
|
|
|
|
if (abs((wd->history[wd->movements].x - wd->history[0].x)) > 40)
|
2011-04-01 04:26:58 -07:00
|
|
|
wd->swipe = EINA_TRUE;
|
2010-10-15 04:25:02 -07:00
|
|
|
else
|
2011-04-01 04:26:58 -07:00
|
|
|
wd->movements++;
|
2010-10-15 04:25:02 -07:00
|
|
|
}
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
_elm_list_unwalk(wd);
|
|
|
|
evas_object_unref(obj2);
|
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
|
2011-10-20 09:42:42 -07:00
|
|
|
_edge_left(void *data, Evas_Object *scr __UNUSED__, void *event_info __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
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
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
|
2011-10-20 09:42:42 -07:00
|
|
|
_edge_right(void *data, Evas_Object *scr __UNUSED__, void *event_info __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
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
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
|
2011-10-20 09:42:42 -07:00
|
|
|
_edge_top(void *data, Evas_Object *scr __UNUSED__, void *event_info __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
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
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
|
2011-10-20 09:42:42 -07:00
|
|
|
_edge_bottom(void *data, Evas_Object *scr __UNUSED__, void *event_info __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
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
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
|
2009-09-01 03:42:52 -07:00
|
|
|
_long_press(void *data)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
if (!wd) goto end;
|
2010-10-19 13:19:57 -07:00
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL);
|
2009-09-01 03:42:52 -07:00
|
|
|
it->long_timer = NULL;
|
2012-01-02 20:17:32 -08:00
|
|
|
if (it->base.disabled) goto end;
|
2010-10-19 13:19:57 -07:00
|
|
|
|
2009-09-01 03:42:52 -07:00
|
|
|
wd->longpressed = EINA_TRUE;
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, 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
|
|
|
|
_swipe(Elm_List_Item *it)
|
|
|
|
{
|
|
|
|
int i, sum = 0;
|
2011-10-20 18:08:01 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
|
2010-10-15 04:25:02 -07:00
|
|
|
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
if (!wd) return;
|
|
|
|
wd->swipe = EINA_FALSE;
|
|
|
|
for (i = 0; i < wd->movements; i++)
|
|
|
|
{
|
|
|
|
sum += wd->history[i].x;
|
|
|
|
if (abs(wd->history[0].y - wd->history[i].y) > 10) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sum /= wd->movements;
|
|
|
|
if (abs(sum - wd->history[0].x) <= 10) return;
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), "swipe", it);
|
2010-10-15 04:25:02 -07:00
|
|
|
}
|
|
|
|
|
2009-05-12 03:16:49 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
2009-05-12 03:16:49 -07:00
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj2 = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj2);
|
2009-05-12 03:16:49 -07:00
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2009-09-01 03:42:52 -07:00
|
|
|
if (ev->button != 1) return;
|
2009-06-17 08:35:19 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
|
|
|
|
else wd->on_hold = EINA_FALSE;
|
2010-11-08 22:07:07 -08:00
|
|
|
if (wd->on_hold) return;
|
2009-09-01 03:42:52 -07:00
|
|
|
wd->wasselected = it->selected;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj2);
|
|
|
|
_elm_list_walk(wd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-08-25 10:19:22 -07:00
|
|
|
_item_highlight(it);
|
2009-09-01 03:42:52 -07:00
|
|
|
wd->longpressed = EINA_FALSE;
|
|
|
|
if (it->long_timer) ecore_timer_del(it->long_timer);
|
2010-12-06 21:04:45 -08:00
|
|
|
it->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, it);
|
2010-10-15 04:25:02 -07:00
|
|
|
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
|
|
|
|
it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
|
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
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
|
|
|
|
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
|
2011-07-25 18:49:24 -07:00
|
|
|
}
|
2010-10-15 04:25:02 -07:00
|
|
|
wd->swipe = EINA_FALSE;
|
|
|
|
wd->movements = 0;
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
_elm_list_unwalk(wd);
|
|
|
|
evas_object_unref(obj2);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2009-02-25 07:54:26 -08:00
|
|
|
Elm_List_Item *it = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj2 = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj2);
|
2009-01-07 05:49:08 -08:00
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
2009-09-26 12:23:45 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2009-09-01 03:42:52 -07:00
|
|
|
if (ev->button != 1) return;
|
2009-06-17 08:35:19 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
|
|
|
|
else wd->on_hold = EINA_FALSE;
|
2010-02-25 22:30:17 -08:00
|
|
|
wd->longpressed = EINA_FALSE;
|
2009-09-01 03:42:52 -07:00
|
|
|
if (it->long_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(it->long_timer);
|
|
|
|
it->long_timer = NULL;
|
|
|
|
}
|
2010-10-15 04:25:02 -07:00
|
|
|
if (it->swipe_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(it->swipe_timer);
|
|
|
|
it->swipe_timer = NULL;
|
|
|
|
}
|
2009-01-07 05:49:08 -08:00
|
|
|
if (wd->on_hold)
|
|
|
|
{
|
2010-10-15 04:25:02 -07:00
|
|
|
if (wd->swipe) _swipe(data);
|
2010-10-15 04:51:15 -07:00
|
|
|
wd->on_hold = EINA_FALSE;
|
|
|
|
return;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2009-09-01 03:42:52 -07:00
|
|
|
if (wd->longpressed)
|
|
|
|
{
|
2009-09-26 12:23:45 -07:00
|
|
|
if (!wd->wasselected) _item_unselect(it);
|
2009-09-01 03:42:52 -07:00
|
|
|
wd->wasselected = 0;
|
|
|
|
return;
|
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-01-02 20:17:32 -08: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
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj2);
|
|
|
|
_elm_list_walk(wd);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2009-01-08 23:35:52 -08:00
|
|
|
if (wd->multi)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
2011-08-25 10:19:22 -07:00
|
|
|
_item_highlight(it);
|
2010-10-15 04:51:15 -07:00
|
|
|
_item_select(it);
|
|
|
|
}
|
|
|
|
else _item_unselect(it);
|
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)
|
|
|
|
{
|
|
|
|
while (wd->selected)
|
2011-04-01 04:26:58 -07:00
|
|
|
_item_unselect(wd->selected->data);
|
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;
|
|
|
|
Elm_List_Item *it2;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(wd->selected, l, l_next, it2)
|
|
|
|
if (it2 != it) _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
|
|
|
|
|
|
|
_elm_list_unwalk(wd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj2);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2012-01-02 20:17:32 -08:00
|
|
|
static void
|
|
|
|
_item_disable(void *data)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
|
|
|
if (it->base.disabled)
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
|
|
|
|
}
|
|
|
|
|
2012-01-03 05:13:39 -08:00
|
|
|
static void
|
|
|
|
_item_content_set(void *data, const char *part, Evas_Object *content)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
|
|
|
Evas_Object **icon_p = NULL;
|
|
|
|
Eina_Bool dummy = EINA_FALSE;
|
|
|
|
|
|
|
|
if ((!part) || (!strcmp(part, "start")))
|
|
|
|
{
|
|
|
|
icon_p = &(it->icon);
|
|
|
|
dummy = it->dummy_icon;
|
|
|
|
if (!content) it->dummy_icon = EINA_FALSE;
|
|
|
|
else it->dummy_icon = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(part, "end"))
|
|
|
|
{
|
|
|
|
icon_p = &(it->end);
|
|
|
|
dummy = it->dummy_end;
|
|
|
|
if (!content) it->dummy_end = EINA_FALSE;
|
|
|
|
else it->dummy_end = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (content == *icon_p) return;
|
|
|
|
if ((dummy) && (!content)) return;
|
|
|
|
if (dummy) evas_object_del(*icon_p);
|
|
|
|
if (!content)
|
|
|
|
{
|
|
|
|
content = evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_object_color_set(content, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
if (*icon_p)
|
|
|
|
{
|
|
|
|
evas_object_del(*icon_p);
|
|
|
|
*icon_p = NULL;
|
|
|
|
}
|
|
|
|
*icon_p = content;
|
|
|
|
if (VIEW(it))
|
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.icon", content);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_item_content_get(const void *data, const char *part)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = (Elm_List_Item *)data;
|
|
|
|
|
|
|
|
if ((!part) || (!strcmp(part, "start")))
|
|
|
|
{
|
|
|
|
if (it->dummy_icon) return NULL;
|
|
|
|
return it->icon;
|
|
|
|
}
|
|
|
|
else if (!strcmp(part, "end"))
|
|
|
|
{
|
|
|
|
if (it->dummy_end) return NULL;
|
|
|
|
return it->end;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_item_content_unset(const void *data, const char *part)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = (Elm_List_Item *)data;
|
|
|
|
|
|
|
|
if ((!part) || (!strcmp(part, "start")))
|
|
|
|
{
|
|
|
|
Evas_Object *obj = it->icon;
|
|
|
|
_item_content_set((void *)data, part, NULL);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
else if (!strcmp(part, "end"))
|
|
|
|
{
|
|
|
|
Evas_Object *obj = it->end;
|
|
|
|
_item_content_set((void *)data, part, NULL);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_text_set(void *data, const char *part __UNUSED__, const char *text)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = data;
|
|
|
|
|
|
|
|
if (!eina_stringshare_replace(&it->label, text)) return;
|
|
|
|
if (VIEW(it))
|
|
|
|
edje_object_part_text_set(VIEW(it), "elm.text", it->label);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
_item_text_get(const void *data, const char *part __UNUSED__)
|
|
|
|
{
|
|
|
|
Elm_List_Item *it = (Elm_List_Item *)data;
|
|
|
|
|
|
|
|
return it->label;
|
|
|
|
}
|
|
|
|
|
2009-02-25 07:54:26 -08:00
|
|
|
static Elm_List_Item *
|
2010-03-16 08:31:38 -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
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-02-25 07:54:26 -08:00
|
|
|
Elm_List_Item *it;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return NULL;
|
2010-09-09 19:05:45 -07:00
|
|
|
it = elm_widget_item_new(obj, Elm_List_Item);
|
2010-10-05 12:10:08 -07:00
|
|
|
it->wd = wd;
|
2009-01-07 05:49:08 -08:00
|
|
|
it->label = eina_stringshare_add(label);
|
|
|
|
it->icon = icon;
|
|
|
|
it->end = end;
|
|
|
|
it->func = func;
|
2010-09-09 19:05:45 -07:00
|
|
|
it->base.data = data;
|
2011-10-20 18:08:01 -07:00
|
|
|
VIEW(it) = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj));
|
|
|
|
evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
|
2010-10-15 04:51:15 -07:00
|
|
|
_mouse_down, it);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
|
2010-10-15 04:51:15 -07:00
|
|
|
_mouse_up, it);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
|
2010-10-15 04:51:15 -07:00
|
|
|
_mouse_move, it);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
|
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);
|
|
|
|
evas_object_event_callback_add(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, 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);
|
|
|
|
evas_object_event_callback_add(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);
|
2009-01-25 15:18:25 -08:00
|
|
|
}
|
2012-01-09 17:00:23 -08:00
|
|
|
_elm_widget_item_disable_hook_set((Elm_Widget_Item *)it, _item_disable);
|
2012-01-03 05:13:39 -08:00
|
|
|
_elm_widget_item_content_set_hook_set((Elm_Widget_Item *)it, _item_content_set);
|
|
|
|
_elm_widget_item_content_get_hook_set((Elm_Widget_Item *)it, _item_content_get);
|
|
|
|
_elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)it, _item_content_unset);
|
|
|
|
_elm_widget_item_text_set_hook_set((Elm_Widget_Item *)it, _item_text_set);
|
|
|
|
_elm_widget_item_text_get_hook_set((Elm_Widget_Item *)it, _item_text_get);
|
2009-01-07 05:49:08 -08:00
|
|
|
return it;
|
|
|
|
}
|
|
|
|
|
2010-10-19 13:19:12 -07:00
|
|
|
static void
|
|
|
|
_elm_list_mode_set_internal(Widget_Data *wd)
|
|
|
|
{
|
|
|
|
if (!wd->scr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (wd->mode == ELM_LIST_LIMIT)
|
|
|
|
{
|
|
|
|
if (!wd->h_mode)
|
|
|
|
{
|
|
|
|
wd->scr_minw = EINA_TRUE;
|
|
|
|
wd->scr_minh = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wd->scr_minw = EINA_FALSE;
|
|
|
|
wd->scr_minh = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (wd->mode == ELM_LIST_EXPAND)
|
|
|
|
{
|
|
|
|
wd->scr_minw = EINA_TRUE;
|
|
|
|
wd->scr_minh = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wd->scr_minw = EINA_FALSE;
|
|
|
|
wd->scr_minh = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
_sizing_eval(wd->self);
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
static void
|
|
|
|
_fix_items(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-03-09 23:30:02 -08:00
|
|
|
if (!wd) return;
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Elm_List_Item *it;
|
2009-01-08 06:29:13 -08:00
|
|
|
Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 };
|
2009-01-08 19:03:36 -08:00
|
|
|
Evas_Coord mw, mh;
|
2009-01-08 06:29:13 -08:00
|
|
|
int i, redo = 0;
|
2009-04-22 21:03:27 -07:00
|
|
|
const char *style = elm_widget_style_get(obj);
|
2010-10-19 13:19:12 -07:00
|
|
|
const char *it_plain = wd->h_mode ? "h_item" : "item";
|
|
|
|
const char *it_odd = wd->h_mode ? "h_item_odd" : "item_odd";
|
|
|
|
const char *it_compress = wd->h_mode ? "h_item_compress" : "item_compress";
|
|
|
|
const char *it_compress_odd = wd->h_mode ? "h_item_compress_odd" : "item_compress_odd";
|
2009-02-25 11:50:45 -08:00
|
|
|
|
2009-12-02 10:59:41 -08:00
|
|
|
if (wd->walking)
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
wd->fix_pending = EINA_TRUE;
|
|
|
|
return;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_walk(wd); // watch out "return" before unwalk!
|
|
|
|
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(wd->items, l, it)
|
2009-01-08 06:29:13 -08:00
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if (it->deleted) continue;
|
|
|
|
if (it->icon)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_get(it->icon, &mw, &mh);
|
|
|
|
if (mw > minw[0]) minw[0] = mw;
|
|
|
|
if (mh > minh[0]) minh[0] = mh;
|
|
|
|
}
|
|
|
|
if (it->end)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_get(it->end, &mw, &mh);
|
|
|
|
if (mw > minw[1]) minw[1] = mw;
|
|
|
|
if (mh > minh[1]) minh[1] = mh;
|
|
|
|
}
|
2009-01-08 06:29:13 -08:00
|
|
|
}
|
2010-10-19 13:19:12 -07:00
|
|
|
|
2009-07-06 23:46:51 -07:00
|
|
|
if ((minw[0] != wd->minw[0]) || (minw[1] != wd->minw[1]) ||
|
2009-01-08 06:29:13 -08:00
|
|
|
(minw[0] != wd->minh[0]) || (minh[1] != wd->minh[1]))
|
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
wd->minw[0] = minw[0];
|
|
|
|
wd->minw[1] = minw[1];
|
|
|
|
wd->minh[0] = minh[0];
|
|
|
|
wd->minh[1] = minh[1];
|
|
|
|
redo = 1;
|
2009-01-08 06:29:13 -08:00
|
|
|
}
|
2009-02-25 11:50:45 -08:00
|
|
|
i = 0;
|
|
|
|
EINA_LIST_FOREACH(wd->items, l, it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2011-04-01 04:26:58 -07:00
|
|
|
if (it->deleted)
|
2010-10-19 13:19:12 -07:00
|
|
|
continue;
|
|
|
|
|
2011-04-01 04:26:58 -07:00
|
|
|
it->even = i & 0x1;
|
|
|
|
if ((it->even != it->is_even) || (!it->fixed) || (redo))
|
|
|
|
{
|
|
|
|
const char *stacking;
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
/* FIXME: separators' themes seem to be b0rked */
|
2011-04-01 04:26:58 -07:00
|
|
|
if (it->is_separator)
|
2011-10-20 18:08:01 -07:00
|
|
|
_elm_theme_object_set(obj, VIEW(it), "separator",
|
2010-10-19 13:19:12 -07:00
|
|
|
wd->h_mode ? "horizontal" : "vertical",
|
|
|
|
style);
|
2011-04-01 04:26:58 -07:00
|
|
|
else if (wd->mode == ELM_LIST_COMPRESS)
|
|
|
|
{
|
|
|
|
if (it->even)
|
2011-10-20 18:08:01 -07:00
|
|
|
_elm_theme_object_set(obj, VIEW(it), "list",
|
2010-10-19 13:19:12 -07:00
|
|
|
it_compress, style);
|
2011-04-01 04:26:58 -07:00
|
|
|
else
|
2011-10-20 18:08:01 -07:00
|
|
|
_elm_theme_object_set(obj, VIEW(it), "list",
|
2010-10-19 13:19:12 -07:00
|
|
|
it_compress_odd, style);
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->even)
|
2011-10-20 18:08:01 -07:00
|
|
|
_elm_theme_object_set(obj, VIEW(it), "list", it_plain,
|
2010-10-19 13:19:12 -07:00
|
|
|
style);
|
2011-04-01 04:26:58 -07:00
|
|
|
else
|
2011-10-20 18:08:01 -07:00
|
|
|
_elm_theme_object_set(obj, VIEW(it), "list", it_odd,
|
2010-10-19 13:19:12 -07:00
|
|
|
style);
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
2011-10-20 18:08:01 -07:00
|
|
|
stacking = edje_object_data_get(VIEW(it), "stacking");
|
2011-04-01 04:26:58 -07:00
|
|
|
if (stacking)
|
|
|
|
{
|
|
|
|
if (!strcmp(stacking, "below"))
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_lower(VIEW(it));
|
2011-04-01 04:26:58 -07:00
|
|
|
else if (!strcmp(stacking, "above"))
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_raise(VIEW(it));
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_text_set(VIEW(it), "elm.text", it->label);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
|
|
|
if ((!it->icon) && (minh[0] > 0))
|
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
it->icon = evas_object_rectangle_add(evas_object_evas_get(VIEW(it)));
|
2011-04-01 04:26:58 -07:00
|
|
|
evas_object_color_set(it->icon, 0, 0, 0, 0);
|
|
|
|
it->dummy_icon = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if ((!it->end) && (minh[1] > 0))
|
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
it->end = evas_object_rectangle_add(evas_object_evas_get(VIEW(it)));
|
2011-04-01 04:26:58 -07:00
|
|
|
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);
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
|
|
|
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);
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.end", it->end);
|
2011-04-01 04:26:58 -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
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_message_signal_process(VIEW(it));
|
2011-04-01 04:26:58 -07:00
|
|
|
if (it->deleted)
|
|
|
|
continue;
|
|
|
|
mw = mh = -1;
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
|
2011-04-01 04:26:58 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_size_hint_min_set(VIEW(it), mw, mh);
|
|
|
|
evas_object_show(VIEW(it));
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
2011-08-25 10:19:22 -07:00
|
|
|
if ((it->selected) || (it->highlighted))
|
2011-04-01 04:26:58 -07:00
|
|
|
{
|
|
|
|
const char *selectraise;
|
|
|
|
|
|
|
|
// 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
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2011-04-01 04:26:58 -07:00
|
|
|
if (it->deleted)
|
|
|
|
continue;
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
2011-04-01 04:26:58 -07:00
|
|
|
if ((selectraise) && (!strcmp(selectraise, "on")))
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_raise(VIEW(it));
|
2011-04-01 04:26:58 -07:00
|
|
|
}
|
2012-01-02 20:17:32 -08:00
|
|
|
if (it->base.disabled)
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled",
|
2010-10-19 13:19:57 -07:00
|
|
|
"elm");
|
|
|
|
|
2011-04-01 04:26:58 -07:00
|
|
|
it->fixed = EINA_TRUE;
|
|
|
|
it->is_even = it->even;
|
|
|
|
}
|
|
|
|
i++;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2009-01-08 19:03:36 -08:00
|
|
|
mw = 0; mh = 0;
|
|
|
|
evas_object_size_hint_min_get(wd->box, &mw, &mh);
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
_elm_list_mode_set_internal(wd);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
_elm_list_unwalk(wd);
|
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2009-09-07 23:20:32 -07:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
2010-03-13 19:48:22 -08:00
|
|
|
if (wd->scr)
|
2010-11-18 02:01:05 -08:00
|
|
|
elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
2010-03-13 19:48:22 -08:00
|
|
|
if (wd->scr)
|
2010-11-18 02:01:05 -08:00
|
|
|
elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
2010-03-13 19:48:22 -08:00
|
|
|
if (wd->scr)
|
2010-11-18 02:01:05 -08:00
|
|
|
elm_smart_scroller_freeze_set(wd->scr, EINA_TRUE);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
2010-03-13 19:48:22 -08:00
|
|
|
if (wd->scr)
|
2010-11-18 02:01:05 -08:00
|
|
|
elm_smart_scroller_freeze_set(wd->scr, EINA_FALSE);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:00 -07:00
|
|
|
static void
|
|
|
|
_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|
|
|
{
|
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_list_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Evas *e;
|
|
|
|
Widget_Data *wd;
|
2010-10-05 12:10:00 -07:00
|
|
|
Evas_Coord minw, minh;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
2011-04-01 04:26:58 -07:00
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "list");
|
2009-05-13 05:21:52 -07:00
|
|
|
elm_widget_type_set(obj, "list");
|
|
|
|
elm_widget_sub_object_add(parent, obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
|
|
|
|
elm_widget_data_set(obj, wd);
|
2011-06-09 03:08:58 -07:00
|
|
|
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
|
2009-01-07 05:49:08 -08:00
|
|
|
elm_widget_del_hook_set(obj, _del_hook);
|
2010-01-15 01:32:43 -08:00
|
|
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
2010-11-18 02:01:05 -08:00
|
|
|
elm_widget_disable_hook_set(obj, _disable_hook);
|
2010-09-27 21:28:14 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2010-09-09 11:53:36 -07:00
|
|
|
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
|
|
|
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
|
|
|
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
2010-10-05 12:10:03 -07:00
|
|
|
elm_widget_event_hook_set(obj, _event_hook);
|
2011-10-19 07:17:14 -07:00
|
|
|
elm_widget_translate_hook_set(obj, _translate_hook);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2011-07-10 19:26:27 -07:00
|
|
|
wd->self = obj;
|
2010-10-05 12:10:00 -07:00
|
|
|
wd->scr = elm_smart_scroller_add(e);
|
|
|
|
elm_smart_scroller_widget_set(wd->scr, obj);
|
2009-09-07 23:20:32 -07:00
|
|
|
elm_widget_resize_object_set(obj, wd->scr);
|
2010-10-05 12:10:00 -07:00
|
|
|
evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2010-10-15 04:51:15 -07:00
|
|
|
_changed_size_hints, obj);
|
2010-10-05 12:10:00 -07:00
|
|
|
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-10-21 12:57:43 -07:00
|
|
|
elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
|
|
|
|
_elm_config->thumbscroll_bounce_enable);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
wd->box = elm_box_add(parent);
|
2011-05-03 21:53:39 -07:00
|
|
|
elm_box_homogeneous_set(wd->box, 1);
|
2010-09-18 19:30:14 -07:00
|
|
|
evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0);
|
2010-10-05 12:10:00 -07:00
|
|
|
elm_widget_on_show_region_hook_set(wd->box, _show_region_hook, obj);
|
|
|
|
elm_widget_sub_object_add(obj, wd->box);
|
|
|
|
elm_smart_scroller_child_set(wd->scr, wd->box);
|
|
|
|
evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
evas_object_show(wd->box);
|
|
|
|
|
2011-03-10 20:54:39 -08:00
|
|
|
_theme_hook(obj);
|
|
|
|
|
2009-01-08 06:29:13 -08:00
|
|
|
wd->mode = ELM_LIST_SCROLL;
|
2009-01-25 15:18:25 -08:00
|
|
|
|
2011-10-20 09:42:42 -07:00
|
|
|
evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
|
|
|
|
evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
|
|
|
|
evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
|
|
|
|
evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
|
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
|
|
|
|
2009-01-25 15:18:25 -08:00
|
|
|
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
2009-09-07 23:20:32 -07:00
|
|
|
evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
|
|
|
|
evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
|
|
|
|
evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
|
|
|
|
evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
|
2009-10-22 15:10:23 -07:00
|
|
|
|
2011-04-21 08:57:03 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2009-01-07 05:49:08 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2009-01-08 06:29:13 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_go(Evas_Object *obj)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-01-08 06:29:13 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-01-08 06:29:13 -08:00
|
|
|
_fix_items(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-01-07 05:49:08 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-01-08 23:35:52 -08:00
|
|
|
wd->multi = multi;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2010-01-05 11:42:04 -08:00
|
|
|
EAPI Eina_Bool
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_list_multi_select_get(const Evas_Object *obj)
|
2010-01-05 11:42:04 -08:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
2010-01-05 11:42:04 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return EINA_FALSE;
|
2010-01-05 11:42:04 -08:00
|
|
|
return wd->multi;
|
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
EAPI void
|
2010-10-19 13:19:12 -07:00
|
|
|
elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
Widget_Data *wd;
|
|
|
|
|
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd)
|
|
|
|
return;
|
|
|
|
if (wd->mode == mode)
|
|
|
|
return;
|
2009-01-08 06:29:13 -08:00
|
|
|
wd->mode = mode;
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
_elm_list_mode_set_internal(wd);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2010-01-05 11:42:04 -08:00
|
|
|
EAPI Elm_List_Mode
|
2010-10-19 13:19:12 -07:00
|
|
|
elm_list_mode_get(const Evas_Object *obj)
|
2010-01-05 11:42:04 -08:00
|
|
|
{
|
2010-10-19 13:19:12 -07:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
|
2010-01-05 11:42:04 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-10-19 13:19:12 -07:00
|
|
|
if (!wd) return ELM_LIST_LAST;
|
2010-01-05 11:42:04 -08:00
|
|
|
return wd->mode;
|
|
|
|
}
|
|
|
|
|
2010-10-19 13:19:12 -07:00
|
|
|
EAPI void
|
|
|
|
elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
|
|
|
|
Widget_Data *wd;
|
2010-10-21 12:57:43 -07:00
|
|
|
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
|
2010-10-19 13:19:12 -07:00
|
|
|
|
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (wd->h_mode == horizontal)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wd->h_mode = horizontal;
|
|
|
|
elm_box_horizontal_set(wd->box, horizontal);
|
|
|
|
|
|
|
|
if (horizontal)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(wd->box, 0.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(wd->box, 0.0, EVAS_HINT_FILL);
|
2010-10-21 12:57:43 -07:00
|
|
|
elm_smart_scroller_bounce_allow_set(wd->scr, bounce, EINA_FALSE);
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0);
|
2010-10-21 12:57:43 -07:00
|
|
|
elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, bounce);
|
2010-10-19 13:19:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
_elm_list_mode_set_internal(wd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-10-20 09:51:26 -07:00
|
|
|
elm_list_horizontal_get(const Evas_Object *obj)
|
2010-10-19 13:19:12 -07:00
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
|
|
|
|
Widget_Data *wd;
|
|
|
|
|
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
return wd->h_mode;
|
|
|
|
}
|
|
|
|
|
2009-07-06 23:46:51 -07:00
|
|
|
EAPI void
|
2009-06-17 08:35:19 -07:00
|
|
|
elm_list_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
|
2009-04-26 18:29:02 -07:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-04-26 18:29:02 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-04-26 18:29:02 -07:00
|
|
|
wd->always_select = always_select;
|
|
|
|
}
|
|
|
|
|
2010-04-08 13:53:01 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_list_always_select_mode_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
return wd->always_select;
|
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (wd->scr)
|
|
|
|
elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if ((!wd) || (!wd->scr)) return;
|
|
|
|
if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
|
|
|
|
(policy_v >= ELM_SCROLLER_POLICY_LAST))
|
|
|
|
return;
|
|
|
|
elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
|
|
|
|
if ((!wd) || (!wd->scr)) return;
|
|
|
|
elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
|
|
|
|
if (policy_h) *policy_h = (Elm_Scroller_Policy) s_policy_h;
|
|
|
|
if (policy_v) *policy_v = (Elm_Scroller_Policy) s_policy_v;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_list_clear(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_List_Item *it;
|
|
|
|
|
|
|
|
if (!wd) return;
|
|
|
|
if (!wd->items) return;
|
|
|
|
|
|
|
|
eina_list_free(wd->selected);
|
|
|
|
wd->selected = NULL;
|
|
|
|
|
|
|
|
if (wd->walking > 0)
|
|
|
|
{
|
|
|
|
Eina_List *n;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wd->items, n, it)
|
|
|
|
{
|
|
|
|
if (it->deleted) continue;
|
|
|
|
it->deleted = EINA_TRUE;
|
|
|
|
wd->to_delete = eina_list_append(wd->to_delete, it);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
_elm_list_walk(wd);
|
|
|
|
|
|
|
|
EINA_LIST_FREE(wd->items, it)
|
|
|
|
{
|
|
|
|
elm_widget_item_pre_notify_del(it);
|
|
|
|
_elm_list_item_free(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
_elm_list_unwalk(wd);
|
|
|
|
|
|
|
|
_fix_items(obj);
|
|
|
|
_sizing_eval(obj);
|
|
|
|
evas_object_unref(obj);
|
|
|
|
}
|
|
|
|
|
2009-01-08 23:35:52 -08:00
|
|
|
EAPI const Eina_List *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_list_items_get(const Evas_Object *obj)
|
2009-01-08 23:35:52 -08:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-01-08 23:35:52 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return NULL;
|
2009-01-08 23:35:52 -08:00
|
|
|
return wd->items;
|
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_list_selected_item_get(const Evas_Object *obj)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-01-07 05:49:08 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return NULL;
|
2012-01-11 19:03:56 -08:00
|
|
|
if (wd->selected) return (Elm_Object_Item *) wd->selected->data;
|
2009-01-07 05:49:08 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const Eina_List *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_list_selected_items_get(const Evas_Object *obj)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-01-07 05:49:08 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return NULL;
|
2009-01-08 23:35:52 -08:00
|
|
|
return wd->selected;
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-01-02 21:28:34 -08:00
|
|
|
elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_List_Item *it = _item_new(obj, label, icon, end, func, data);
|
|
|
|
|
|
|
|
wd->items = eina_list_append(wd->items, it);
|
|
|
|
it->node = eina_list_last(wd->items);
|
|
|
|
elm_box_pack_end(wd->box, VIEW(it));
|
2012-01-11 19:03:56 -08:00
|
|
|
return (Elm_Object_Item *) it;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-01-02 21:28:34 -08:00
|
|
|
elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_List_Item *it = _item_new(obj, label, icon, end, func, data);
|
|
|
|
|
|
|
|
wd->items = eina_list_prepend(wd->items, it);
|
|
|
|
it->node = wd->items;
|
|
|
|
elm_box_pack_start(wd->box, VIEW(it));
|
2012-01-11 19:03:56 -08:00
|
|
|
return (Elm_Object_Item *) it;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_list_item_insert_before(Evas_Object *obj, Elm_Object_Item *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
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2012-01-02 21:28:34 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(before, NULL);
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
Widget_Data *wd;
|
|
|
|
Elm_List_Item *it, *before_it;
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
2012-01-11 19:03:56 -08:00
|
|
|
|
|
|
|
before_it = (Elm_List_Item *) before;
|
|
|
|
if (!before_it->node) return NULL;
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
2012-01-11 19:03:56 -08:00
|
|
|
wd->items = eina_list_prepend_relative_list(wd->items, it, before_it->node);
|
|
|
|
it->node = before_it->node->prev;
|
|
|
|
elm_box_pack_before(wd->box, VIEW(it), VIEW(before_it));
|
|
|
|
return (Elm_Object_Item *) it;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_list_item_insert_after(Evas_Object *obj, Elm_Object_Item *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
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2012-01-02 21:28:34 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(after, NULL);
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
Widget_Data *wd;
|
|
|
|
Elm_List_Item *it, *after_it;
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
2012-01-11 19:03:56 -08:00
|
|
|
|
|
|
|
after_it = (Elm_List_Item *) after;
|
|
|
|
if (!after_it->node) return NULL;
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
it = _item_new(obj, label, icon, end, func, data);
|
2012-01-11 19:03:56 -08:00
|
|
|
wd->items = eina_list_append_relative_list(wd->items, it, after_it->node);
|
|
|
|
it->node = after_it->node->next;
|
|
|
|
elm_box_pack_after(wd->box, VIEW(it), VIEW(after_it));
|
|
|
|
return (Elm_Object_Item *) it;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
2012-01-02 21:28:34 -08:00
|
|
|
elm_list_item_sorted_insert(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Elm_List_Item *it = _item_new(obj, label, icon, end, func, data);
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
wd->items = eina_list_sorted_insert(wd->items, cmp_func, it);
|
|
|
|
l = eina_list_data_find_list(wd->items, it);
|
|
|
|
l = eina_list_next(l);
|
|
|
|
if (!l)
|
|
|
|
{
|
|
|
|
it->node = eina_list_last(wd->items);
|
|
|
|
elm_box_pack_end(wd->box, VIEW(it));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Elm_List_Item *before = eina_list_data_get(l);
|
|
|
|
it->node = before->node->prev;
|
|
|
|
elm_box_pack_before(wd->box, VIEW(it), VIEW(before));
|
|
|
|
}
|
2012-01-11 19:03:56 -08:00
|
|
|
return (Elm_Object_Item *) it;
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
2010-07-01 16:48:10 -07:00
|
|
|
EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_separator_set(Elm_Object_Item *it, Eina_Bool setting)
|
2010-07-01 16:48:10 -07:00
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2012-01-11 19:03:56 -08:00
|
|
|
((Elm_List_Item *) it)->is_separator = !!setting;
|
2010-07-01 16:48:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_separator_get(const Elm_Object_Item *it)
|
2010-07-01 16:48:10 -07:00
|
|
|
{
|
2010-08-03 19:03:45 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
|
2012-01-11 19:03:56 -08:00
|
|
|
return ((Elm_List_Item *) it)->is_separator;
|
2010-07-01 16:48:10 -07:00
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_selected_set(Elm_Object_Item *it, Eina_Bool selected)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-11-18 02:01:05 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_List_Item *item = (Elm_List_Item *) it;
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
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);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_walk(wd);
|
|
|
|
|
2009-01-08 23:35:52 -08:00
|
|
|
if (selected)
|
2009-01-08 06:29:13 -08:00
|
|
|
{
|
2010-10-15 04:51:15 -07:00
|
|
|
if (!wd->multi)
|
|
|
|
{
|
|
|
|
while (wd->selected)
|
2011-04-01 04:26:58 -07:00
|
|
|
_item_unselect(wd->selected->data);
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2012-01-11 19:03:56 -08:00
|
|
|
_item_highlight(item);
|
|
|
|
_item_select(item);
|
2009-01-08 06:29:13 -08:00
|
|
|
}
|
2009-02-25 07:54:26 -08:00
|
|
|
else
|
2012-01-11 19:03:56 -08:00
|
|
|
_item_unselect(item);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
_elm_list_unwalk(wd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2010-01-07 08:34:19 -08:00
|
|
|
EAPI Eina_Bool
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_selected_get(const Elm_Object_Item *it)
|
2010-01-07 08:34:19 -08:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
|
2012-01-11 19:03:56 -08:00
|
|
|
return ((Elm_List_Item *) it)->selected;
|
2010-01-07 08:34:19 -08:00
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_show(Elm_Object_Item *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-11-02 04:26:56 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2011-10-20 18:08:01 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
|
2012-01-11 19:03:56 -08:00
|
|
|
if (!wd) return;
|
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
|
|
|
|
2009-01-08 23:35:52 -08:00
|
|
|
evas_object_geometry_get(wd->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-01-11 19:03:56 -08:00
|
|
|
if (wd->scr) elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2010-10-05 12:10:06 -07:00
|
|
|
EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_bring_in(Elm_Object_Item *it)
|
2010-10-05 12:10:06 -07:00
|
|
|
{
|
2010-11-02 04:26:56 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2011-10-20 18:08:01 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
|
2012-01-11 19:03:56 -08:00
|
|
|
if (!wd) return;
|
2010-10-05 12:10:06 -07:00
|
|
|
Evas_Coord bx, by, bw, bh;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
evas_object_geometry_get(wd->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-01-11 19:03:56 -08:00
|
|
|
if (wd->scr) elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
|
2010-10-05 12:10:06 -07:00
|
|
|
}
|
|
|
|
|
2009-01-07 05:49:08 -08:00
|
|
|
EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_del(Elm_Object_Item *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2010-11-02 04:26:56 -07:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
2011-10-20 18:08:01 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_List_Item *item = (Elm_List_Item *) it;
|
2011-03-09 01:56:18 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
if (item->selected) _item_unselect(item);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
if (wd->walking > 0)
|
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
if (item->deleted) return;
|
|
|
|
item->deleted = EINA_TRUE;
|
|
|
|
wd->to_delete = eina_list_append(wd->to_delete, item);
|
2010-10-15 04:51:15 -07:00
|
|
|
return;
|
2009-12-02 10:59:41 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
wd->items = eina_list_remove_list(wd->items, item->node);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_ref(obj);
|
2009-12-02 10:59:41 -08:00
|
|
|
_elm_list_walk(wd);
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_widget_item_pre_notify_del(item);
|
|
|
|
_elm_list_item_free(item);
|
2009-12-02 10:59:41 -08:00
|
|
|
|
|
|
|
_elm_list_unwalk(wd);
|
2011-03-09 01:56:18 -08:00
|
|
|
evas_object_unref(obj);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EAPI Evas_Object *
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_object_get(const Elm_Object_Item *it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
|
|
|
|
return VIEW(it);
|
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_list_item_prev(const Elm_Object_Item *it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_List_Item *item = (Elm_List_Item *) it;
|
|
|
|
if (item->node->prev) return item->node->prev->data;
|
2012-01-02 21:28:34 -08:00
|
|
|
else return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_list_item_next(const Elm_Object_Item *it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_List_Item *item = (Elm_List_Item *) it;
|
|
|
|
if (item->node->next) return item->node->next->data;
|
2012-01-02 21:28:34 -08:00
|
|
|
else return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_base_get(const Elm_Object_Item *it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
|
|
|
return elm_list_item_object_get(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_object_item_disabled_set(it, disabled);
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_disabled_get(const Elm_Object_Item *it)
|
2012-01-02 21:28:34 -08:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
return elm_object_item_disabled_get(it);
|
2012-01-02 21:28:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
|
2009-04-03 14:52:01 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_object_item_del_cb_set(it, func);
|
2009-04-03 14:52:01 -07:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI void *
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_data_get(const Elm_Object_Item *it)
|
2009-01-07 05:49:08 -08:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
return elm_object_item_data_get(it);
|
2009-01-07 05:49:08 -08:00
|
|
|
}
|
2009-01-08 19:03:36 -08:00
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_icon_get(const Elm_Object_Item *it)
|
2009-01-08 19:03:36 -08:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
return _item_content_get(it, NULL);
|
2009-01-08 19:03:36 -08:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
|
2009-08-13 10:56:07 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
_item_content_set(it, NULL, icon);
|
2009-08-13 10:56:07 -07:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI Evas_Object *
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_end_get(const Elm_Object_Item *it)
|
2009-01-08 19:03:36 -08:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
return _item_content_get(it, "end");
|
2009-01-08 19:03:36 -08:00
|
|
|
}
|
2009-04-03 14:52:01 -07:00
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_end_set(Elm_Object_Item *it, Evas_Object *end)
|
2009-08-13 10:56:07 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
_item_content_set(it, "end", end);
|
2009-08-13 10:56:07 -07:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI const char *
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_label_get(const Elm_Object_Item *it)
|
2009-04-03 14:52:01 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
return _item_text_get(it, NULL);
|
2009-04-03 14:52:01 -07:00
|
|
|
}
|
2009-04-04 08:06:58 -07:00
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-01-11 19:03:56 -08:00
|
|
|
elm_list_item_label_set(Elm_Object_Item *it, const char *text)
|
2009-08-13 10:56:07 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
_item_text_set(it, NULL, text);
|
2009-08-13 10:56:07 -07:00
|
|
|
}
|
|
|
|
|
2012-01-02 21:28:34 -08:00
|
|
|
// XXX: all the below - make elm_object_item*() calls to do these
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_tooltip_text_set(Elm_Object_Item *it, const char *text)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_tooltip_text_set(it, text);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_tooltip_content_cb_set(it, func, data, del_cb);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_tooltip_unset(Elm_Object_Item *it)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_tooltip_unset(it);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_list_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
|
|
|
|
return elm_widget_item_tooltip_window_mode_set(it, disable);
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_list_item_tooltip_window_mode_get(const Elm_Object_Item *it)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
|
|
|
|
return elm_widget_item_tooltip_window_mode_get(it);
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_tooltip_style_set(Elm_Object_Item *it, const char *style)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_tooltip_style_set(it, style);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI const char *
|
|
|
|
elm_list_item_tooltip_style_get(const Elm_Object_Item *it)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
|
|
|
|
return elm_widget_item_tooltip_style_get(it);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_cursor_set(Elm_Object_Item *it, const char *cursor)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_cursor_set(it, cursor);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI const char *
|
|
|
|
elm_list_item_cursor_get(const Elm_Object_Item *it)
|
2010-11-04 17:46:54 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
|
|
|
|
return elm_widget_item_cursor_get(it);
|
2010-11-04 17:46:54 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_cursor_unset(Elm_Object_Item *it)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_cursor_unset(it);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_cursor_style_set(Elm_Object_Item *it, const char *style)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_cursor_style_set(it, style);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI const char *
|
|
|
|
elm_list_item_cursor_style_get(const Elm_Object_Item *it)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
|
|
|
|
return elm_widget_item_cursor_style_get(it);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI void
|
|
|
|
elm_list_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
|
|
|
|
elm_widget_item_cursor_engine_only_set(it, engine_only);
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:03:56 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_list_item_cursor_engine_only_get(const Elm_Object_Item *it)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2012-01-11 19:03:56 -08:00
|
|
|
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
|
|
|
|
return elm_widget_item_cursor_engine_only_get(it);
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|