2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-11-29 06:03:14 -08:00
|
|
|
#include <fnmatch.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-09-18 19:18:22 -07:00
|
|
|
#define EFL_ACCESS_SELECTION_PROTECTED
|
2017-11-15 18:31:26 -08:00
|
|
|
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
|
2014-09-27 22:15:28 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2017-11-11 09:26:53 -08:00
|
|
|
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2009-02-09 03:23:59 -08:00
|
|
|
#include <Elementary.h>
|
2010-09-27 11:18:37 -07:00
|
|
|
#include <Elementary_Cursor.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2009-02-09 03:23:59 -08:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:06:06 -07:00
|
|
|
#include "elm_widget_genlist.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_interface_scrollable.h"
|
2017-11-11 09:26:53 -08:00
|
|
|
#include "efl_ui_focus_parent_provider_gen.eo.h"
|
|
|
|
#include "efl_ui_focus_composition_adapter.eo.h"
|
2017-10-31 23:16:30 -07:00
|
|
|
#include "elm_genlist_item.eo.h"
|
|
|
|
#include "elm_genlist_pan.eo.h"
|
|
|
|
#include "elm_genlist.eo.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_PAN_CLASS ELM_GENLIST_PAN_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 06:29:38 -08:00
|
|
|
#define MY_PAN_CLASS_NAME "Elm_Genlist_Pan"
|
|
|
|
#define MY_PAN_CLASS_NAME_LEGACY "elm_genlist_pan"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_GENLIST_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Genlist"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_genlist"
|
2009-02-09 03:23:59 -08:00
|
|
|
|
2012-03-05 21:02:36 -08:00
|
|
|
// internally allocated
|
2012-07-16 14:56:30 -07:00
|
|
|
#define CLASS_ALLOCATED 0x3a70f11f
|
2012-03-05 21:02:36 -08:00
|
|
|
|
2010-11-17 09:15:28 -08:00
|
|
|
#define MAX_ITEMS_PER_BLOCK 32
|
2011-06-01 20:10:11 -07:00
|
|
|
#define REORDER_EFFECT_TIME 0.5
|
2013-03-26 10:33:01 -07:00
|
|
|
#define MULTI_DOWN_TIME 1.0
|
|
|
|
#define SWIPE_TIME 0.4
|
|
|
|
#define SCR_HOLD_TIME 0.1
|
2016-07-28 19:21:27 -07:00
|
|
|
#define ITEM_QUEUE_MAX 128
|
2010-10-15 04:24:46 -07:00
|
|
|
|
2013-05-07 03:41:15 -07:00
|
|
|
#define ERR_ABORT(_msg) \
|
|
|
|
do { \
|
|
|
|
ERR(_msg); \
|
|
|
|
if (getenv("ELM_ERROR_ABORT")) abort(); \
|
|
|
|
} while (0)
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-07-14 19:13:24 -07:00
|
|
|
#define ELM_PRIV_GENLIST_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_ACTIVATED, "activated", "") \
|
|
|
|
cmd(SIG_CLICKED_DOUBLE, "clicked,double", "") \
|
2014-12-26 08:29:51 -08:00
|
|
|
cmd(SIG_CLICKED_RIGHT, "clicked,right", "") \
|
2013-07-14 19:13:24 -07:00
|
|
|
cmd(SIG_SELECTED, "selected", "") \
|
|
|
|
cmd(SIG_UNSELECTED, "unselected", "") \
|
|
|
|
cmd(SIG_EXPANDED, "expanded", "") \
|
|
|
|
cmd(SIG_CONTRACTED, "contracted", "") \
|
|
|
|
cmd(SIG_EXPAND_REQUEST, "expand,request", "") \
|
|
|
|
cmd(SIG_CONTRACT_REQUEST, "contract,request", "") \
|
|
|
|
cmd(SIG_REALIZED, "realized", "") \
|
|
|
|
cmd(SIG_UNREALIZED, "unrealized", "") \
|
|
|
|
cmd(SIG_DRAG_START_UP, "drag,start,up", "") \
|
|
|
|
cmd(SIG_DRAG_START_DOWN, "drag,start,down", "") \
|
|
|
|
cmd(SIG_DRAG_START_LEFT, "drag,start,left", "") \
|
|
|
|
cmd(SIG_DRAG_START_RIGHT, "drag,start,right", "") \
|
|
|
|
cmd(SIG_DRAG_STOP, "drag,stop", "") \
|
|
|
|
cmd(SIG_DRAG, "drag", "") \
|
|
|
|
cmd(SIG_LONGPRESSED, "longpressed", "") \
|
2014-12-29 01:59:14 -08:00
|
|
|
cmd(SIG_SCROLL, "scroll", "") \
|
2013-07-14 19:13:24 -07:00
|
|
|
cmd(SIG_SCROLL_ANIM_START, "scroll,anim,start", "") \
|
|
|
|
cmd(SIG_SCROLL_ANIM_STOP, "scroll,anim,stop", "") \
|
|
|
|
cmd(SIG_SCROLL_DRAG_START, "scroll,drag,start", "") \
|
|
|
|
cmd(SIG_SCROLL_DRAG_STOP, "scroll,drag,stop", "") \
|
|
|
|
cmd(SIG_EDGE_TOP, "edge,top", "") \
|
|
|
|
cmd(SIG_EDGE_BOTTOM, "edge,bottom", "") \
|
|
|
|
cmd(SIG_EDGE_LEFT, "edge,left", "") \
|
|
|
|
cmd(SIG_EDGE_RIGHT, "edge,right", "") \
|
|
|
|
cmd(SIG_VBAR_DRAG, "vbar,drag", "") \
|
|
|
|
cmd(SIG_VBAR_PRESS, "vbar,press", "") \
|
|
|
|
cmd(SIG_VBAR_UNPRESS, "vbar,unpress", "") \
|
|
|
|
cmd(SIG_HBAR_DRAG, "hbar,drag", "") \
|
|
|
|
cmd(SIG_HBAR_PRESS, "hbar,press", "") \
|
|
|
|
cmd(SIG_HBAR_UNPRESS, "hbar,unpress", "") \
|
|
|
|
cmd(SIG_MULTI_SWIPE_LEFT, "multi,swipe,left", "") \
|
|
|
|
cmd(SIG_MULTI_SWIPE_RIGHT, "multi,swipe,right", "") \
|
|
|
|
cmd(SIG_MULTI_SWIPE_UP, "multi,swipe,up", "") \
|
|
|
|
cmd(SIG_MULTI_SWIPE_DOWN, "multi,swipe,down", "") \
|
|
|
|
cmd(SIG_MULTI_PINCH_OUT, "multi,pinch,out", "") \
|
|
|
|
cmd(SIG_MULTI_PINCH_IN, "multi,pinch,in", "") \
|
|
|
|
cmd(SIG_SWIPE, "swipe", "") \
|
|
|
|
cmd(SIG_MOVED, "moved", "") \
|
|
|
|
cmd(SIG_MOVED_AFTER, "moved,after", "") \
|
|
|
|
cmd(SIG_MOVED_BEFORE, "moved,before", "") \
|
|
|
|
cmd(SIG_INDEX_UPDATE, "index,update", "") \
|
|
|
|
cmd(SIG_TREE_EFFECT_FINISHED , "tree,effect,finished", "") \
|
|
|
|
cmd(SIG_HIGHLIGHTED, "highlighted", "") \
|
|
|
|
cmd(SIG_UNHIGHLIGHTED, "unhighlighted", "") \
|
2014-03-08 08:04:34 -08:00
|
|
|
cmd(SIG_ITEM_FOCUSED, "item,focused", "") \
|
|
|
|
cmd(SIG_ITEM_UNFOCUSED, "item,unfocused", "") \
|
2013-07-14 19:13:24 -07:00
|
|
|
cmd(SIG_PRESSED, "pressed", "") \
|
2015-07-29 13:20:40 -07:00
|
|
|
cmd(SIG_RELEASED, "released", "") \
|
2015-09-23 04:50:05 -07:00
|
|
|
cmd(SIG_CHANGED, "changed", "") \
|
|
|
|
cmd(SIG_FILTER_DONE, "filter,done", "")
|
2013-07-14 19:13:24 -07:00
|
|
|
|
|
|
|
ELM_PRIV_GENLIST_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
2011-05-06 17:30:39 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-07-14 19:13:24 -07:00
|
|
|
ELM_PRIV_GENLIST_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2013-03-20 09:39:51 -07:00
|
|
|
|
2011-05-06 17:30:39 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2013-07-14 19:13:24 -07:00
|
|
|
#undef ELM_PRIV_GENLIST_SIGNALS
|
2011-05-06 17:30:39 -07:00
|
|
|
|
2014-12-29 02:49:19 -08:00
|
|
|
/* edje signals internally used */
|
|
|
|
static const char SIGNAL_ENABLED[] = "elm,state,enabled";
|
|
|
|
static const char SIGNAL_DISABLED[] = "elm,state,disabled";
|
|
|
|
static const char SIGNAL_SELECTED[] = "elm,state,selected";
|
|
|
|
static const char SIGNAL_UNSELECTED[] = "elm,state,unselected";
|
|
|
|
static const char SIGNAL_EXPANDED[] = "elm,state,expanded";
|
|
|
|
static const char SIGNAL_CONTRACTED[] = "elm,state,contracted";
|
|
|
|
static const char SIGNAL_FLIP_ENABLED[] = "elm,state,flip,enabled";
|
2014-12-29 05:27:28 -08:00
|
|
|
static const char SIGNAL_FLIP_DISABLED[] = "elm,state,flip,disabled";
|
2014-12-29 02:49:19 -08:00
|
|
|
static const char SIGNAL_DECORATE_ENABLED[] = "elm,state,decorate,enabled";
|
2014-12-29 04:44:07 -08:00
|
|
|
static const char SIGNAL_DECORATE_DISABLED[] = "elm,state,decorate,disabled";
|
2014-12-29 02:49:19 -08:00
|
|
|
static const char SIGNAL_DECORATE_ENABLED_EFFECT[] = "elm,state,decorate,enabled,effect";
|
|
|
|
static const char SIGNAL_REORDER_ENABLED[] = "elm,state,reorder,enabled";
|
|
|
|
static const char SIGNAL_REORDER_DISABLED[] = "elm,state,reorder,disabled";
|
|
|
|
static const char SIGNAL_REORDER_MODE_SET[] = "elm,state,reorder,mode_set";
|
|
|
|
static const char SIGNAL_REORDER_MODE_UNSET[] = "elm,state,reorder,mode_unset";
|
|
|
|
static const char SIGNAL_CONTRACT_FLIP[] = "elm,state,contract_flip";
|
|
|
|
static const char SIGNAL_SHOW[] = "elm,state,show";
|
|
|
|
static const char SIGNAL_HIDE[] = "elm,state,hide";
|
|
|
|
static const char SIGNAL_FLIP_ITEM[] = "elm,action,flip_item";
|
|
|
|
static const char SIGNAL_ODD[] = "elm,state,odd";
|
|
|
|
static const char SIGNAL_EVEN[] = "elm,state,even";
|
|
|
|
static const char SIGNAL_FOCUSED[] = "elm,state,focused";
|
|
|
|
static const char SIGNAL_UNFOCUSED[] = "elm,state,unfocused";
|
|
|
|
static const char SIGNAL_LIST_SINGLE[] = "elm,state,list,single";
|
|
|
|
static const char SIGNAL_LIST_FIRST[] = "elm,state,list,first";
|
|
|
|
static const char SIGNAL_LIST_LAST[] = "elm,state,list,last";
|
|
|
|
static const char SIGNAL_LIST_MIDDLE[] = "elm,state,list,middle";
|
|
|
|
static const char SIGNAL_GROUP_SINGLE[] = "elm,state,group,single";
|
|
|
|
static const char SIGNAL_GROUP_FIRST[] = "elm,state,group,first";
|
|
|
|
static const char SIGNAL_GROUP_LAST[] = "elm,state,group,last";
|
|
|
|
static const char SIGNAL_GROUP_MIDDLE[] = "elm,state,group,middle";
|
|
|
|
|
2015-01-08 06:23:44 -08:00
|
|
|
static void _item_unrealize(Elm_Gen_Item *it);
|
2015-01-14 23:12:37 -08:00
|
|
|
static Eina_Bool _item_select(Elm_Gen_Item *it);
|
2015-02-12 00:31:00 -08:00
|
|
|
static void _item_unselect(Elm_Gen_Item *it);
|
|
|
|
static void _item_highlight(Elm_Gen_Item *it);
|
2014-04-16 01:18:22 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
|
2014-12-29 05:51:39 -08:00
|
|
|
static void _calc_job(void *data);
|
2016-04-19 02:41:43 -07:00
|
|
|
static void _update_job(void *data);
|
2014-12-29 05:51:39 -08:00
|
|
|
static Eina_Bool _item_block_recalc(Item_Block *itb, int in, Eina_Bool qadd);
|
|
|
|
static void _item_mouse_callbacks_add(Elm_Gen_Item *it, Evas_Object *view);
|
|
|
|
static void _item_mouse_callbacks_del(Elm_Gen_Item *it, Evas_Object *view);
|
|
|
|
static void _access_activate_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *part_obj EINA_UNUSED,
|
|
|
|
Elm_Object_Item *item);
|
|
|
|
static void _decorate_item_set(Elm_Gen_Item *);
|
2015-01-08 06:03:52 -08:00
|
|
|
static void _internal_elm_genlist_clear(Evas_Object *obj);
|
2015-09-23 04:50:05 -07:00
|
|
|
static Eina_Bool _item_filtered_get(Elm_Gen_Item *it);
|
2014-04-16 01:18:22 -07:00
|
|
|
|
2016-01-28 17:07:34 -08:00
|
|
|
static void _elm_genlist_tree_effect_stop(Elm_Genlist_Data *sd);
|
|
|
|
static Eina_Bool _elm_genlist_tree_effect_setup(Elm_Genlist_Data *sd);
|
|
|
|
|
2017-02-21 20:53:03 -08:00
|
|
|
static void _item_expanded_set_noevent(Elm_Gen_Item *it, Eina_Bool expanded);
|
|
|
|
|
2017-09-14 20:11:50 -07:00
|
|
|
static Eina_Bool _item_process(Elm_Genlist_Data *sd, Elm_Gen_Item *it);
|
|
|
|
static void _item_process_post(Elm_Genlist_Data *sd, Elm_Gen_Item *it);
|
|
|
|
|
2014-04-16 01:18:22 -07:00
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"select", _key_action_select},
|
|
|
|
{"escape", _key_action_escape},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2015-12-01 23:23:39 -08:00
|
|
|
static void
|
|
|
|
_size_cache_free(void *data)
|
|
|
|
{
|
|
|
|
if(data) free(data);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_is_no_select(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
|
|
|
|
(it->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_pan_elm_pan_pos_set(Eo *obj, Elm_Genlist_Pan_Data *psd, Evas_Coord x, Evas_Coord y)
|
2010-10-01 12:03:12 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Item_Block *itb;
|
2010-10-01 12:03:12 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Data *sd = psd->wsd;
|
2010-10-01 12:03:12 -07:00
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
if ((x == sd->pan_x) && (y == sd->pan_y)) return;
|
|
|
|
sd->pan_x = x;
|
|
|
|
sd->pan_y = y;
|
2010-10-01 12:03:12 -07:00
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2010-10-01 12:03:12 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((itb->y + itb->h) > y)
|
2010-10-05 12:09:55 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Eina_List *l2;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l2, it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if ((itb->y + it->y) >= y)
|
|
|
|
{
|
2014-03-08 11:09:22 -08:00
|
|
|
sd->anchor_item = it;
|
|
|
|
sd->anchor_y = -(itb->y + it->y - y);
|
2012-07-16 14:56:30 -07:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2010-10-05 12:09:55 -07:00
|
|
|
}
|
2010-10-01 12:03:12 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
done:
|
2014-03-08 11:09:22 -08:00
|
|
|
if (!sd->reorder_move_animator) evas_object_smart_changed(obj);
|
2010-10-01 12:03:12 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_pan_elm_pan_pos_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-10-27 07:38:54 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (x) *x = psd->wsd->pan_x;
|
|
|
|
if (y) *y = psd->wsd->pan_y;
|
2010-10-27 07:38:54 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_pan_elm_pan_pos_max_get(const Eo *obj, Elm_Genlist_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-10-05 12:09:55 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Coord ow, oh;
|
2010-10-05 12:09:55 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
|
|
|
|
ow = psd->wsd->minw - ow;
|
|
|
|
if (ow < 0) ow = 0;
|
|
|
|
oh = psd->wsd->minh - oh;
|
|
|
|
if (oh < 0) oh = 0;
|
|
|
|
if (x) *x = ow;
|
|
|
|
if (y) *y = oh;
|
2010-10-05 12:09:55 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_pan_elm_pan_pos_min_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *_pd EINA_UNUSED, Evas_Coord *x, Evas_Coord *y)
|
2010-10-05 12:09:55 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
2010-10-05 12:09:55 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_pan_elm_pan_content_size_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *psd, Evas_Coord *w, Evas_Coord *h)
|
2010-10-05 12:09:55 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (w) *w = psd->wsd->minw;
|
|
|
|
if (h) *h = psd->wsd->minh;
|
2010-10-05 12:09:55 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_genlist_pan_efl_canvas_group_group_del(Eo *obj, Elm_Genlist_Pan_Data *psd)
|
2010-10-05 12:09:55 -07:00
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(psd->resize_job);
|
2010-10-01 12:03:12 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_PAN_CLASS));
|
2009-02-09 03:23:59 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_genlist_pan_efl_gfx_entity_position_set(Eo *obj, Elm_Genlist_Pan_Data *psd, Eina_Position2D pos)
|
2009-11-13 14:22:05 -08:00
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
|
2016-10-10 20:39:05 -07:00
|
|
|
return;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_PAN_CLASS), pos);
|
2016-10-10 20:39:05 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
psd->wsd->pan_changed = EINA_TRUE;
|
|
|
|
evas_object_smart_changed(obj);
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(psd->wsd->calc_job, ecore_job_del);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2009-02-09 03:23:59 -08:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_pan_smart_resize_job(void *data)
|
2009-02-09 03:23:59 -08:00
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_PAN_DATA_GET(data, psd);
|
2010-10-15 04:51:15 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
elm_layout_sizing_eval(psd->wobj);
|
2012-07-16 14:56:30 -07:00
|
|
|
psd->resize_job = NULL;
|
2009-02-09 03:23:59 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_genlist_pan_efl_gfx_entity_size_set(Eo *obj, Elm_Genlist_Pan_Data *psd, Eina_Size2D size)
|
2011-02-13 02:28:55 -08:00
|
|
|
{
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
Elm_Genlist_Data *sd = psd->wsd;
|
2017-09-15 02:37:25 -07:00
|
|
|
Eina_Size2D old;
|
2009-02-09 03:23:59 -08:00
|
|
|
|
2017-09-15 02:37:25 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h))
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
return;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
old = efl_gfx_entity_size_get(obj);
|
2017-09-15 02:37:25 -07:00
|
|
|
if ((old.w == size.w) && (old.h == size.h)) goto super; // should already be intercepted above
|
|
|
|
if ((sd->mode == ELM_LIST_COMPRESS) && (old.w != size.w))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
/* fix me later */
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(psd->resize_job);
|
2012-07-16 14:56:30 -07:00
|
|
|
psd->resize_job =
|
2013-04-24 04:41:37 -07:00
|
|
|
ecore_job_add(_elm_genlist_pan_smart_resize_job, obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2014-03-08 11:09:22 -08:00
|
|
|
sd->pan_changed = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_smart_changed(obj);
|
2014-03-08 11:09:22 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-05-02 10:12:52 -07:00
|
|
|
// if the width changed we may have to resize content if scrollbar went
|
|
|
|
// away or appeared to queue a job to deal with it. it should settle in
|
2012-08-03 05:49:37 -07:00
|
|
|
// the end to a steady-state
|
2017-09-15 02:37:25 -07:00
|
|
|
if (old.w != size.w)
|
2014-03-08 11:09:22 -08:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, psd->wobj);
|
2012-08-03 05:49:37 -07:00
|
|
|
else
|
2014-03-08 11:09:22 -08:00
|
|
|
sd->calc_job = NULL;
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
|
|
|
|
super:
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_PAN_CLASS), size);
|
2011-10-19 07:17:14 -07:00
|
|
|
}
|
|
|
|
|
2014-07-26 22:32:12 -07:00
|
|
|
static void
|
|
|
|
_item_text_realize(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *target,
|
|
|
|
Eina_List **source,
|
|
|
|
const char *parts)
|
|
|
|
{
|
2015-01-01 23:54:01 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
const char *key;
|
|
|
|
char *s;
|
2015-05-07 00:21:57 -07:00
|
|
|
char buf[256];
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2015-01-01 23:54:01 -08:00
|
|
|
if (!it->itc->func.text_get) return;
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2015-01-01 23:54:01 -08:00
|
|
|
if (!(*source))
|
|
|
|
*source = elm_widget_stringlist_get
|
|
|
|
(edje_object_data_get(target, "texts"));
|
|
|
|
EINA_LIST_FOREACH(*source, l, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD)) continue;
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2015-01-01 23:54:01 -08:00
|
|
|
s = it->itc->func.text_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set(target, key, s);
|
|
|
|
free(s);
|
2015-05-07 00:21:57 -07:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,visible", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
2015-01-01 23:54:01 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(target, key, "");
|
2014-07-26 22:32:12 -07:00
|
|
|
}
|
2015-03-26 04:03:10 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_access_i18n_name_changed_signal_emit(EO_OBJ(it));
|
2014-07-26 22:32:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-08 22:34:58 -07:00
|
|
|
static void
|
|
|
|
_widget_calculate_recursive(Eo *obj)
|
|
|
|
{
|
|
|
|
Elm_Widget_Smart_Data *pd = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
|
2018-01-07 20:55:35 -08:00
|
|
|
if (!efl_isa(obj, EFL_UI_WIDGET_CLASS)) return;
|
2017-06-08 22:34:58 -07:00
|
|
|
|
2018-01-07 20:55:35 -08:00
|
|
|
pd = efl_data_scope_get(obj, EFL_UI_WIDGET_CLASS);
|
2018-01-22 02:10:48 -08:00
|
|
|
if (!pd || !pd->resize_obj)
|
|
|
|
return;
|
2017-06-08 22:34:58 -07:00
|
|
|
|
2017-06-12 10:13:02 -07:00
|
|
|
if (!efl_canvas_group_need_recalculate_get(obj) &&
|
|
|
|
!efl_canvas_group_need_recalculate_get(pd->resize_obj))
|
|
|
|
return;
|
|
|
|
|
2017-06-08 22:34:58 -07:00
|
|
|
EINA_LIST_FOREACH(pd->subobjs, l, child)
|
|
|
|
_widget_calculate_recursive(child);
|
|
|
|
|
|
|
|
efl_canvas_group_calculate(obj);
|
|
|
|
}
|
|
|
|
|
2015-01-02 02:59:39 -08:00
|
|
|
static void
|
2014-07-26 22:32:12 -07:00
|
|
|
_item_content_realize(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *target,
|
2015-01-02 02:59:39 -08:00
|
|
|
Eina_List **contents,
|
2015-01-01 23:17:16 -08:00
|
|
|
const char *src,
|
2018-08-02 06:42:06 -07:00
|
|
|
const char *parts,
|
|
|
|
Eina_Bool calc)
|
2014-07-26 22:32:12 -07:00
|
|
|
{
|
2015-01-02 02:59:39 -08:00
|
|
|
Evas_Object *content;
|
2015-05-07 00:21:57 -07:00
|
|
|
char buf[256];
|
2016-04-30 10:48:33 -07:00
|
|
|
Eina_List *source;
|
|
|
|
const char *key;
|
2015-01-02 02:59:39 -08:00
|
|
|
|
2017-11-11 09:26:53 -08:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2015-01-01 23:17:16 -08:00
|
|
|
if (!parts)
|
|
|
|
{
|
2015-01-02 02:59:39 -08:00
|
|
|
EINA_LIST_FREE(*contents, content)
|
|
|
|
evas_object_del(content);
|
2015-01-01 23:17:16 -08:00
|
|
|
}
|
2016-04-30 10:48:33 -07:00
|
|
|
if ((!it->itc->func.content_get) &&
|
|
|
|
((it->itc->version < 3) || (!it->itc->func.reusable_content_get))) return;
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2016-04-30 10:48:33 -07:00
|
|
|
source = elm_widget_stringlist_get(edje_object_data_get(target, src));
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2016-04-30 10:48:33 -07:00
|
|
|
EINA_LIST_FREE(source, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Evas_Object *old = NULL;
|
|
|
|
old = edje_object_part_swallow_get(target, key);
|
|
|
|
|
|
|
|
// Reuse content by popping from the cache
|
|
|
|
content = NULL;
|
|
|
|
if (it->itc->func.reusable_content_get)
|
|
|
|
content = it->itc->func.reusable_content_get(
|
|
|
|
(void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key, old);
|
|
|
|
if (!content)
|
2014-07-26 22:32:12 -07:00
|
|
|
{
|
2016-04-30 10:48:33 -07:00
|
|
|
// Call the content get
|
|
|
|
if (it->itc->func.content_get)
|
|
|
|
content = it->itc->func.content_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
2016-04-30 10:53:46 -07:00
|
|
|
if (!content) goto out;
|
2016-04-30 10:48:33 -07:00
|
|
|
}
|
2016-01-04 01:02:11 -08:00
|
|
|
|
2016-04-30 10:48:33 -07:00
|
|
|
if (content != old)
|
|
|
|
{
|
2017-11-11 09:26:53 -08:00
|
|
|
eina_hash_add(sd->content_item_map, &content, it->base->eo_obj);
|
2017-06-08 22:34:58 -07:00
|
|
|
// FIXME: Genlist item doesn't update its size when the size of
|
|
|
|
// content is changed, so deferred calculation for content should
|
|
|
|
// be performed before realization.
|
2018-01-07 20:55:35 -08:00
|
|
|
if (efl_isa(content, EFL_UI_WIDGET_CLASS))
|
2014-07-26 22:32:12 -07:00
|
|
|
{
|
2017-06-08 22:34:58 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(content, wd);
|
2017-06-12 10:13:02 -07:00
|
|
|
|
|
|
|
// FIXME : Layout need sizing eval before group calculate
|
2018-04-06 09:15:31 -07:00
|
|
|
if (efl_class_get(content) == EFL_UI_LAYOUT_OBJECT_CLASS)
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(content);
|
2017-06-12 10:13:02 -07:00
|
|
|
|
|
|
|
_widget_calculate_recursive(content);
|
2017-03-09 22:18:57 -08:00
|
|
|
}
|
2016-02-12 11:14:13 -08:00
|
|
|
|
2016-04-30 10:48:33 -07:00
|
|
|
if (!edje_object_part_swallow(target, key, content))
|
|
|
|
{
|
|
|
|
ERR("%s (%p) can not be swallowed into %s",
|
|
|
|
evas_object_type_get(content), content, key);
|
2016-04-30 10:53:46 -07:00
|
|
|
evas_object_del(content);
|
|
|
|
goto out;
|
2014-07-26 22:32:12 -07:00
|
|
|
}
|
2016-04-30 10:48:33 -07:00
|
|
|
elm_widget_sub_object_add(WIDGET(it), content);
|
2018-06-12 01:56:43 -07:00
|
|
|
|
|
|
|
if (elm_widget_is(content))
|
|
|
|
{
|
2018-08-02 06:42:06 -07:00
|
|
|
if (!calc)
|
|
|
|
_elm_widget_full_eval(content);
|
2018-06-12 01:56:43 -07:00
|
|
|
}
|
2016-04-30 10:48:33 -07:00
|
|
|
}
|
|
|
|
*contents = eina_list_append(*contents, content);
|
2016-02-12 11:14:13 -08:00
|
|
|
|
2016-04-30 10:48:33 -07:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
|
|
|
elm_widget_disabled_set(content, EINA_TRUE);
|
2015-05-07 00:21:57 -07:00
|
|
|
|
2016-04-30 10:48:33 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,visible", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
2016-04-30 10:53:46 -07:00
|
|
|
out:
|
2016-04-30 10:48:33 -07:00
|
|
|
if (old && content != old)
|
|
|
|
{
|
|
|
|
*contents = eina_list_remove(*contents, old);
|
|
|
|
evas_object_del(old);
|
2017-11-11 09:26:53 -08:00
|
|
|
eina_hash_del_by_key(sd->content_item_map, &old);
|
2014-07-26 22:32:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-02 00:34:05 -08:00
|
|
|
_item_state_realize(Elm_Gen_Item *it, Evas_Object *target, const char *parts)
|
2014-07-26 22:32:12 -07:00
|
|
|
{
|
2015-01-02 00:34:05 -08:00
|
|
|
Eina_List *src;
|
|
|
|
const char *key;
|
|
|
|
char buf[4096];
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2015-01-02 00:34:05 -08:00
|
|
|
if (!it->itc->func.state_get) return;
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2015-01-02 00:34:05 -08:00
|
|
|
src = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
|
|
|
|
EINA_LIST_FREE(src, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD)) continue;
|
2014-07-26 22:32:12 -07:00
|
|
|
|
2015-01-02 00:34:05 -08:00
|
|
|
Eina_Bool on = it->itc->func.state_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
|
|
|
|
if (on)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
2014-07-26 22:32:12 -07:00
|
|
|
}
|
|
|
|
}
|
2015-01-02 00:34:05 -08:00
|
|
|
edje_object_message_signal_process(target);
|
2014-07-26 22:32:12 -07:00
|
|
|
}
|
|
|
|
|
2014-07-26 21:44:51 -07:00
|
|
|
/**
|
|
|
|
* Apply the right style for the created item view.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
_view_style_update(Elm_Gen_Item *it, Evas_Object *view, const char *style)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
const char *stacking_even;
|
|
|
|
const char *stacking;
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
// FIXME: There exists
|
|
|
|
// item, item_compress, item_odd, item_compress_odd,
|
|
|
|
// tree, tree_compress, tree_odd, tree_odd_compress
|
|
|
|
// But those used case by case. :-(
|
|
|
|
// Anyway, belows codes are for backward..
|
|
|
|
if (it->decorate_it_set)
|
|
|
|
{
|
|
|
|
// item, item_compress, item_odd, item_compress_odd
|
|
|
|
strncpy(buf, "item", sizeof(buf));
|
|
|
|
if (sd->mode == ELM_LIST_COMPRESS)
|
|
|
|
strncat(buf, "_compress", sizeof(buf) - strlen(buf) - 1);
|
|
|
|
|
|
|
|
if (it->item->order_num_in & 0x1)
|
|
|
|
strncat(buf, "_odd", sizeof(buf) - strlen(buf) - 1);
|
|
|
|
strncat(buf, "/", sizeof(buf) - strlen(buf) - 1);
|
|
|
|
strncat(buf, style, sizeof(buf) - strlen(buf) - 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// item, item_compress, tree, tree_compress
|
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_TREE)
|
|
|
|
snprintf(buf, sizeof(buf), "tree%s/%s",
|
|
|
|
sd->mode == ELM_LIST_COMPRESS ? "_compress" :
|
|
|
|
"", style ? : "default");
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "item%s/%s",
|
|
|
|
sd->mode == ELM_LIST_COMPRESS ? "_compress" :
|
|
|
|
"",style ? : "default");
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply th_ret =
|
2017-06-01 18:32:04 -07:00
|
|
|
elm_widget_theme_object_set(WIDGET(it), view, "genlist", buf,
|
|
|
|
elm_widget_style_get(WIDGET(it)));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (th_ret == EFL_UI_THEME_APPLY_FAILED)
|
2014-07-26 21:44:51 -07:00
|
|
|
{
|
|
|
|
ERR("%s is not a valid genlist item style. "
|
|
|
|
"Automatically falls back into default style.",
|
|
|
|
style);
|
|
|
|
elm_widget_theme_object_set
|
2015-06-30 02:07:02 -07:00
|
|
|
(WIDGET(it), view, "genlist", "item/default", "default");
|
2014-07-26 21:44:51 -07:00
|
|
|
}
|
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
edje_object_mirrored_set(view, efl_ui_mirrored_get(WIDGET(it)));
|
2018-04-05 01:47:26 -07:00
|
|
|
edje_object_scale_set(view, efl_gfx_entity_scale_get(WIDGET(it))
|
2014-07-26 21:44:51 -07:00
|
|
|
* elm_config_scale_get());
|
|
|
|
|
2015-06-30 02:07:02 -07:00
|
|
|
stacking_even = edje_object_data_get(view, "stacking_even");
|
2014-07-26 21:44:51 -07:00
|
|
|
if (!stacking_even) stacking_even = "above";
|
|
|
|
it->item->stacking_even = !!strcmp("above", stacking_even);
|
|
|
|
|
2015-06-30 02:07:02 -07:00
|
|
|
stacking = edje_object_data_get(view, "stacking");
|
2014-07-26 21:44:51 -07:00
|
|
|
if (!stacking) stacking = "yes";
|
|
|
|
it->item->nostacking = !!strcmp("yes", stacking);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a VIEW(it) during _item_realize()
|
|
|
|
*/
|
|
|
|
static Evas_Object *
|
|
|
|
_view_create(Elm_Gen_Item *it, const char *style)
|
|
|
|
{
|
|
|
|
Evas_Object *view = edje_object_add(evas_object_evas_get(WIDGET(it)));
|
2017-02-22 22:52:31 -08:00
|
|
|
evas_object_smart_member_add(view, it->item->wsd->pan_obj);
|
2014-07-26 21:44:51 -07:00
|
|
|
elm_widget_sub_object_add(WIDGET(it), view);
|
2018-04-05 01:47:26 -07:00
|
|
|
edje_object_scale_set(view, efl_gfx_entity_scale_get(WIDGET(it)) *
|
2014-07-26 21:44:51 -07:00
|
|
|
elm_config_scale_get());
|
|
|
|
|
|
|
|
_view_style_update(it, view, style);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
2014-07-27 01:19:57 -07:00
|
|
|
static void
|
2015-01-02 02:04:34 -08:00
|
|
|
_view_clear(Evas_Object *view, Eina_List **texts, Eina_List **contents)
|
2014-07-27 01:19:57 -07:00
|
|
|
{
|
|
|
|
const char *part;
|
|
|
|
Evas_Object *c;
|
|
|
|
const Eina_List *l;
|
|
|
|
|
2015-01-10 00:47:14 -08:00
|
|
|
EINA_LIST_FOREACH(*texts, l, part)
|
|
|
|
edje_object_part_text_set(view, part, NULL);
|
|
|
|
ELM_SAFE_FREE(*texts, elm_widget_stringlist_free);
|
2014-07-27 01:19:57 -07:00
|
|
|
|
2016-02-12 11:14:13 -08:00
|
|
|
if (contents)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(*contents, c)
|
|
|
|
evas_object_del(c);
|
|
|
|
}
|
2014-07-27 01:19:57 -07:00
|
|
|
}
|
|
|
|
|
2009-02-09 03:23:59 -08:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_scroll(Elm_Genlist_Data *sd)
|
2009-02-09 03:23:59 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Coord gith = 0;
|
|
|
|
Elm_Gen_Item *it = NULL;
|
|
|
|
Evas_Coord ow, oh, dx = 0, dy = 0, dw = 0, dh = 0;
|
2012-03-15 04:18:17 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->show_item) return;
|
2012-03-15 04:18:17 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &ow, &oh);
|
|
|
|
it = sd->show_item;
|
|
|
|
dx = it->x + it->item->block->x;
|
|
|
|
dy = it->y + it->item->block->y;
|
|
|
|
dw = it->item->block->w;
|
|
|
|
dh = oh;
|
2012-03-15 04:18:17 -07:00
|
|
|
|
2016-06-23 10:09:13 -07:00
|
|
|
if (dw < 1) return;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
switch (sd->scroll_to_type)
|
2010-11-20 00:43:43 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_TOP:
|
|
|
|
if (it->item->group_item) gith = it->item->group_item->item->h;
|
|
|
|
dy -= gith;
|
|
|
|
break;
|
2010-12-07 11:18:14 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
|
|
|
|
dy += ((it->item->h / 2) - (oh / 2));
|
|
|
|
break;
|
2010-12-07 11:18:14 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_IN:
|
|
|
|
default:
|
|
|
|
if ((sd->expanded_item) &&
|
|
|
|
((sd->show_item->y + sd->show_item->item->block->y
|
|
|
|
+ sd->show_item->item->h) -
|
|
|
|
(sd->expanded_item->y + sd->expanded_item->item->block->y) > oh))
|
|
|
|
{
|
|
|
|
it = sd->expanded_item;
|
|
|
|
if (it->item->group_item) gith = it->item->group_item->item->h;
|
|
|
|
dx = it->x + it->item->block->x;
|
|
|
|
dy = it->y + it->item->block->y - gith;
|
|
|
|
dw = it->item->block->w;
|
2010-12-07 11:18:14 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((it->item->group_item) &&
|
|
|
|
(sd->pan_y > (it->y + it->item->block->y)))
|
|
|
|
gith = it->item->group_item->item->h;
|
|
|
|
dy -= gith;
|
|
|
|
dh = it->item->h;
|
|
|
|
}
|
|
|
|
break;
|
2010-05-07 06:21:45 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->bring_in)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_region_bring_in(sd->obj, dx, dy, dw, dh);
|
2010-09-28 01:46:08 -07:00
|
|
|
else
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show
|
|
|
|
(sd->obj, dx, dy, dw, dh);
|
2012-03-15 04:18:17 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->show_me = EINA_FALSE;
|
|
|
|
sd->show_item = NULL;
|
|
|
|
sd->auto_scroll_enabled = EINA_FALSE;
|
|
|
|
sd->check_scroll = EINA_FALSE;
|
2009-02-09 03:23:59 -08:00
|
|
|
}
|
|
|
|
|
2011-04-06 07:46:39 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_unrealize(Elm_Gen_Item *it,
|
|
|
|
Eina_Bool calc)
|
2011-04-06 07:46:39 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->realized) return;
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->reorder_it == it)
|
2014-12-30 00:56:24 -08:00
|
|
|
{
|
|
|
|
WRN("reordering item should not be unrealized");
|
|
|
|
return;
|
|
|
|
}
|
2009-02-16 23:50:35 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(WIDGET(it)));
|
|
|
|
if (!calc)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_UNREALIZED, EO_OBJ(it));
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2011-12-26 06:30:21 -08:00
|
|
|
|
2016-02-12 11:14:13 -08:00
|
|
|
_view_clear(VIEW(it), &(it->texts), NULL);
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->item_focus_chain, eina_list_free);
|
2013-02-20 02:00:49 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_track_cancel(EO_OBJ(it));
|
2013-09-13 00:20:40 -07:00
|
|
|
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unrealize(it);
|
2011-12-26 06:30:21 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->realized = EINA_FALSE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
2013-09-12 22:19:41 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
|
2011-12-26 06:30:21 -08:00
|
|
|
}
|
|
|
|
|
2012-05-29 02:04:16 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_block_unrealize(Item_Block *itb)
|
2012-05-29 02:04:16 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
const Eina_List *l;
|
|
|
|
Eina_Bool dragging = EINA_FALSE;
|
2012-05-29 02:04:16 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!itb->realized) return;
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get((itb->sd)->obj));
|
2010-03-02 00:47:40 -08:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2010-03-02 00:47:40 -08:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if (itb->must_recalc || !(it->item->type & ELM_GENLIST_ITEM_GROUP))
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->dragging)
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
dragging = EINA_TRUE;
|
|
|
|
it->want_unrealize = EINA_TRUE;
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
else if (it != itb->sd->pin_item)
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_FALSE);
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2010-03-02 00:47:40 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!dragging)
|
2012-05-09 23:30:49 -07:00
|
|
|
{
|
2018-08-02 06:42:06 -07:00
|
|
|
Eina_List *n;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
itb->realized = EINA_FALSE;
|
|
|
|
itb->want_unrealize = EINA_TRUE;
|
2018-08-02 06:42:06 -07:00
|
|
|
|
|
|
|
efl_ui_focus_manager_calc_unregister(itb->sd->obj, itb->adapter);
|
|
|
|
efl_del(itb->adapter);
|
|
|
|
itb->adapter = NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(itb->items, n, it)
|
|
|
|
{
|
|
|
|
efl_ui_focus_manager_calc_unregister(itb->sd->obj, EO_OBJ(it));
|
|
|
|
}
|
2012-05-09 23:30:49 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
itb->want_unrealize = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get((itb->sd)->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj));
|
2010-03-02 00:47:40 -08:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_must_recalc_idler(void *data)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, data);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->must_recalc_idler = NULL;
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
2010-03-02 00:47:40 -08:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_calc_job(void *data)
|
2010-03-02 00:47:40 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
int in = 0;
|
|
|
|
Item_Block *itb, *chb = NULL;
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool minw_change = EINA_FALSE;
|
|
|
|
Eina_Bool did_must_recalc = EINA_FALSE;
|
2018-06-27 13:53:55 -07:00
|
|
|
Evas_Coord minw = -1, minh = 0, y = 0, ow = 0, vw = 0;
|
2011-05-29 19:31:21 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &ow, &sd->h);
|
2012-08-15 02:52:26 -07:00
|
|
|
if (sd->mode == ELM_LIST_COMPRESS)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(sd->obj, NULL, NULL, &vw, NULL);
|
2012-08-15 02:52:26 -07:00
|
|
|
|
2012-08-03 05:49:37 -07:00
|
|
|
if (sd->w != ow) sd->w = ow;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2010-11-24 23:07:39 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool show_me = EINA_FALSE;
|
|
|
|
|
|
|
|
itb->num = in;
|
|
|
|
show_me = itb->show_me;
|
|
|
|
itb->show_me = EINA_FALSE;
|
|
|
|
if (chb)
|
|
|
|
{
|
|
|
|
if (itb->realized) _item_block_unrealize(itb);
|
|
|
|
}
|
|
|
|
if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
|
|
|
|
{
|
|
|
|
if (itb->must_recalc)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2014-10-07 10:18:33 -07:00
|
|
|
it->item->mincalcd = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
itb->changed = EINA_TRUE;
|
2014-10-07 10:18:33 -07:00
|
|
|
did_must_recalc = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (itb->realized) _item_block_unrealize(itb);
|
|
|
|
itb->must_recalc = EINA_FALSE;
|
|
|
|
}
|
|
|
|
show_me = _item_block_recalc(itb, in, EINA_FALSE);
|
|
|
|
chb = itb;
|
|
|
|
}
|
|
|
|
itb->y = y;
|
|
|
|
itb->x = 0;
|
|
|
|
minh += itb->minh;
|
2014-10-07 10:18:56 -07:00
|
|
|
if (minw < itb->minw)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
minw = itb->minw;
|
2014-10-07 10:18:56 -07:00
|
|
|
if (minw != -1)
|
|
|
|
minw_change = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2012-08-15 02:52:26 -07:00
|
|
|
if ((sd->mode == ELM_LIST_COMPRESS) && (minw > vw))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
minw = vw;
|
|
|
|
minw_change = EINA_TRUE;
|
|
|
|
}
|
|
|
|
itb->w = minw;
|
|
|
|
itb->h = itb->minh;
|
|
|
|
y += itb->h;
|
2017-02-23 00:10:16 -08:00
|
|
|
in += itb->vis_count;
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((show_me) && (sd->show_item) && (!sd->show_item->item->queued))
|
|
|
|
sd->check_scroll = EINA_TRUE;
|
2010-11-24 23:07:39 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (minw_change)
|
2012-04-20 03:50:42 -07:00
|
|
|
{
|
2012-08-14 03:13:19 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2012-04-20 03:50:42 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
itb->minw = minw;
|
|
|
|
itb->w = itb->minw;
|
2012-04-20 03:50:42 -07:00
|
|
|
}
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((chb) && (EINA_INLIST_GET(chb)->next))
|
2012-03-30 02:22:49 -07:00
|
|
|
{
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (itb->realized) _item_block_unrealize(itb);
|
|
|
|
}
|
2012-03-30 02:22:49 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->realminw = minw;
|
|
|
|
if (minw < sd->w) minw = sd->w;
|
|
|
|
if ((minw != sd->minw) || (minh != sd->minh))
|
2009-04-23 01:51:07 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->minw = minw;
|
|
|
|
sd->minh = minh;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
elm_layout_sizing_eval(sd->obj);
|
2012-10-15 02:10:05 -07:00
|
|
|
if (sd->reorder_it)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
it = sd->reorder_it;
|
|
|
|
it->item->w = minw;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((sd->anchor_item) && (sd->anchor_item->item->block)
|
|
|
|
&& (!sd->auto_scroll_enabled))
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Evas_Coord it_y;
|
|
|
|
|
|
|
|
it = sd->anchor_item;
|
|
|
|
it_y = sd->anchor_y;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_set
|
|
|
|
(sd->obj, sd->pan_x, it->item->block->y
|
|
|
|
+ it->y + it_y, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->anchor_item = it;
|
|
|
|
sd->anchor_y = it_y;
|
|
|
|
}
|
2009-04-23 01:51:07 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (did_must_recalc)
|
2011-10-21 15:55:45 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->must_recalc_idler)
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, data);
|
2011-08-24 14:03:37 -07:00
|
|
|
}
|
2017-02-07 15:00:35 -08:00
|
|
|
if (!sd->show_item) sd->check_scroll = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->check_scroll)
|
2010-03-02 00:47:40 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (EINA_INLIST_GET(sd->show_item) == sd->items->last)
|
|
|
|
sd->scroll_to_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
|
|
|
|
|
|
|
|
if ((sd->show_item) && (sd->show_item->item->block))
|
2018-06-27 13:53:55 -07:00
|
|
|
_item_scroll(sd);
|
2010-03-02 00:47:40 -08:00
|
|
|
}
|
2009-02-16 23:50:35 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->calc_job = NULL;
|
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_elm_layout_sizing_eval(Eo *obj, Elm_Genlist_Data *sd)
|
2009-05-12 03:16:49 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
|
|
|
Evas_Coord vmw = 0, vmh = 0;
|
2009-09-26 11:24:06 -07:00
|
|
|
|
2013-10-05 01:14:25 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (sd->on_sub_del) return;;
|
|
|
|
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(obj, &minw, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_size_hint_max_get(obj, &maxw, &maxh);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &vmw, &vmh);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-14 02:30:55 -07:00
|
|
|
if (sd->mode == ELM_LIST_COMPRESS)
|
2009-05-12 03:16:49 -07:00
|
|
|
{
|
2012-12-24 01:47:11 -08:00
|
|
|
Evas_Coord vw = 0, vh = 0;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((vw != 0) && (vw != sd->prev_viewport_w))
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Item_Block *itb;
|
|
|
|
|
|
|
|
sd->prev_viewport_w = vw;
|
2015-12-16 22:27:48 -08:00
|
|
|
/* Free all buckets for updaing changed width */
|
|
|
|
eina_hash_free_buckets(sd->size_caches);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2011-05-24 04:41:00 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
itb->must_recalc = EINA_TRUE;
|
2011-05-24 04:41:00 -07:00
|
|
|
}
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
minw = vmw;
|
2012-08-09 05:12:29 -07:00
|
|
|
minh = vmh;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2015-03-03 02:58:40 -08:00
|
|
|
|
|
|
|
if (sd->scr_minw)
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
maxw = -1;
|
|
|
|
minw = vmw + sd->realminw;
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
}
|
2015-03-03 02:58:40 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
minw = vmw;
|
|
|
|
}
|
|
|
|
if (sd->scr_minh)
|
|
|
|
{
|
|
|
|
maxh = -1;
|
|
|
|
minh = vmh + sd->minh;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2010-01-18 22:54:27 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
minw = vmw;
|
2012-08-09 05:12:29 -07:00
|
|
|
minh = vmh;
|
2010-01-18 22:54:27 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2015-03-03 02:58:40 -08:00
|
|
|
if ((maxw > 0) && (minw > maxw))
|
|
|
|
minw = maxw;
|
|
|
|
if ((maxh > 0) && (minh > maxh))
|
|
|
|
minh = maxh;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
|
|
|
}
|
|
|
|
|
2015-03-03 02:58:40 -08:00
|
|
|
static void
|
|
|
|
_content_min_limit_cb(Evas_Object *obj,
|
|
|
|
Eina_Bool w,
|
|
|
|
Eina_Bool h)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if ((sd->mode == ELM_LIST_LIMIT) ||
|
|
|
|
(sd->mode == ELM_LIST_EXPAND)) return;
|
|
|
|
sd->scr_minw = !!w;
|
|
|
|
sd->scr_minh = !!h;
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
2014-11-21 23:09:11 -08:00
|
|
|
_item_contract_emit(Elm_Object_Item *eo_it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
Elm_Object_Item *eo_it2;
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_CONTRACT_FLIP, "");
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_CONTRACT_FLIP, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->tree_effect_finished = EINA_FALSE;
|
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
EINA_LIST_FOREACH(it->item->items, l, eo_it2)
|
|
|
|
if (eo_it2) _item_contract_emit(eo_it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_item_tree_effect_before(Elm_Gen_Item *it)
|
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it2;
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_List *l;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
EINA_LIST_FOREACH(it->item->items, l, eo_it2)
|
2009-09-07 23:22:11 -07:00
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it2->parent && (it == it2->parent))
|
2010-01-18 22:54:27 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it2->realized)
|
|
|
|
it2->item->tree_effect_hide_me = EINA_TRUE;
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->move_effect_mode ==
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_TREE_EFFECT_EXPAND)
|
2013-10-05 05:35:27 -07:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it2), SIGNAL_HIDE, "");
|
|
|
|
edje_object_signal_emit(VIEW(it2), SIGNAL_HIDE, "elm");
|
2013-10-05 05:35:27 -07:00
|
|
|
}
|
2013-05-02 11:13:36 -07:00
|
|
|
else if (sd->move_effect_mode ==
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_TREE_EFFECT_CONTRACT)
|
2014-11-21 23:09:11 -08:00
|
|
|
_item_contract_emit(eo_it2);
|
2010-01-18 22:54:27 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
|
|
|
_item_position(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view,
|
|
|
|
Evas_Coord it_x,
|
|
|
|
Evas_Coord it_y)
|
|
|
|
{
|
|
|
|
if (!it) return;
|
|
|
|
if (!view) return;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_freeze
|
2013-05-02 11:13:36 -07:00
|
|
|
(evas_object_evas_get(sd->obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_resize(view, it->item->w, it->item->h);
|
|
|
|
evas_object_move(view, it_x, it_y);
|
|
|
|
evas_object_show(view);
|
2013-05-02 11:13:36 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_thaw_eval
|
2013-05-02 11:13:36 -07:00
|
|
|
(evas_object_evas_get(sd->obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_tree_effect(Elm_Genlist_Data *sd,
|
2012-07-16 14:56:30 -07:00
|
|
|
int y)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Gen_Item *expanded_next_it;
|
|
|
|
Elm_Object_Item *eo_it;
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
expanded_next_it = sd->expanded_next_item;
|
|
|
|
|
|
|
|
if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_genlist_item_prev_get(EO_OBJ(expanded_next_it));
|
|
|
|
while (eo_it)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->expanded_depth <=
|
|
|
|
expanded_next_it->item->expanded_depth) break;
|
|
|
|
if (it->item->scrl_y &&
|
|
|
|
(it->item->scrl_y <= expanded_next_it->item->old_scrl_y + y)
|
|
|
|
&& (it->item->expanded_depth >
|
|
|
|
expanded_next_it->item->expanded_depth))
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->item->tree_effect_finished)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it), "flip_item", "");
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_FLIP_ITEM,
|
|
|
|
"elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position
|
|
|
|
(it, VIEW(it), it->item->scrl_x, it->item->scrl_y);
|
|
|
|
it->item->tree_effect_finished = EINA_TRUE;
|
|
|
|
}
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_genlist_item_prev_get(eo_it);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_genlist_item_prev_get(EO_OBJ(expanded_next_it));
|
|
|
|
while (eo_it)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((it->item->scrl_y > expanded_next_it->item->old_scrl_y + y) &&
|
|
|
|
(it->item->expanded_depth >
|
|
|
|
expanded_next_it->item->expanded_depth))
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->item->tree_effect_finished)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_HIDE, "");
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_HIDE, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->tree_effect_finished = EINA_TRUE;
|
|
|
|
}
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
break;
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_genlist_item_prev_get(eo_it);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
}
|
2009-05-12 03:16:49 -07:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
|
|
|
_item_sub_items_clear(Elm_Gen_Item *it)
|
2009-09-01 03:42:52 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_List *tl = NULL, *l;
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it2;
|
2009-09-26 11:24:06 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
EINA_LIST_FOREACH(it->item->items, l, eo_it2)
|
|
|
|
tl = eina_list_append(tl, eo_it2);
|
|
|
|
EINA_LIST_FREE(tl, eo_it2)
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_del(eo_it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_auto_scroll(Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_tmp_item = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if ((sd->expanded_item) && (sd->auto_scroll_enabled))
|
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
eo_tmp_item = eina_list_data_get
|
2012-07-16 14:56:30 -07:00
|
|
|
(eina_list_last(sd->expanded_item->item->items));
|
2014-11-21 23:09:11 -08:00
|
|
|
if (!eo_tmp_item) return;
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_tmp_item, tmp_item);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->show_item = tmp_item;
|
|
|
|
sd->bring_in = EINA_TRUE;
|
|
|
|
sd->scroll_to_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
|
|
|
|
if ((sd->show_item->item->queued) || (!sd->show_item->item->mincalcd))
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->show_item->item->show_me = EINA_TRUE;
|
|
|
|
sd->auto_scroll_enabled = EINA_FALSE;
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
_item_scroll(sd);
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
2009-09-23 15:56:47 -07:00
|
|
|
}
|
2009-09-01 03:42:52 -07:00
|
|
|
|
2010-10-15 04:24:46 -07:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_tree_effect_finish(Elm_Genlist_Data *sd)
|
2010-10-15 04:24:46 -07:00
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
const Eina_List *l;
|
genlist: fix Issue "In Tree effect feature, items floates when number of item crosses item block size".
Summary: "In Tree effect feature, during expansion of tree, when total number of items crosses block count, items start floating".
Test Plan: Run elementary_test, open Genlist Tree, keep expanding items untill it crosses number of count 32 (Block count). Resize the window, floting items can be seen.
Reviewers: raster, cedric
Subscribers: shilpasingh, poornima.srinivasan, govi, rajeshps
Differential Revision: https://phab.enlightenment.org/D2627
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-22 02:51:20 -07:00
|
|
|
Item_Block *itb;
|
|
|
|
Elm_Gen_Item *it1;
|
|
|
|
Evas_Coord y = 0;
|
2010-10-15 04:24:46 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->tree_effect_animator)
|
2010-10-15 04:24:46 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT)
|
|
|
|
_item_sub_items_clear(sd->expanded_item);
|
2010-10-15 04:24:46 -07:00
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
EINA_LIST_FOREACH(sd->expanded_item->item->items, l, eo_it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->tree_effect_finished = EINA_TRUE;
|
|
|
|
it->item->old_scrl_y = it->item->scrl_y;
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->move_effect_mode ==
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_TREE_EFFECT_EXPAND)
|
2013-10-05 05:35:27 -07:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_SHOW, "");
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_SHOW, "elm");
|
2013-10-05 05:35:27 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
genlist: fix Issue "In Tree effect feature, items floates when number of item crosses item block size".
Summary: "In Tree effect feature, during expansion of tree, when total number of items crosses block count, items start floating".
Test Plan: Run elementary_test, open Genlist Tree, keep expanding items untill it crosses number of count 32 (Block count). Resize the window, floting items can be seen.
Reviewers: raster, cedric
Subscribers: shilpasingh, poornima.srinivasan, govi, rajeshps
Differential Revision: https://phab.enlightenment.org/D2627
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-22 02:51:20 -07:00
|
|
|
if (sd->move_effect_mode ==
|
|
|
|
ELM_GENLIST_TREE_EFFECT_EXPAND)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(itb->items, l, it1)
|
|
|
|
{
|
|
|
|
if (it1->item->scrl_y <= y)
|
|
|
|
{
|
|
|
|
it1->item->scrl_y = y + it1->item->h;
|
|
|
|
_elm_genlist_item_unrealize(it1, EINA_FALSE);
|
|
|
|
}
|
|
|
|
y = it1->item->scrl_y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2010-10-15 04:24:46 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_auto_scroll(sd);
|
2014-03-08 11:46:24 -08:00
|
|
|
evas_object_lower(sd->event_block_rect);
|
|
|
|
evas_object_hide(sd->event_block_rect);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE;
|
2014-01-21 17:47:33 -08:00
|
|
|
sd->move_items = eina_list_free(sd->move_items);
|
2010-10-15 04:24:46 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(sd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
|
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->obj, ELM_GENLIST_EVENT_TREE_EFFECT_FINISHED, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
|
2016-01-28 17:07:34 -08:00
|
|
|
_elm_genlist_tree_effect_stop(sd);
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
}
|
|
|
|
|
2017-03-13 04:18:33 -07:00
|
|
|
static void
|
|
|
|
_item_restack(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
if (it->item->nostacking) return;
|
|
|
|
if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
|
|
|
|
{
|
|
|
|
if (it->deco_all_view) evas_object_stack_below(it->deco_all_view, sd->stack[0]);
|
|
|
|
else if (it->item->deco_it_view) evas_object_stack_below(it->item->deco_it_view, sd->stack[0]);
|
|
|
|
else evas_object_stack_below(VIEW(it), sd->stack[0]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->deco_all_view) evas_object_stack_above(it->deco_all_view, sd->stack[0]);
|
|
|
|
else if (it->item->deco_it_view) evas_object_stack_above(it->item->deco_it_view, sd->stack[0]);
|
|
|
|
else evas_object_stack_above(VIEW(it), sd->stack[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
static void
|
2013-08-22 11:13:04 -07:00
|
|
|
_elm_genlist_item_position_state_update(Elm_Gen_Item *it)
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
{
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
unsigned idx = it->item->order_num_in;
|
|
|
|
|
2017-02-26 21:27:24 -08:00
|
|
|
if (!VIEW(it) && !it->deco_all_view) return;
|
2013-06-22 23:17:39 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2017-03-13 04:18:33 -07:00
|
|
|
_item_restack(it);
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (idx & 0x1)
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_ODD, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_ODD, "elm");
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_EVEN, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_EVEN, "elm");
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
}
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
|
|
|
|
if (sd->item_count == 1)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_LIST_SINGLE, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_LIST_SINGLE, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
else if (idx == 0)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_LIST_FIRST, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_LIST_FIRST, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
else if (idx == sd->item_count - 1)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_LIST_LAST, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_LIST_LAST, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
else if (idx > 0)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_LIST_MIDDLE, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_LIST_MIDDLE, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (it->parent)
|
|
|
|
{
|
|
|
|
unsigned first_idx = it->parent->item->order_num_in + 1;
|
|
|
|
unsigned count = eina_list_count(it->parent->item->items);
|
|
|
|
|
|
|
|
if (count == 1)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_GROUP_SINGLE, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_GROUP_SINGLE,
|
|
|
|
"elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
else if (idx == first_idx)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_GROUP_FIRST, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_GROUP_FIRST,
|
|
|
|
"elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
2014-11-21 23:09:11 -08:00
|
|
|
else if (EO_OBJ(it) == eina_list_data_get(eina_list_last(it->parent->item->items)))
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_GROUP_LAST, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_GROUP_LAST,
|
|
|
|
"elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
else if (idx > first_idx)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_GROUP_MIDDLE, "elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_GROUP_MIDDLE,
|
|
|
|
"elm");
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
}
|
|
|
|
}
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_order_update(Elm_Gen_Item *it, int index, Eina_Bool process)
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
{
|
2017-02-26 21:27:24 -08:00
|
|
|
it->item->order_num_in = index;
|
|
|
|
_elm_genlist_item_position_state_update(it);
|
genlist: implement list position signals.
Genlist will now emit the following signals to item view related to
their position in the whole list:
- elm,state,list,first: first item of the whole list
- elm,state,list,last: last item of the whole list
- elm,state,list,middle: any item that is not first or last.
- elm,state,list,single: when the item is the only element of list.
And the following related to a group (considering its given 'parent'):
- elm,state,group,first: first item of the group
- elm,state,group,last: last item of the group
- elm,state,group,middle: any item that is not first or last.
- elm,state,group,single: when the item is the only element of group.
Unlike odd/even the signals have an extra namespace "list" or "group"
to avoid conflicts with applications that may have declared these
signals themselves for other purposes.
With this patch one can implement easily something like this:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/Art/tv_grouped_style.jpg
2013-08-22 13:00:26 -07:00
|
|
|
|
2017-02-26 21:27:24 -08:00
|
|
|
if (process) edje_object_message_signal_process(VIEW(it));
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
_elm_genlist_item_state_update(Elm_Gen_Item *it)
|
From: Jeonghyun Yun <jh0506.yun@samsung.com>
Subject: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
I added 6 multi-touch smart callbacks in elm_genlist, please refer to
below.
"multi,sweep,left" - Genlist has been multi-touch swept left.
"multi,sweep,right" - Genlist has been multi-touch swept right.
"multi,sweep,top" - Genlist has been multi-touch swept top.
"multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
"multi,pinch,out" - Genlist has been multi-touch pinched out.
"multi,pinch,in" - Genlist has been multi-touch pinched in.
I think these smart callbacks are very useful for elm_genlist
multi-touch
effect.
If this patch have any issue, please let me know.
SVN revision: 55878
2011-01-05 02:28:23 -08:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (it->selected)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_SELECTED, "elm");
|
|
|
|
if (it->deco_all_view)
|
|
|
|
edje_object_signal_emit
|
|
|
|
(it->deco_all_view, SIGNAL_SELECTED, "elm");
|
2010-03-26 21:17:01 -07:00
|
|
|
}
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2009-02-16 23:50:35 -08:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_DISABLED, "elm");
|
|
|
|
if (it->deco_all_view)
|
|
|
|
edje_object_signal_emit
|
|
|
|
(it->deco_all_view, SIGNAL_DISABLED, "elm");
|
|
|
|
}
|
|
|
|
if (it->item->expanded)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_EXPANDED, "elm");
|
|
|
|
if (it->deco_all_view)
|
|
|
|
edje_object_signal_emit
|
|
|
|
(it->deco_all_view, SIGNAL_EXPANDED, "elm");
|
2009-02-16 23:50:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-01 23:17:16 -08:00
|
|
|
static void
|
2018-08-02 06:42:06 -07:00
|
|
|
_view_inflate(Evas_Object *view, Elm_Gen_Item *it, Eina_List **sources, Eina_List **contents, Eina_Bool calc)
|
2015-01-01 23:17:16 -08:00
|
|
|
{
|
|
|
|
if (!view) return;
|
2015-01-02 03:04:55 -08:00
|
|
|
if (sources) _item_text_realize(it, view, sources, NULL);
|
2018-08-02 06:42:06 -07:00
|
|
|
if (contents) _item_content_realize(it, view, contents, "contents", NULL, calc);
|
2015-01-02 00:34:05 -08:00
|
|
|
_item_state_realize(it, view, NULL);
|
2015-01-01 23:17:16 -08:00
|
|
|
}
|
|
|
|
|
2012-03-20 00:58:42 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_index_update(Elm_Gen_Item *it)
|
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->position_update || it->item->block->position_update)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_INDEX_UPDATE, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
it->position_update = EINA_FALSE;
|
|
|
|
}
|
2012-03-20 00:58:42 -07:00
|
|
|
}
|
|
|
|
|
2010-11-05 23:02:22 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_decorate_all_item_position(Elm_Gen_Item *it,
|
|
|
|
int itx,
|
|
|
|
int ity)
|
2010-11-05 23:02:22 -07:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if ((!it) || (!it->item->wsd->decorate_all_mode)) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_resize(it->deco_all_view, it->item->w, it->item->h);
|
|
|
|
evas_object_move(it->deco_all_view, itx, ity);
|
2010-11-05 23:02:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_decorate_all_item_realize(Elm_Gen_Item *it,
|
|
|
|
Eina_Bool effect_on)
|
2010-11-05 23:02:22 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
char buf[1024];
|
|
|
|
const char *stacking;
|
|
|
|
const char *stacking_even;
|
2010-12-07 11:18:14 -08:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if (!it) return;
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2015-01-08 06:03:52 -08:00
|
|
|
if (it->item->decorate_all_item_realized) return;
|
2010-12-07 11:18:14 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->deco_all_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
|
2018-04-05 01:47:26 -07:00
|
|
|
edje_object_scale_set(it->deco_all_view, efl_gfx_entity_scale_get(WIDGET(it)) *
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_config_scale_get());
|
2013-05-02 11:13:36 -07:00
|
|
|
evas_object_smart_member_add(it->deco_all_view, sd->pan_obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_widget_sub_object_add(WIDGET(it), it->deco_all_view);
|
|
|
|
|
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_TREE)
|
|
|
|
strncpy(buf, "tree", sizeof(buf));
|
|
|
|
else strncpy(buf, "item", sizeof(buf));
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->mode == ELM_LIST_COMPRESS)
|
2013-03-21 06:34:15 -07:00
|
|
|
strncat(buf, "_compress", sizeof(buf) - strlen(buf) - 1);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-03-21 06:34:15 -07:00
|
|
|
strncat(buf, "/", sizeof(buf) - strlen(buf) - 1);
|
|
|
|
strncat(buf, it->itc->decorate_all_item_style, sizeof(buf) - strlen(buf) - 1);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
elm_widget_theme_object_set(WIDGET(it), it->deco_all_view, "genlist", buf,
|
|
|
|
elm_widget_style_get(WIDGET(it)));
|
|
|
|
|
|
|
|
stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
|
|
|
|
if (!stacking_even) stacking_even = "above";
|
|
|
|
it->item->stacking_even = !!strcmp("above", stacking_even);
|
|
|
|
|
|
|
|
stacking = edje_object_data_get(VIEW(it), "stacking");
|
|
|
|
if (!stacking) stacking = "yes";
|
|
|
|
it->item->nostacking = !!strcmp("yes", stacking);
|
|
|
|
|
|
|
|
edje_object_mirrored_set
|
2017-06-13 03:41:15 -07:00
|
|
|
(it->deco_all_view, efl_ui_mirrored_get(WIDGET(it)));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-08-22 11:13:04 -07:00
|
|
|
_elm_genlist_item_position_state_update(it);
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
_elm_genlist_item_state_update(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->reorder_mode)
|
2014-12-31 02:10:40 -08:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_REORDER_MODE_UNSET,
|
|
|
|
"elm");
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (effect_on)
|
|
|
|
edje_object_signal_emit
|
2014-12-29 02:49:19 -08:00
|
|
|
(it->deco_all_view, SIGNAL_DECORATE_ENABLED_EFFECT, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
edje_object_signal_emit
|
2014-12-29 02:49:19 -08:00
|
|
|
(it->deco_all_view, SIGNAL_DECORATE_ENABLED, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
_item_mouse_callbacks_del(it, VIEW(it));
|
|
|
|
_item_mouse_callbacks_add(it, it->deco_all_view);
|
|
|
|
|
|
|
|
if (it->flipped)
|
|
|
|
edje_object_signal_emit
|
2014-12-29 02:49:19 -08:00
|
|
|
(it->deco_all_view, SIGNAL_FLIP_ENABLED, "elm");
|
2018-08-02 06:42:06 -07:00
|
|
|
_view_inflate(it->deco_all_view, it, NULL, &(it->item->deco_all_contents), EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
edje_object_part_swallow
|
|
|
|
(it->deco_all_view, "elm.swallow.decorate.content", VIEW(it));
|
|
|
|
|
|
|
|
_decorate_all_item_position(it, it->item->scrl_x, it->item->scrl_y);
|
|
|
|
evas_object_show(it->deco_all_view);
|
|
|
|
|
|
|
|
if (it->selected)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_SELECTED, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
it->item->decorate_all_item_realized = EINA_TRUE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-01-25 23:11:32 -08:00
|
|
|
//-- tree expand/contract signal handle routine --//
|
2011-12-26 06:30:21 -08:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_expand_toggle_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-12-26 06:30:21 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
|
|
|
|
if (it->item->expanded)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_CONTRACT_REQUEST, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_EXPAND_REQUEST, EO_OBJ(it));
|
2011-12-26 06:30:21 -08:00
|
|
|
}
|
|
|
|
|
2011-04-22 02:56:22 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_expand_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-04-22 02:56:22 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
2011-04-22 02:56:22 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->item->expanded)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_EXPAND_REQUEST, EO_OBJ(it));
|
2011-04-22 02:56:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_contract_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-04-22 02:56:22 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
|
|
|
|
if (it->item->expanded)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_CONTRACT_REQUEST, EO_OBJ(it));
|
2011-04-22 02:56:22 -07:00
|
|
|
}
|
|
|
|
|
2013-01-25 23:11:32 -08:00
|
|
|
//-- item cache handle routine --//
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
// push item cache into caches
|
|
|
|
static Eina_Bool
|
|
|
|
_item_cache_push(Elm_Genlist_Data *sd, Item_Cache *itc)
|
2013-01-25 23:11:32 -08:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (!itc || (sd->item_cache_max <= 0))
|
|
|
|
return EINA_FALSE;
|
2013-01-25 23:11:32 -08:00
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
sd->item_cache_count++;
|
|
|
|
sd->item_cache =
|
|
|
|
eina_inlist_prepend(sd->item_cache, EINA_INLIST_GET(itc));
|
2013-01-25 23:11:32 -08:00
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// pop item cache from caches
|
|
|
|
static Item_Cache *
|
|
|
|
_item_cache_pop(Elm_Genlist_Data *sd, Item_Cache *itc)
|
|
|
|
{
|
|
|
|
if (!itc || (!sd->item_cache) ||
|
|
|
|
(sd->item_cache_count <= 0))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
sd->item_cache =
|
|
|
|
eina_inlist_remove (sd->item_cache, EINA_INLIST_GET(itc));
|
|
|
|
sd->item_cache_count--;
|
|
|
|
|
|
|
|
return itc;
|
2013-01-25 23:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// free one item cache
|
|
|
|
static void
|
|
|
|
_item_cache_free(Item_Cache *itc)
|
|
|
|
{
|
2016-02-12 11:14:13 -08:00
|
|
|
Evas_Object *c;
|
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (!itc) return;
|
|
|
|
|
2014-01-21 17:12:44 -08:00
|
|
|
evas_object_del(itc->spacer);
|
2018-05-07 15:16:29 -07:00
|
|
|
efl_wref_del(itc->base_view, &itc->base_view);
|
|
|
|
efl_del(itc->base_view);
|
2016-05-11 04:32:55 -07:00
|
|
|
itc->item_class = NULL;
|
2016-02-12 11:14:13 -08:00
|
|
|
EINA_LIST_FREE(itc->contents, c)
|
|
|
|
{
|
|
|
|
evas_object_del(c);
|
|
|
|
}
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
ELM_SAFE_FREE(itc, free);
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean up item cache by removing overflowed caches
|
|
|
|
static void
|
|
|
|
_item_cache_clean(Elm_Genlist_Data *sd)
|
|
|
|
{
|
2016-08-26 01:09:38 -07:00
|
|
|
if (!sd->obj) return;
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
|
|
|
|
|
|
|
while ((sd->item_cache) && (sd->item_cache_count > sd->item_cache_max))
|
|
|
|
{
|
|
|
|
Item_Cache *itc =
|
|
|
|
EINA_INLIST_CONTAINER_GET(sd->item_cache->last, Item_Cache);
|
|
|
|
_item_cache_free(_item_cache_pop(sd, itc));
|
|
|
|
}
|
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2013-01-25 23:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// empty all item caches
|
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_cache_zero(Elm_Genlist_Data *sd)
|
2013-01-25 23:11:32 -08:00
|
|
|
{
|
|
|
|
int pmax = sd->item_cache_max;
|
|
|
|
|
|
|
|
sd->item_cache_max = 0;
|
|
|
|
_item_cache_clean(sd);
|
|
|
|
sd->item_cache_max = pmax;
|
|
|
|
}
|
|
|
|
|
|
|
|
// add an item to item cache
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
static Eina_Bool
|
2016-02-12 11:14:13 -08:00
|
|
|
_item_cache_add(Elm_Gen_Item *it, Eina_List *contents)
|
2013-01-25 23:11:32 -08:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (it->item->nocache_once || it->item->nocache) return EINA_FALSE;
|
|
|
|
|
|
|
|
Item_Cache *itc = NULL;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Evas_Object *obj = sd->obj;
|
2013-01-25 23:11:32 -08:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2013-09-05 21:00:42 -07:00
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (sd->item_cache_max > 0)
|
|
|
|
itc = ELM_NEW(Item_Cache);
|
2013-01-25 23:11:32 -08:00
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (!_item_cache_push(sd, itc))
|
2013-01-25 23:11:32 -08:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (itc) ELM_SAFE_FREE(itc, free);
|
|
|
|
|
2013-01-25 23:11:32 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
return EINA_FALSE;
|
2013-01-25 23:11:32 -08:00
|
|
|
}
|
|
|
|
itc->spacer = it->spacer;
|
2018-05-07 15:16:29 -07:00
|
|
|
efl_wref_add(VIEW(it), &itc->base_view);
|
2016-05-11 04:32:55 -07:00
|
|
|
itc->item_class = it->itc;
|
2016-02-12 11:14:13 -08:00
|
|
|
itc->contents = contents;
|
2015-08-27 12:37:50 -07:00
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_TREE)
|
|
|
|
{
|
|
|
|
itc->tree = 1;
|
|
|
|
if (it->item->expanded)
|
|
|
|
edje_object_signal_emit(itc->base_view, SIGNAL_CONTRACTED, "elm");
|
|
|
|
}
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
|
|
|
|
if (it->selected)
|
|
|
|
edje_object_signal_emit(itc->base_view, SIGNAL_UNSELECTED, "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
edje_object_signal_emit(itc->base_view, SIGNAL_ENABLED, "elm");
|
2016-01-31 18:27:56 -08:00
|
|
|
if ((EO_OBJ(it) == sd->focused_item) &&
|
2015-08-04 23:57:11 -07:00
|
|
|
(elm_widget_focus_highlight_enabled_get(obj) || _elm_config->win_auto_focus_enable))
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
edje_object_signal_emit(itc->base_view, SIGNAL_UNFOCUSED, "elm");
|
|
|
|
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);
|
2013-05-21 10:24:02 -07:00
|
|
|
|
2013-01-25 23:11:32 -08:00
|
|
|
// FIXME: other callbacks?
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(itc->base_view, "elm,action,expand,toggle", "elm",
|
|
|
|
_expand_toggle_signal_cb, it);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(itc->base_view, "elm,action,expand", "elm", _expand_signal_cb, it);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(itc->base_view, "elm,action,contract", "elm", _contract_signal_cb, it);
|
|
|
|
_item_mouse_callbacks_del(it, itc->base_view);
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
|
|
|
|
edje_object_mirrored_set(itc->base_view,
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_get(WIDGET(it)));
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
edje_object_scale_set(itc->base_view,
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_scale_get(WIDGET(it))
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
* elm_config_scale_get());
|
|
|
|
|
|
|
|
it->spacer = NULL;
|
2018-05-07 15:16:29 -07:00
|
|
|
efl_wref_del(it->base->view, &it->base->view);
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
VIEW(it) = NULL;
|
|
|
|
evas_object_hide(itc->base_view);
|
|
|
|
evas_object_move(itc->base_view, -9999, -9999);
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
_item_cache_clean(sd);
|
2013-01-25 23:11:32 -08:00
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2013-01-25 23:11:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// find an item from item cache and remove it from the cache
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
static Eina_Bool
|
2013-01-25 23:11:32 -08:00
|
|
|
_item_cache_find(Elm_Gen_Item *it)
|
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (it->item->nocache_once || it->item->nocache) return EINA_FALSE;
|
|
|
|
|
2013-01-25 23:11:32 -08:00
|
|
|
Item_Cache *itc = NULL;
|
|
|
|
Eina_Inlist *l;
|
|
|
|
Eina_Bool tree = 0;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2013-01-25 23:11:32 -08:00
|
|
|
|
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_TREE) tree = 1;
|
2013-05-02 11:13:36 -07:00
|
|
|
EINA_INLIST_FOREACH_SAFE(sd->item_cache, l, itc)
|
2013-01-25 23:11:32 -08:00
|
|
|
{
|
2018-08-06 00:34:05 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
2013-01-25 23:11:32 -08:00
|
|
|
if ((itc->tree == tree) &&
|
2016-05-11 04:32:55 -07:00
|
|
|
(((!it->itc) && (!itc->item_class)) ||
|
|
|
|
(it->itc && itc->item_class &&
|
|
|
|
(it->itc == itc->item_class))))
|
2013-01-25 23:11:32 -08:00
|
|
|
{
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
itc = _item_cache_pop(sd, itc);
|
|
|
|
if (!itc) continue;
|
|
|
|
|
|
|
|
it->spacer = itc->spacer;
|
2018-05-07 15:16:29 -07:00
|
|
|
VIEW_SET(it, itc->base_view);
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
itc->spacer = NULL;
|
2018-05-07 15:16:29 -07:00
|
|
|
efl_wref_del(itc->base_view, &itc->base_view);
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
itc->base_view = NULL;
|
2018-08-06 00:34:05 -07:00
|
|
|
EINA_LIST_FREE(itc->contents, obj)
|
|
|
|
elm_widget_tree_unfocusable_set(obj, EINA_FALSE);
|
2016-02-12 11:14:13 -08:00
|
|
|
itc->contents = NULL;
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
_item_cache_free(itc);
|
|
|
|
return EINA_TRUE;
|
2013-01-25 23:11:32 -08:00
|
|
|
}
|
|
|
|
}
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
return EINA_FALSE;
|
2013-01-25 23:11:32 -08:00
|
|
|
}
|
|
|
|
|
2016-02-12 11:14:13 -08:00
|
|
|
static Eina_List *
|
|
|
|
_content_cache_add(Elm_Gen_Item *it, Eina_List **cache)
|
|
|
|
{
|
2017-11-11 09:26:53 -08:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, pd);
|
2016-02-12 11:14:13 -08:00
|
|
|
Evas_Object *content = NULL;
|
|
|
|
EINA_LIST_FREE(it->contents, content)
|
|
|
|
{
|
|
|
|
*cache = eina_list_append(*cache, content);
|
2017-11-11 09:26:53 -08:00
|
|
|
eina_hash_del_by_key(pd->content_item_map, &content);
|
2018-08-06 00:34:05 -07:00
|
|
|
elm_widget_tree_unfocusable_set(content, EINA_TRUE);
|
2016-02-12 11:14:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return *cache;
|
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
2013-01-18 23:31:42 -08:00
|
|
|
char *ret;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2013-01-18 23:31:42 -08:00
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
if (it->itc->func.text_get)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
const char *key;
|
|
|
|
|
|
|
|
if (!(it->texts)) it->texts =
|
|
|
|
elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "texts"));
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(it->texts, l, key)
|
|
|
|
{
|
|
|
|
char *s = it->itc->func.text_get
|
2014-09-14 04:51:26 -07:00
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
2013-01-18 23:31:42 -08:00
|
|
|
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
if (eina_strbuf_length_get(buf) > 0) eina_strbuf_append(buf, ", ");
|
|
|
|
eina_strbuf_append(buf, s);
|
|
|
|
free(s);
|
|
|
|
}
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-18 23:31:42 -08:00
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (it->base->disabled)
|
2012-08-18 06:52:03 -07:00
|
|
|
return strdup(E_("State: Disabled"));
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_on_highlight_cb(void *data)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord sx, sy, sw, sh;
|
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
evas_object_geometry_get(it->base->view, &x, &y, &w, &h);
|
2012-08-18 06:52:03 -07:00
|
|
|
// XXX There would be a reason.
|
|
|
|
if ((w == 0) && (h == 0)) return;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
evas_object_geometry_get(it->base->widget, &sx, &sy, &sw, &sh);
|
2012-08-18 06:52:03 -07:00
|
|
|
if ((x < sx) || (y < sy) || ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_bring_in(EO_OBJ(it),
|
2012-08-18 06:52:03 -07:00
|
|
|
ELM_GENLIST_ITEM_SCROLLTO_IN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_widget_item_register(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Access_Info *ai;
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
_elm_access_widget_item_register(it->base);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
ai = _elm_access_info_get(it->base->access_obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
|
|
|
|
_elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, it);
|
2014-09-27 22:15:28 -07:00
|
|
|
_elm_access_activate_callback_set(ai, _access_activate_cb, EO_OBJ(it));
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
|
2015-09-28 01:04:02 -07:00
|
|
|
static void
|
|
|
|
_elm_genlist_item_focus_update(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
const char *focus_raise;
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
2017-07-10 23:12:45 -07:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj)
|
|
|
|
|| _elm_config->win_auto_focus_enable)
|
2015-09-28 01:04:02 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_FOCUSED, "elm");
|
|
|
|
|
|
|
|
focus_raise = edje_object_data_get(VIEW(it), "focusraise");
|
|
|
|
if ((focus_raise) && (!strcmp(focus_raise, "on")))
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *git;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
EINA_LIST_FOREACH(sd->group_items, l, git)
|
|
|
|
{
|
|
|
|
if (git->realized) evas_object_raise(VIEW(git));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
2017-02-23 00:10:16 -08:00
|
|
|
_item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
|
2012-04-06 00:10:20 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
const char *treesize;
|
2015-12-01 23:23:39 -08:00
|
|
|
Item_Size *size = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
int tsize = 20;
|
2017-02-23 00:10:16 -08:00
|
|
|
int in = index;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-04-06 00:10:20 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->realized)
|
2012-04-06 00:10:20 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->order_num_in != in)
|
2012-04-06 00:10:20 -07:00
|
|
|
{
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_order_update(it, in, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_index_update(it);
|
2012-04-06 00:10:20 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
2012-04-06 00:10:20 -07:00
|
|
|
}
|
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (sd->tree_effect_enabled ||
|
|
|
|
(!_item_cache_find(it)))
|
2012-10-22 07:34:43 -07:00
|
|
|
{
|
2018-05-07 15:16:29 -07:00
|
|
|
VIEW_SET(it, _view_create(it, it->itc->item_style));
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
if (it->item->nocache_once)
|
|
|
|
it->item->nocache_once = EINA_FALSE;
|
2012-10-22 07:34:43 -07:00
|
|
|
}
|
2011-04-22 02:56:22 -07:00
|
|
|
|
2013-01-10 04:00:05 -08:00
|
|
|
/* access */
|
|
|
|
if (_elm_config->access_mode) _access_widget_item_register(it);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_order_update(it, in, EINA_FALSE);
|
2011-04-22 02:56:22 -07:00
|
|
|
|
2014-12-31 02:10:40 -08:00
|
|
|
if (sd->reorder_mode)
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_UNSET, "elm");
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
treesize = edje_object_data_get(VIEW(it), "treesize");
|
2009-03-14 11:03:19 -07:00
|
|
|
if (treesize) tsize = atoi(treesize);
|
2013-09-05 21:08:21 -07:00
|
|
|
|
|
|
|
if (edje_object_part_exists(VIEW(it), "elm.swallow.pad"))
|
2012-03-19 22:44:18 -07:00
|
|
|
{
|
2013-09-05 21:08:21 -07:00
|
|
|
if (!it->spacer && treesize)
|
|
|
|
{
|
|
|
|
it->spacer =
|
|
|
|
evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_object_color_set(it->spacer, 0, 0, 0, 0);
|
|
|
|
elm_widget_sub_object_add(WIDGET(it), it->spacer);
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_size_hint_min_set
|
2013-09-05 21:08:21 -07:00
|
|
|
(it->spacer, (it->item->expanded_depth * tsize) *
|
|
|
|
elm_config_scale_get(), 1);
|
2012-03-19 22:44:18 -07:00
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
|
|
|
|
}
|
2013-09-05 21:08:21 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(it->spacer, evas_object_del);
|
|
|
|
}
|
|
|
|
|
2009-02-12 05:39:43 -08:00
|
|
|
if (!calc)
|
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(it), "elm,action,expand,toggle", "elm",
|
|
|
|
_expand_toggle_signal_cb, it);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(it), "elm,action,expand", "elm", _expand_signal_cb, it);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(VIEW(it), "elm,action,contract", "elm", _contract_signal_cb, it);
|
2012-03-20 00:58:42 -07:00
|
|
|
_item_mouse_callbacks_add(it, VIEW(it));
|
2011-04-22 02:56:22 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->decorate_all_mode) && (!it->deco_all_view) &&
|
2012-06-21 01:36:21 -07:00
|
|
|
(it->item->type != ELM_GENLIST_ITEM_GROUP) &&
|
2012-06-18 02:54:00 -07:00
|
|
|
(it->itc->decorate_all_item_style))
|
2012-04-03 02:56:49 -07:00
|
|
|
_decorate_all_item_realize(it, EINA_FALSE);
|
2012-10-22 07:34:43 -07:00
|
|
|
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
_elm_genlist_item_state_update(it);
|
2011-12-26 06:30:21 -08:00
|
|
|
_elm_genlist_item_index_update(it);
|
2015-03-11 03:59:58 -07:00
|
|
|
|
|
|
|
if (EO_OBJ(it) == sd->focused_item)
|
|
|
|
{
|
2015-09-28 01:04:02 -07:00
|
|
|
_elm_genlist_item_focus_update(it);
|
2015-03-11 03:59:58 -07:00
|
|
|
_elm_widget_item_highlight_in_theme(WIDGET(it), EO_OBJ(it));
|
|
|
|
_elm_widget_highlight_in_theme_update(WIDGET(it));
|
|
|
|
_elm_widget_focus_highlight_start(WIDGET(it));
|
|
|
|
}
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2015-12-01 23:23:39 -08:00
|
|
|
size = eina_hash_find(sd->size_caches, &(it->itc));
|
2013-11-21 18:06:37 -08:00
|
|
|
/* homogeneous genlist shortcut */
|
2015-12-01 23:23:39 -08:00
|
|
|
if ((calc) && (sd->homogeneous) && (!it->item->mincalcd) && size)
|
2009-02-11 03:49:43 -08:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
it->item->w = it->item->minw = size->minw;
|
|
|
|
it->item->h = it->item->minh = size->minh;
|
2016-01-21 23:55:37 -08:00
|
|
|
size->expanded_depth = it->item->expanded_depth;
|
2012-06-26 20:23:52 -07:00
|
|
|
it->item->mincalcd = EINA_TRUE;
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
2010-01-23 01:07:20 -08:00
|
|
|
else
|
2009-02-14 18:53:56 -08:00
|
|
|
{
|
2015-01-02 02:04:34 -08:00
|
|
|
if (eina_list_count(it->contents) != 0)
|
2012-07-16 14:56:30 -07:00
|
|
|
ERR_ABORT("If you see this error, please notify us and we"
|
|
|
|
"will fix it");
|
2010-10-15 04:51:15 -07:00
|
|
|
|
2018-08-02 06:42:06 -07:00
|
|
|
_view_inflate(VIEW(it), it, &it->texts, &it->contents, calc);
|
2015-01-02 02:04:34 -08:00
|
|
|
if (it->has_contents != (!!it->contents))
|
2013-12-16 10:34:59 -08:00
|
|
|
it->item->mincalcd = EINA_FALSE;
|
2015-01-02 02:04:34 -08:00
|
|
|
it->has_contents = !!it->contents;
|
elm genlist: Added elm_genlist_item_flip_get/set APIs. Patch by
Hyoyoung Chang <hyoyoung@gmail.com>
On Wed, Feb 29, 2012 at 9:17 PM, Hyoyoung Chang <hyoyoung@gmail.com>
wrote:
> Dear all.
>
> I made a patch to introduce new genlist item mode.
> Two public apis are added.
> +EAPI void elm_genlist_item_flip_set(Elm_Object_Item *it, Eina_Bool
flip);
> +EAPI Eina_Bool elm_genlist_item_flip_get(Elm_Object_Item *it);
>
> It provides on-the-flying item change. It works like that a new item
> added on existed item.
> In elementary test, you can test it.
> It's useful at adding widgets or show buttons in genlist item.
>
> Thanks.
On Mon, Mar 5, 2012 at 5:56 PM, Hyoyoung Chang <hyoyoung@gmail.com>
wrote:
> Hello, I modifed fliP_set api to use ecore_job.
> It resolved version of mouse_{move, up} bugs.
>
SVN revision: 68727
2012-03-05 07:03:12 -08:00
|
|
|
if (it->flipped)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_FLIP_ENABLED, "elm");
|
2017-02-22 22:52:31 -08:00
|
|
|
_item_content_realize(it, VIEW(it), &it->item->flip_contents,
|
2018-08-02 06:42:06 -07:00
|
|
|
"flips", NULL, EINA_FALSE);
|
elm genlist: Added elm_genlist_item_flip_get/set APIs. Patch by
Hyoyoung Chang <hyoyoung@gmail.com>
On Wed, Feb 29, 2012 at 9:17 PM, Hyoyoung Chang <hyoyoung@gmail.com>
wrote:
> Dear all.
>
> I made a patch to introduce new genlist item mode.
> Two public apis are added.
> +EAPI void elm_genlist_item_flip_set(Elm_Object_Item *it, Eina_Bool
flip);
> +EAPI Eina_Bool elm_genlist_item_flip_get(Elm_Object_Item *it);
>
> It provides on-the-flying item change. It works like that a new item
> added on existed item.
> In elementary test, you can test it.
> It's useful at adding widgets or show buttons in genlist item.
>
> Thanks.
On Mon, Mar 5, 2012 at 5:56 PM, Hyoyoung Chang <hyoyoung@gmail.com>
wrote:
> Hello, I modifed fliP_set api to use ecore_job.
> It resolved version of mouse_{move, up} bugs.
>
SVN revision: 68727
2012-03-05 07:03:12 -08:00
|
|
|
}
|
2010-10-15 04:51:15 -07:00
|
|
|
|
2013-01-18 21:09:34 -08:00
|
|
|
/* access: unregister item which have no text and content */
|
|
|
|
if (_elm_config->access_mode && !it->texts && !it->contents)
|
2014-08-19 00:52:24 -07:00
|
|
|
_elm_access_widget_item_unregister(it->base);
|
2013-01-18 21:09:34 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->item->mincalcd)
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
if (sd->homogeneous && size)
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
it->item->w = it->item->minw = size->minw;
|
|
|
|
it->item->h = it->item->minh = size->minh;
|
2015-12-01 23:23:39 -08:00
|
|
|
it->item->mincalcd = EINA_TRUE;
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->block->realized)
|
|
|
|
it->item->w = it->item->block->w;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
}
|
2015-12-01 23:23:39 -08:00
|
|
|
else
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
Evas_Coord mw = -1, mh = -1;
|
|
|
|
|
|
|
|
if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
|
|
|
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
|
|
|
|
if (sd->mode == ELM_LIST_COMPRESS)
|
|
|
|
mw = sd->prev_viewport_w;
|
2016-05-23 22:11:07 -07:00
|
|
|
// Process signal for proper size calc with text and content visible.
|
|
|
|
edje_object_message_signal_process(VIEW(it));
|
2015-12-01 23:23:39 -08:00
|
|
|
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
|
|
|
|
it->item->w = it->item->minw = mw;
|
|
|
|
it->item->h = it->item->minh = mh;
|
|
|
|
it->item->mincalcd = EINA_TRUE;
|
|
|
|
|
|
|
|
if (sd->homogeneous)
|
|
|
|
{
|
|
|
|
if (size)
|
|
|
|
eina_hash_del_by_key(sd->size_caches, &(it->itc));
|
|
|
|
|
|
|
|
size = ELM_NEW(Item_Size);
|
|
|
|
size->itc = it->itc;
|
2016-01-21 23:55:37 -08:00
|
|
|
size->expanded_depth = it->item->expanded_depth;
|
2015-12-01 23:23:39 -08:00
|
|
|
size->minw = mw;
|
|
|
|
size->minh = mh;
|
|
|
|
eina_hash_add(sd->size_caches, &(it->itc), size);
|
|
|
|
}
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
|
|
|
}
|
2011-10-20 18:08:01 -07:00
|
|
|
if (!calc) evas_object_show(VIEW(it));
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
2010-09-27 11:18:37 -07:00
|
|
|
|
|
|
|
if (it->tooltip.content_cb)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set(EO_OBJ(it), it->tooltip.content_cb, it->tooltip.data, NULL);
|
|
|
|
elm_wdg_item_tooltip_style_set(EO_OBJ(it), it->tooltip.style);
|
|
|
|
elm_wdg_item_tooltip_window_mode_set(EO_OBJ(it), it->tooltip.free_size);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (it->mouse_cursor)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_set(EO_OBJ(it), it->mouse_cursor);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2009-06-17 08:35:19 -07:00
|
|
|
it->realized = EINA_TRUE;
|
2010-03-26 21:17:01 -07:00
|
|
|
it->want_unrealize = EINA_FALSE;
|
2010-11-05 23:02:22 -07:00
|
|
|
|
2011-06-03 18:52:08 -07:00
|
|
|
if (!calc)
|
2012-03-23 00:47:03 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->tree_effect_hide_me)
|
2012-03-23 00:47:03 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->move_effect_mode
|
2012-07-16 14:56:30 -07:00
|
|
|
!= ELM_GENLIST_TREE_EFFECT_NONE)
|
2013-10-05 05:35:27 -07:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_HIDE, "");
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_HIDE, "elm");
|
2013-10-05 05:35:27 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->tree_effect_hide_me = EINA_FALSE;
|
2012-03-23 00:47:03 -07:00
|
|
|
}
|
2013-02-20 02:00:49 -08:00
|
|
|
|
|
|
|
if (it->item->type == ELM_GENLIST_ITEM_NONE)
|
|
|
|
{
|
|
|
|
Evas_Object* eobj;
|
|
|
|
Eina_List* l;
|
2015-01-02 02:04:34 -08:00
|
|
|
EINA_LIST_FOREACH(it->contents, l, eobj)
|
2014-04-23 01:00:50 -07:00
|
|
|
if (elm_widget_is(eobj) && elm_object_focus_allow_get(eobj))
|
2013-02-20 02:00:49 -08:00
|
|
|
it->item_focus_chain = eina_list_append
|
|
|
|
(it->item_focus_chain, eobj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-25 23:52:07 -07:00
|
|
|
if (it->item->type == ELM_GENLIST_ITEM_TREE)
|
|
|
|
{
|
|
|
|
Evas_Object* t_eobj;
|
|
|
|
Eina_List* tl;
|
2015-01-02 02:04:34 -08:00
|
|
|
EINA_LIST_FOREACH(it->contents, tl, t_eobj)
|
2014-05-25 23:52:07 -07:00
|
|
|
if (elm_widget_is(t_eobj) && elm_object_focus_allow_get(t_eobj))
|
|
|
|
it->item_focus_chain = eina_list_append
|
|
|
|
(it->item_focus_chain, t_eobj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_REALIZED, EO_OBJ(it));
|
2012-03-23 00:47:03 -07:00
|
|
|
}
|
2012-02-22 23:39:10 -08:00
|
|
|
|
2014-12-29 08:31:43 -08:00
|
|
|
//Send a signal so that an item changes its style according to its expand depth
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->expanded_depth > 0)
|
2014-12-29 05:15:16 -08:00
|
|
|
{
|
|
|
|
char buf[126];
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,expanded_depth,%d",
|
2017-02-22 22:52:31 -08:00
|
|
|
it->item->expanded_depth);
|
2014-12-29 05:15:16 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), buf, "elm");
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((!calc) && (sd->decorate_all_mode) &&
|
2012-07-16 14:56:30 -07:00
|
|
|
(it->item->type != ELM_GENLIST_ITEM_GROUP))
|
2012-02-22 23:39:10 -08:00
|
|
|
{
|
2012-03-09 04:00:28 -08:00
|
|
|
if (it->itc->decorate_all_item_style)
|
2012-02-22 23:39:10 -08:00
|
|
|
{
|
2012-06-18 02:54:00 -07:00
|
|
|
if (!it->deco_all_view)
|
|
|
|
_decorate_all_item_realize(it, EINA_FALSE);
|
2012-04-06 00:10:26 -07:00
|
|
|
edje_object_message_signal_process(it->deco_all_view);
|
2012-02-22 23:39:10 -08:00
|
|
|
}
|
|
|
|
}
|
2013-12-02 02:43:46 -08:00
|
|
|
|
2013-11-29 02:18:00 -08:00
|
|
|
if (it->decorate_it_set) _decorate_item_set(it);
|
2013-12-02 02:43:46 -08:00
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_message_signal_process(VIEW(it));
|
2018-03-11 13:08:42 -07:00
|
|
|
|
|
|
|
if (sd->focus_on_realization == it)
|
|
|
|
{
|
|
|
|
_elm_widget_item_highlight_in_theme(WIDGET(it), EO_OBJ(it));
|
|
|
|
_elm_widget_highlight_in_theme_update(WIDGET(it));
|
|
|
|
_elm_widget_focus_highlight_start(WIDGET(it));
|
|
|
|
efl_ui_focus_manager_focus_set(WIDGET(it), EO_OBJ(it));
|
|
|
|
sd->focus_on_realization = NULL;
|
|
|
|
}
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_tree_effect_animator_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2009-02-11 03:49:43 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
int in = 0;
|
|
|
|
const Eina_List *l;
|
|
|
|
int y = 0, dy = 0, dh = 0;
|
|
|
|
double effect_duration = 0.3, t;
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool end = EINA_FALSE, vis = EINA_TRUE;
|
|
|
|
Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
|
|
|
|
Elm_Gen_Item *it = NULL, *it2, *expanded_next_it;
|
2014-11-19 02:53:40 -08:00
|
|
|
Elm_Object_Item *eo_it = NULL, *eo_it2;
|
2012-04-20 01:44:48 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
t = ((0.0 > (t = ecore_time_get() - sd->start_time)) ? 0.0 : t);
|
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
|
|
|
evas_output_viewport_get
|
|
|
|
(evas_object_evas_get(sd->pan_obj), &cvx, &cvy, &cvw, &cvh);
|
|
|
|
if (t > effect_duration) end = EINA_TRUE;
|
|
|
|
|
|
|
|
// Below while statement is needed, when the genlist is resized.
|
|
|
|
it2 = sd->expanded_item;
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = EO_OBJ(it2);
|
|
|
|
while (eo_it2 && vis)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
it2 = efl_data_scope_get(eo_it2, ELM_GENLIST_ITEM_CLASS);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_move(VIEW(it2), it2->item->scrl_x, it2->item->scrl_y);
|
|
|
|
vis = (ELM_RECTS_INTERSECT(it2->item->scrl_x, it2->item->scrl_y,
|
|
|
|
it2->item->w, it2->item->h, cvx, cvy, cvw,
|
|
|
|
cvh));
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = elm_genlist_item_prev_get(eo_it2);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
2009-02-25 12:18:38 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->expanded_next_item)
|
2009-02-11 03:49:43 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
expanded_next_it = sd->expanded_next_item;
|
|
|
|
|
|
|
|
/* move items */
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->move_items, l, it)
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND)
|
2010-01-23 01:07:20 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
expanded_next_it->item->old_scrl_y =
|
|
|
|
sd->expanded_item->item->old_scrl_y
|
|
|
|
+ sd->expanded_item->item->h;
|
|
|
|
if (expanded_next_it->item->scrl_y <=
|
|
|
|
expanded_next_it->item->old_scrl_y) /* did not
|
|
|
|
* calculate
|
|
|
|
* next item
|
|
|
|
* position */
|
|
|
|
expanded_next_it->item->scrl_y = cvy + cvh;
|
|
|
|
|
|
|
|
dy = ((expanded_next_it->item->scrl_y >= (cvy + cvh)) ?
|
|
|
|
cvy + cvh : expanded_next_it->item->scrl_y) -
|
|
|
|
expanded_next_it->item->old_scrl_y;
|
2010-01-23 01:07:20 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT)
|
2010-01-23 01:07:20 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (expanded_next_it->item->scrl_y >
|
|
|
|
expanded_next_it->item->old_scrl_y) /* did not
|
|
|
|
* calculate
|
|
|
|
* next item
|
|
|
|
* position */
|
|
|
|
expanded_next_it->item->old_scrl_y = cvy + cvh;
|
|
|
|
|
|
|
|
if (expanded_next_it->item->old_scrl_y > (cvy + cvh))
|
2012-05-15 22:28:40 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
dy = (sd->expanded_item->item->scrl_y +
|
|
|
|
sd->expanded_item->item->h) - cvy + cvh;
|
|
|
|
expanded_next_it->item->old_scrl_y = cvy + cvh;
|
2012-05-15 22:28:40 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
dy = (sd->expanded_item->item->scrl_y +
|
|
|
|
sd->expanded_item->item->h) -
|
|
|
|
expanded_next_it->item->old_scrl_y;
|
2012-05-15 22:28:40 -07:00
|
|
|
}
|
2010-01-23 01:07:20 -08:00
|
|
|
}
|
2009-02-11 03:49:43 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (t <= effect_duration)
|
|
|
|
{
|
|
|
|
y = ((1 - (1 - (t / effect_duration)) *
|
|
|
|
(1 - (t / effect_duration))) * dy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
end = EINA_TRUE;
|
|
|
|
y = dy;
|
|
|
|
}
|
2009-02-11 03:49:43 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->realized && !it->item->queued)
|
|
|
|
_item_realize(it, in, 0);
|
2017-02-26 21:27:24 -08:00
|
|
|
if (!it->hide) in++;
|
2009-02-25 11:50:45 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it != expanded_next_it)
|
2011-01-05 21:13:11 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->old_scrl_y =
|
|
|
|
expanded_next_it->item->old_scrl_y +
|
|
|
|
expanded_next_it->item->h + dh;
|
|
|
|
|
|
|
|
dh += it->item->h;
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if ((it->item->old_scrl_y + y) < (cvy + cvh))
|
|
|
|
_item_position(it, VIEW(it), it->item->scrl_x,
|
|
|
|
it->item->old_scrl_y + y);
|
2009-10-07 07:02:55 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
/* tree effect */
|
|
|
|
_item_tree_effect(sd, y);
|
2010-03-26 21:17:01 -07:00
|
|
|
}
|
|
|
|
else
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
int expanded_item_num = 0;
|
|
|
|
int num = 0;
|
2009-02-11 03:49:43 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->expanded_item)
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_genlist_item_next_get(EO_OBJ(sd->expanded_item));
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = eo_it;
|
|
|
|
while (eo_it2)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
expanded_item_num++;
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = elm_genlist_item_next_get(eo_it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
while (eo_it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
it = efl_data_scope_get(eo_it, ELM_GENLIST_ITEM_CLASS);
|
2012-07-16 14:56:30 -07:00
|
|
|
num++;
|
|
|
|
if (sd->expanded_item->item->expanded_depth >=
|
|
|
|
it->item->expanded_depth) break;
|
|
|
|
if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND)
|
|
|
|
{
|
|
|
|
if (!it->item->tree_effect_finished)
|
|
|
|
{
|
|
|
|
if (t >= (((num - 1) * effect_duration) /
|
|
|
|
expanded_item_num))
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
//XXX: for compat
|
|
|
|
edje_object_signal_emit(VIEW(it), "flip_item", "");
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_FLIP_ITEM,
|
|
|
|
"elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position(it, VIEW(it), it->item->scrl_x,
|
|
|
|
it->item->scrl_y);
|
|
|
|
it->item->tree_effect_finished = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_genlist_item_next_get(eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (end)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_tree_effect_finish(sd);
|
2016-01-28 17:07:34 -08:00
|
|
|
_elm_genlist_tree_effect_stop(sd);
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
|
|
|
_group_items_recalc(void *data)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Gen_Item *git;
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Data *sd = data;
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
Evas_Coord vy;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->group_items, l, git)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (git->item->want_realize)
|
|
|
|
{
|
2017-02-23 00:10:16 -08:00
|
|
|
if (!git->realized) _item_realize(git, git->item->order_num_in, EINA_FALSE);
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (sd->pin_item && git == sd->pin_item->item->group_item &&
|
|
|
|
sd->pin_item->item->scrl_y <= (git->item->scrl_y + git->item->h))
|
|
|
|
{
|
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(sd->obj, NULL, &vy, NULL, NULL);
|
|
|
|
if ((git->item->scrl_y + git->item->h) > vy)
|
|
|
|
{
|
|
|
|
sd->pin_item->item->scrl_y = git->item->scrl_y + git->item->h;
|
|
|
|
evas_object_move(VIEW(sd->pin_item),
|
|
|
|
sd->pin_item->item->scrl_x, sd->pin_item->item->scrl_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->pin_item && sd->pin_item_top && git != sd->pin_item->item->group_item &&
|
|
|
|
(git->item->scrl_y < (sd->pin_item->item->scrl_y + sd->pin_item->item->h)))
|
|
|
|
git->item->scrl_y = sd->pin_item->item->scrl_y + sd->pin_item->item->h;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_resize(VIEW(git), sd->minw, git->item->h);
|
|
|
|
evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
|
2013-06-22 23:17:39 -07:00
|
|
|
evas_object_stack_above(VIEW(git), sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_show(VIEW(git));
|
|
|
|
}
|
|
|
|
else if (!git->item->want_realize && git->realized)
|
|
|
|
{
|
|
|
|
if (!git->dragging)
|
|
|
|
_elm_genlist_item_unrealize(git, EINA_FALSE);
|
|
|
|
}
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2011-06-03 18:52:08 -07:00
|
|
|
_reorder_move_animator_cb(void *data)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
double t;
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
2011-06-01 20:10:11 -07:00
|
|
|
Eina_Bool down = EINA_FALSE;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
int y, dy = it->item->h / 10 * elm_config_scale_get(), diff;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
t = ((0.0 > (t = ecore_loop_time_get()
|
2013-05-02 11:13:36 -07:00
|
|
|
- sd->start_time)) ? 0.0 : t);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (t <= REORDER_EFFECT_TIME)
|
|
|
|
y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
|
2011-06-01 20:10:11 -07:00
|
|
|
else y = dy;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
diff = abs(it->item->old_scrl_y - it->item->scrl_y);
|
2012-09-02 23:20:47 -07:00
|
|
|
if (diff < dy) y = diff;
|
|
|
|
else if (diff > it->item->h) y = diff / 2;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->item->old_scrl_y < it->item->scrl_y)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->old_scrl_y += y;
|
2011-06-01 20:10:11 -07:00
|
|
|
down = EINA_TRUE;
|
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
else if (it->item->old_scrl_y > it->item->scrl_y)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->old_scrl_y -= y;
|
2011-06-01 20:10:11 -07:00
|
|
|
down = EINA_FALSE;
|
|
|
|
}
|
2012-02-22 23:39:10 -08:00
|
|
|
|
2012-04-06 00:10:26 -07:00
|
|
|
if (it->deco_all_view)
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position
|
|
|
|
(it, it->deco_all_view, it->item->scrl_x, it->item->old_scrl_y);
|
2012-02-22 23:39:10 -08:00
|
|
|
else
|
|
|
|
_item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
|
2013-05-02 11:13:36 -07:00
|
|
|
_group_items_recalc(sd);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->reorder_pan_move) ||
|
2011-10-21 01:52:03 -07:00
|
|
|
(down && it->item->old_scrl_y >= it->item->scrl_y) ||
|
|
|
|
(!down && it->item->old_scrl_y <= it->item->scrl_y))
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->old_scrl_y = it->item->scrl_y;
|
|
|
|
it->item->move_effect_enabled = EINA_FALSE;
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->reorder_move_animator = NULL;
|
2011-06-01 20:10:11 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2011-06-01 20:10:11 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static int
|
|
|
|
_reorder_item_space_get(Elm_Gen_Item *it)
|
2011-04-21 04:47:36 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Elm_Gen_Item *reorder_it = sd->reorder_it;
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Coord rox, roy, row, roh, oy, oh;
|
|
|
|
Eina_Bool top = EINA_FALSE;
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!reorder_it) return 0;
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, &oy, NULL, &oh);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_geometry_get
|
2013-05-02 11:13:36 -07:00
|
|
|
(sd->VIEW(reorder_it), &rox, &roy, &row, &roh);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->reorder_start_y < it->item->block->y) &&
|
|
|
|
(roy - oy + (roh / 2) >= it->item->block->y - sd->pan_y))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
it->item->block->reorder_offset =
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->reorder_it->item->h * -1;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->block->count == 1)
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->reorder_rel = it;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2013-05-02 11:13:36 -07:00
|
|
|
else if ((sd->reorder_start_y >= it->item->block->y) &&
|
|
|
|
(roy - oy + (roh / 2) <= it->item->block->y - sd->pan_y))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
it->item->block->reorder_offset = sd->reorder_it->item->h;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
it->item->block->reorder_offset = 0;
|
|
|
|
|
|
|
|
it->item->scrl_y += it->item->block->reorder_offset;
|
|
|
|
|
|
|
|
top = (ELM_RECTS_INTERSECT
|
|
|
|
(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
|
|
|
|
rox, roy + (roh / 2), row, 1));
|
|
|
|
if (top)
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->reorder_rel = it;
|
|
|
|
it->item->scrl_y += sd->reorder_it->item->h;
|
|
|
|
return sd->reorder_it->item->h;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return 0;
|
2011-04-21 04:47:36 -07:00
|
|
|
}
|
|
|
|
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
static void
|
|
|
|
_pin_item_recalc(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Coord vx, vy, vw, vh;
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
sd->pin_item_top = EINA_FALSE;
|
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(sd->obj, &vx, &vy, &vw, &vh);
|
|
|
|
if (it->item->scrl_x < vx)
|
|
|
|
it->item->scrl_x = vx;
|
|
|
|
else if (it->item->scrl_x + it->item->w > vx + vw)
|
|
|
|
it->item->scrl_x = vx + vw - it->item->w;
|
|
|
|
|
|
|
|
if (it->item->scrl_y < vy)
|
|
|
|
{
|
|
|
|
sd->pin_item_top = EINA_TRUE;
|
|
|
|
it->item->scrl_y = vy;
|
|
|
|
}
|
|
|
|
else if (it->item->scrl_y + it->item->h > vy + vh)
|
|
|
|
it->item->scrl_y = vy + vh - it->item->h;
|
|
|
|
|
|
|
|
evas_object_resize(VIEW(it), it->item->w, it->item->h);
|
|
|
|
evas_object_move(VIEW(it), it->item->scrl_x, it->item->scrl_y);
|
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
}
|
|
|
|
|
2009-02-11 03:49:43 -08:00
|
|
|
static void
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_block_position(Item_Block *itb, const int blk_idx)
|
2009-02-11 03:49:43 -08:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Elm_Gen_Item *git;
|
2012-07-16 14:56:30 -07:00
|
|
|
const Eina_List *l;
|
2011-11-29 00:54:19 -08:00
|
|
|
Eina_Bool vis = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Data *sd = NULL;
|
2017-02-26 21:27:24 -08:00
|
|
|
int vis_count = 0;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get((itb->sd)->obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_geometry_get(itb->sd->pan_obj, &ox, &oy, &ow, &oh);
|
|
|
|
evas_output_viewport_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(evas_object_evas_get((itb->sd)->obj),
|
2012-07-16 14:56:30 -07:00
|
|
|
&cvx, &cvy, &cvw, &cvh);
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2009-02-11 03:49:43 -08:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
sd = it->item->wsd;
|
2015-01-08 06:03:52 -08:00
|
|
|
if (sd->reorder_it == it) continue;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-04-13 00:40:28 -07:00
|
|
|
if (!it->filtered && sd->filter_data && it->itc->func.filter_get)
|
|
|
|
_item_filtered_get(it);
|
2015-09-23 04:50:05 -07:00
|
|
|
if (it->hide)
|
|
|
|
{
|
|
|
|
if (it->realized) evas_object_hide(VIEW(it));
|
|
|
|
continue;
|
|
|
|
}
|
2010-10-15 04:51:15 -07:00
|
|
|
it->x = 0;
|
|
|
|
it->y = y;
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->w = itb->w;
|
2013-05-02 11:13:36 -07:00
|
|
|
it->item->scrl_x = itb->x + it->x - sd->pan_x + ox;
|
|
|
|
it->item->scrl_y = itb->y + it->y - sd->pan_y + oy;
|
2011-01-05 21:13:11 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
vis = (ELM_RECTS_INTERSECT
|
|
|
|
(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
|
|
|
|
cvx, cvy, cvw, cvh));
|
2017-02-22 22:52:31 -08:00
|
|
|
if (!(it->item->type & ELM_GENLIST_ITEM_GROUP))
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2011-01-05 21:13:11 -08:00
|
|
|
if ((itb->realized) && (!it->realized))
|
2010-10-15 04:51:15 -07:00
|
|
|
{
|
2017-02-26 21:27:24 -08:00
|
|
|
if (vis) _item_realize(it, blk_idx + vis_count, EINA_FALSE);
|
|
|
|
}
|
|
|
|
if ((blk_idx + vis_count) != it->item->order_num_in)
|
|
|
|
{
|
|
|
|
_item_order_update(it, blk_idx + vis_count, EINA_TRUE);
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2011-01-05 21:13:11 -08:00
|
|
|
if (it->realized)
|
2009-10-07 07:02:55 -07:00
|
|
|
{
|
2012-03-05 17:10:46 -08:00
|
|
|
if (vis || it->dragging)
|
2011-01-05 21:13:11 -08:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->reorder_mode)
|
2012-07-16 14:56:30 -07:00
|
|
|
y += _reorder_item_space_get(it);
|
2011-10-21 01:52:03 -07:00
|
|
|
git = it->item->group_item;
|
2011-01-05 21:13:11 -08:00
|
|
|
if (git)
|
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (git->item->scrl_y < oy)
|
|
|
|
git->item->scrl_y = oy;
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((git->item->scrl_y + git->item->h) >
|
|
|
|
(it->item->scrl_y + it->item->h))
|
|
|
|
git->item->scrl_y = (it->item->scrl_y +
|
|
|
|
it->item->h) - git->item->h;
|
2012-06-17 10:20:23 -07:00
|
|
|
git->item->scrl_x = it->item->scrl_x;
|
2011-10-21 01:52:03 -07:00
|
|
|
git->item->want_realize = EINA_TRUE;
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->reorder_it) &&
|
2012-07-16 14:56:30 -07:00
|
|
|
(it->item->old_scrl_y != it->item->scrl_y))
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->item->move_effect_enabled)
|
2011-06-01 20:10:11 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->move_effect_enabled = EINA_TRUE;
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->reorder_move_animator =
|
2012-07-16 14:56:30 -07:00
|
|
|
ecore_animator_add(
|
|
|
|
_reorder_move_animator_cb, it);
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->item->move_effect_enabled)
|
2011-06-08 19:54:04 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->decorate_all_mode) &&
|
2012-07-16 14:56:30 -07:00
|
|
|
(it->itc->decorate_all_item_style))
|
|
|
|
_decorate_all_item_position
|
|
|
|
(it, it->item->scrl_x, it->item->scrl_y);
|
2011-08-03 00:16:20 -07:00
|
|
|
else
|
2012-02-22 23:39:10 -08:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if (!sd->tree_effect_enabled ||
|
|
|
|
(sd->move_effect_mode ==
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_TREE_EFFECT_NONE) ||
|
2013-05-02 11:13:36 -07:00
|
|
|
((sd->move_effect_mode !=
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_TREE_EFFECT_NONE) &&
|
|
|
|
(it->item->old_scrl_y ==
|
|
|
|
it->item->scrl_y)))
|
2012-03-23 00:47:03 -07:00
|
|
|
{
|
2012-04-03 02:56:44 -07:00
|
|
|
if (it->item->deco_it_view)
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position
|
|
|
|
(it, it->item->deco_it_view,
|
|
|
|
it->item->scrl_x,
|
|
|
|
it->item->scrl_y);
|
2012-03-23 00:47:03 -07:00
|
|
|
else
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position
|
|
|
|
(it, VIEW(it), it->item->scrl_x,
|
|
|
|
it->item->scrl_y);
|
2012-03-23 00:47:03 -07:00
|
|
|
}
|
2012-02-22 23:39:10 -08:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->old_scrl_y = it->item->scrl_y;
|
2011-06-08 19:54:04 -07:00
|
|
|
}
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (!sd->tree_effect_animator && (it != sd->pin_item))
|
2012-03-07 04:15:36 -08:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_FALSE);
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
2009-10-07 07:02:55 -07:00
|
|
|
}
|
2010-10-15 04:51:15 -07:00
|
|
|
}
|
2011-01-31 00:30:11 -08:00
|
|
|
else
|
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (vis) it->item->want_realize = EINA_TRUE;
|
2011-01-31 00:30:11 -08:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
y += it->item->h;
|
2017-02-26 21:27:24 -08:00
|
|
|
vis_count++;
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
|
|
|
|
if (it == sd->pin_item)
|
|
|
|
_pin_item_recalc(it);
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get((itb->sd)->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj));
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
|
|
|
|
2018-08-02 06:42:06 -07:00
|
|
|
static inline void
|
|
|
|
_flush_block_order(Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
Item_Block *itb;
|
|
|
|
Eina_List *blocks = NULL;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
|
|
|
{
|
|
|
|
if (itb->adapter)
|
|
|
|
blocks = eina_list_append(blocks, itb->adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_ui_focus_manager_calc_update_order(sd->obj, sd->obj, blocks);
|
|
|
|
}
|
|
|
|
|
2011-01-05 21:13:11 -08:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_block_realize(Item_Block *itb)
|
2011-01-05 21:13:11 -08:00
|
|
|
{
|
2018-08-02 06:42:06 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Eina_List *n;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (itb->realized) return;
|
|
|
|
|
|
|
|
itb->realized = EINA_TRUE;
|
|
|
|
itb->want_unrealize = EINA_FALSE;
|
2018-08-02 06:42:06 -07:00
|
|
|
|
|
|
|
if (!itb->adapter)
|
|
|
|
{
|
|
|
|
itb->adapter = efl_add(EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS, itb->sd->obj);
|
2018-08-06 21:25:34 -07:00
|
|
|
efl_ui_focus_composition_adapter_focus_manager_parent_set(itb->adapter, itb->sd->obj);
|
|
|
|
efl_ui_focus_composition_adapter_focus_manager_object_set(itb->adapter, itb->sd->obj);
|
2018-08-02 06:42:06 -07:00
|
|
|
efl_ui_focus_manager_calc_register_logical(itb->sd->obj, itb->adapter, itb->sd->obj, NULL);
|
|
|
|
_flush_block_order(itb->sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(itb->items, n, it)
|
|
|
|
{
|
|
|
|
efl_ui_focus_manager_calc_register_logical(itb->sd->obj, EO_OBJ(it), itb->adapter, NULL);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2016-01-28 17:07:34 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_genlist_tree_effect_setup(Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
if (!sd->tree_effect_animator)
|
|
|
|
{
|
|
|
|
_item_tree_effect_before(sd->expanded_item);
|
|
|
|
evas_object_raise(sd->event_block_rect);
|
|
|
|
evas_object_stack_below(sd->event_block_rect, sd->stack[1]);
|
|
|
|
evas_object_show(sd->event_block_rect);
|
|
|
|
sd->start_time = ecore_time_get();
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add(sd->obj, EFL_EVENT_ANIMATOR_TICK, _tree_effect_animator_cb, sd->obj);
|
2016-01-28 17:07:34 -08:00
|
|
|
sd->tree_effect_animator = 1;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_genlist_tree_effect_stop(Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
if (sd->tree_effect_animator)
|
|
|
|
{
|
|
|
|
sd->tree_effect_animator = 0;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(sd->obj, EFL_EVENT_ANIMATOR_TICK, _tree_effect_animator_cb, sd->obj);
|
2016-01-28 17:07:34 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_genlist_pan_efl_canvas_group_group_calculate(Eo *obj, Elm_Genlist_Pan_Data *psd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
|
2012-10-01 01:55:46 -07:00
|
|
|
Evas_Coord vx = 0, vy = 0, vw = 0, vh = 0;
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *git;
|
2012-07-16 14:56:30 -07:00
|
|
|
Item_Block *itb;
|
|
|
|
Eina_List *l;
|
|
|
|
int in = 0;
|
2011-01-05 21:13:11 -08:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Data *sd = psd->wsd;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
if (sd->pan_changed)
|
2011-01-05 21:13:11 -08:00
|
|
|
{
|
2014-03-08 11:09:22 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
|
|
|
sd->calc_job = NULL;
|
|
|
|
_calc_job(sd->obj);
|
|
|
|
sd->pan_changed = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
|
|
|
|
evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
|
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
if (sd->tree_effect_enabled &&
|
|
|
|
(sd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2016-01-28 17:07:34 -08:00
|
|
|
_elm_genlist_tree_effect_setup(sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-03-08 11:09:22 -08:00
|
|
|
itb->w = sd->minw;
|
|
|
|
if (ELM_RECTS_INTERSECT(itb->x - sd->pan_x + ox,
|
|
|
|
itb->y - sd->pan_y + oy,
|
2012-07-16 14:56:30 -07:00
|
|
|
itb->w, itb->h,
|
|
|
|
cvx, cvy, cvw, cvh))
|
2011-01-05 21:13:11 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((!itb->realized) || (itb->changed))
|
|
|
|
_item_block_realize(itb);
|
|
|
|
_item_block_position(itb, in);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (itb->realized) _item_block_unrealize(itb);
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (sd->pin_item && itb == sd->pin_item->item->block)
|
|
|
|
{
|
|
|
|
if (!sd->pin_item->realized)
|
|
|
|
_item_realize(sd->pin_item, sd->pin_item->item->order_num_in, EINA_FALSE);
|
|
|
|
sd->pin_item->item->w = itb->w;
|
|
|
|
sd->pin_item->item->scrl_x = itb->x - sd->pan_x + ox;
|
|
|
|
sd->pin_item->item->scrl_y = itb->y - sd->pan_y + oy;
|
|
|
|
_pin_item_recalc(sd->pin_item);
|
|
|
|
}
|
2011-01-05 21:13:11 -08:00
|
|
|
}
|
2017-02-23 00:10:16 -08:00
|
|
|
in += itb->vis_count;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2014-03-08 11:09:22 -08:00
|
|
|
if ((!sd->reorder_it) || (sd->reorder_pan_move))
|
|
|
|
_group_items_recalc(sd);
|
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-03-08 11:09:22 -08:00
|
|
|
if (sd->pan_y != sd->reorder_old_pan_y)
|
|
|
|
sd->reorder_pan_move = EINA_TRUE;
|
|
|
|
else sd->reorder_pan_move = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
evas_object_raise(sd->VIEW(reorder_it));
|
|
|
|
evas_object_stack_below(sd->VIEW(reorder_it), sd->stack[1]);
|
|
|
|
sd->reorder_old_pan_y = sd->pan_y;
|
|
|
|
sd->start_time = ecore_loop_time_get();
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
if (!sd->tree_effect_enabled ||
|
|
|
|
(sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_NONE))
|
|
|
|
_item_auto_scroll(sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_get((sd)->obj, &vx, &vy);
|
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
((sd)->obj, NULL, NULL, &vw, &vh);
|
2012-10-01 01:55:46 -07:00
|
|
|
|
2014-03-08 11:09:22 -08:00
|
|
|
if (sd->reorder_fast == 1)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show((sd)->obj, vx, vy - 10, vw, vh);
|
2014-03-08 11:09:22 -08:00
|
|
|
else if (sd->reorder_fast == -1)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show((sd)->obj, vx, vy + 10, vw, vh);
|
2012-10-01 01:55:46 -07:00
|
|
|
|
2014-07-21 23:56:16 -07:00
|
|
|
if (sd->focused_item && !sd->item_loop_enable)
|
2014-03-08 08:04:34 -08:00
|
|
|
_elm_widget_focus_highlight_start(psd->wobj);
|
|
|
|
|
2015-06-22 02:54:53 -07:00
|
|
|
EINA_LIST_FOREACH(sd->group_items, l, git)
|
|
|
|
{
|
|
|
|
git->item->want_realize = EINA_FALSE;
|
|
|
|
if (git->realized) evas_object_raise(VIEW(git));
|
|
|
|
}
|
|
|
|
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (sd->pin_item)
|
|
|
|
evas_object_raise(VIEW(sd->pin_item));
|
2016-04-19 02:41:43 -07:00
|
|
|
//update item before the render to prevent delayed update by job.
|
|
|
|
if (sd->update_job)
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(sd->update_job, ecore_job_del);
|
|
|
|
_update_job(sd->obj);
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2015-07-29 13:20:40 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(psd->wobj, ELM_INTERFACE_SCROLLABLE_EVENT_CHANGED, NULL);
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_genlist_pan_efl_object_destructor(Eo *obj, Elm_Genlist_Pan_Data *psd)
|
2013-04-24 04:41:37 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_data_unref(psd->wobj, psd->wsd);
|
|
|
|
efl_destructor(efl_super(obj, MY_PAN_CLASS));
|
2013-04-24 04:41:37 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_genlist_pan_class_constructor(Efl_Class *klass)
|
2014-04-01 03:55:08 -07:00
|
|
|
{
|
2013-11-07 06:29:38 -08:00
|
|
|
evas_smart_legacy_type_register(MY_PAN_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_multi_select_up(Elm_Genlist_Data *sd)
|
2011-12-23 20:20:18 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_prev;
|
2011-12-23 20:20:18 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
if (!sd->multi) return EINA_FALSE;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_prev = elm_genlist_item_prev_get(sd->last_selected_item);
|
|
|
|
while (eo_prev)
|
2014-03-23 08:49:06 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_prev, prev);
|
2015-09-23 04:50:05 -07:00
|
|
|
if ((!_is_no_select(prev)) &&
|
|
|
|
(!elm_object_item_disabled_get(eo_prev)) && (!prev->hide))
|
2014-03-23 08:49:06 -07:00
|
|
|
break;
|
2017-10-24 00:53:18 -07:00
|
|
|
eo_prev = EO_OBJ(ELM_GEN_ITEM_PREV(prev));
|
2014-03-23 08:49:06 -07:00
|
|
|
}
|
2014-12-29 22:44:19 -08:00
|
|
|
if (!eo_prev) return EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (elm_genlist_item_selected_get(eo_prev))
|
2011-12-23 20:20:18 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
2014-09-27 22:15:28 -07:00
|
|
|
sd->last_selected_item = eo_prev;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-12-23 20:20:18 -08:00
|
|
|
else
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_selected_set(eo_prev, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
2011-12-23 20:20:18 -08:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_multi_select_down(Elm_Genlist_Data *sd)
|
2009-02-10 03:57:47 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_next;
|
2010-10-07 12:57:20 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
if (!sd->multi) return EINA_FALSE;
|
2012-02-13 00:50:18 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_next = elm_genlist_item_next_get(sd->last_selected_item);
|
|
|
|
while ((eo_next))
|
2014-03-23 08:49:06 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_next, next);
|
2015-09-23 04:50:05 -07:00
|
|
|
if ((!_is_no_select(next)) &&
|
|
|
|
(!elm_object_item_disabled_get(eo_next)) && (!next->hide))
|
2014-03-23 08:49:06 -07:00
|
|
|
break;
|
2017-10-24 00:53:18 -07:00
|
|
|
eo_next = EO_OBJ(ELM_GEN_ITEM_NEXT(next));
|
2014-03-23 08:49:06 -07:00
|
|
|
}
|
2014-12-29 22:43:20 -08:00
|
|
|
if (!eo_next) return EINA_TRUE;
|
2010-10-07 12:57:20 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (elm_genlist_item_selected_get(eo_next))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
2014-09-27 22:15:28 -07:00
|
|
|
sd->last_selected_item = eo_next;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_selected_set(eo_next, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-03-22 00:54:24 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_all_items_deselect(Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
2014-03-23 07:37:47 -07:00
|
|
|
sd->deselecting = eina_list_clone(sd->selected);
|
|
|
|
while (sd->deselecting)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *it = eina_list_data_get(sd->deselecting);
|
|
|
|
|
|
|
|
sd->deselecting = eina_list_remove_list(sd->deselecting, sd->deselecting);
|
|
|
|
elm_genlist_item_selected_set(it, EINA_FALSE);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_single_select_up(Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-03-23 08:49:06 -07:00
|
|
|
Elm_Gen_Item *prev = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!sd->selected)
|
2014-03-23 08:49:06 -07:00
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_prev = elm_genlist_item_prev_get
|
|
|
|
(sd->last_selected_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
prev = efl_data_scope_get(eo_prev, ELM_GENLIST_ITEM_CLASS);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2014-03-23 08:49:06 -07:00
|
|
|
|
|
|
|
while (prev)
|
|
|
|
{
|
2015-01-08 06:03:52 -08:00
|
|
|
if ((!_is_no_select(prev)) &&
|
2015-09-23 04:50:05 -07:00
|
|
|
(!elm_object_item_disabled_get(EO_OBJ(prev))) && (!prev->hide))
|
2014-03-23 08:49:06 -07:00
|
|
|
break;
|
2017-10-24 00:53:18 -07:00
|
|
|
prev = ELM_GEN_ITEM_PREV(prev);
|
2014-03-23 08:49:06 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!prev) return EINA_FALSE;
|
|
|
|
|
|
|
|
_all_items_deselect(sd);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_selected_set(EO_OBJ(prev), EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_single_select_down(Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-03-23 08:49:06 -07:00
|
|
|
Elm_Gen_Item *next = NULL;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_next = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!sd->selected)
|
2014-03-23 08:49:06 -07:00
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
else
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_next = elm_genlist_item_next_get(sd->last_selected_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
next = efl_data_scope_get(eo_next, ELM_GENLIST_ITEM_CLASS);
|
2014-03-23 08:49:06 -07:00
|
|
|
}
|
|
|
|
|
2015-08-18 21:41:53 -07:00
|
|
|
while (next)
|
2014-03-23 08:49:06 -07:00
|
|
|
{
|
2015-01-08 06:03:52 -08:00
|
|
|
if ((!_is_no_select(next)) &&
|
2015-09-23 04:50:05 -07:00
|
|
|
(!elm_object_item_disabled_get(EO_OBJ(next))) && (!next->hide))
|
2014-03-23 08:49:06 -07:00
|
|
|
break;
|
2017-10-24 00:53:18 -07:00
|
|
|
next = ELM_GEN_ITEM_NEXT(next);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!next) return EINA_FALSE;
|
|
|
|
|
|
|
|
_all_items_deselect(sd);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_selected_set(EO_OBJ(next), EINA_TRUE);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:28 -07:00
|
|
|
_elm_genlist_item_focused(Elm_Object_Item *eo_it)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2014-03-08 08:04:34 -08:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-03-23 07:29:16 -07:00
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-09-27 22:15:28 -07:00
|
|
|
(eo_it == sd->focused_item) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
(elm_wdg_item_disabled_get(eo_it)))
|
2014-03-08 08:04:34 -08:00
|
|
|
return;
|
|
|
|
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (it != sd->pin_item)
|
2014-05-11 06:42:45 -07:00
|
|
|
{
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
switch (_elm_config->focus_autoscroll_mode)
|
|
|
|
{
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
|
|
|
|
elm_genlist_item_show(eo_it,
|
|
|
|
ELM_GENLIST_ITEM_SCROLLTO_IN);
|
|
|
|
break;
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
|
|
|
|
elm_genlist_item_bring_in(eo_it,
|
|
|
|
ELM_GENLIST_ITEM_SCROLLTO_IN);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-05-11 06:42:45 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
sd->focused_item = eo_it;
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2015-03-11 03:59:58 -07:00
|
|
|
if (it->realized)
|
2015-09-28 01:04:02 -07:00
|
|
|
_elm_genlist_item_focus_update(it);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_ITEM_FOCUSED, eo_it);
|
2014-10-02 09:37:53 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_FOCUSED, EINA_TRUE);
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:28 -07:00
|
|
|
_elm_genlist_item_unfocused(Elm_Object_Item *eo_it)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2015-01-06 21:38:25 -08:00
|
|
|
if (!eo_it) return;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 07:29:16 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
if (_is_no_select(it))
|
2014-03-08 08:04:34 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if ((!sd->focused_item) ||
|
2014-09-27 22:15:28 -07:00
|
|
|
(eo_it != sd->focused_item))
|
2014-03-08 08:04:34 -08:00
|
|
|
return;
|
|
|
|
|
2014-03-23 07:29:16 -07:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj))
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(focus_it), SIGNAL_UNFOCUSED, "elm");
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
|
|
|
|
sd->focused_item = NULL;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_ITEM_UNFOCUSED, eo_it);
|
2014-10-02 09:37:53 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_FOCUSED, EINA_FALSE);
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_focused_next(Evas_Object *obj, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
Elm_Gen_Item *next;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_next;
|
|
|
|
Elm_Object_Item *eo_first_item;
|
|
|
|
Elm_Object_Item *eo_last_item;
|
2014-03-08 08:04:34 -08:00
|
|
|
|
|
|
|
if (!sd->focused_item)
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_UP)
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
while ((next) &&
|
2016-03-02 04:10:48 -08:00
|
|
|
((elm_wdg_item_disabled_get(EO_OBJ(next))) ||
|
2015-05-21 22:33:10 -07:00
|
|
|
(_is_no_select(next))))
|
2017-10-24 00:53:18 -07:00
|
|
|
if (!next->hide) next = ELM_GEN_ITEM_NEXT(next);
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2014-03-08 08:04:34 -08:00
|
|
|
if (dir == ELM_FOCUS_UP)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_first_item = elm_genlist_first_item_get(WIDGET(focus_it));
|
|
|
|
if (eo_first_item == sd->focused_item) return EINA_FALSE;
|
|
|
|
eo_next = elm_genlist_item_prev_get(sd->focused_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
next = efl_data_scope_get(eo_next, ELM_GENLIST_ITEM_CLASS);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2015-05-21 22:33:10 -07:00
|
|
|
while ((next) &&
|
2016-03-02 04:10:48 -08:00
|
|
|
((elm_wdg_item_disabled_get(eo_next)) ||
|
2015-05-21 22:33:10 -07:00
|
|
|
(_is_no_select(next))))
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
eo_next = elm_genlist_item_prev_get(eo_next);
|
2016-08-15 06:44:41 -07:00
|
|
|
next = efl_data_scope_get(eo_next, ELM_GENLIST_ITEM_CLASS);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_last_item = elm_genlist_last_item_get(WIDGET(focus_it));
|
|
|
|
if (eo_last_item == sd->focused_item) return EINA_FALSE;
|
|
|
|
eo_next = elm_genlist_item_next_get(sd->focused_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
next = efl_data_scope_get(eo_next, ELM_GENLIST_ITEM_CLASS);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2015-05-21 22:33:10 -07:00
|
|
|
while ((next) &&
|
2016-03-02 04:10:48 -08:00
|
|
|
((elm_wdg_item_disabled_get(eo_next)) ||
|
2015-05-21 22:33:10 -07:00
|
|
|
(_is_no_select(next))))
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
eo_next = elm_genlist_item_next_get(eo_next);
|
2016-08-15 06:44:41 -07:00
|
|
|
next = efl_data_scope_get(eo_next, ELM_GENLIST_ITEM_CLASS);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!next) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-02-20 02:00:49 -08:00
|
|
|
static void
|
2014-03-07 10:27:09 -08:00
|
|
|
_elm_genlist_item_content_focus_set(Elm_Gen_Item *it, Elm_Focus_Direction dir)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
|
|
|
Evas_Object *focused_obj = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
if (!it) return;
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
if (!it->item->wsd->focus_on_selection_enabled) return;
|
2013-02-20 02:00:49 -08:00
|
|
|
|
|
|
|
if (!it->item_focus_chain)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(VIEW(it), EINA_TRUE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(it->item_focus_chain, l, focused_obj)
|
|
|
|
if (elm_object_focus_get(focused_obj)) break;
|
|
|
|
|
2017-09-26 16:26:33 -07:00
|
|
|
/* FOCUS-FIXME
|
2013-02-20 02:00:49 -08:00
|
|
|
if (focused_obj && (dir != ELM_FOCUS_PREVIOUS))
|
|
|
|
{
|
|
|
|
Evas_Object *nextfocus;
|
2015-09-15 03:41:51 -07:00
|
|
|
Elm_Object_Item *nextfocus_item;
|
2017-10-23 22:03:46 -07:00
|
|
|
if (efl_ui_widget_focus_next_get(focused_obj, dir, &nextfocus, &nextfocus_item))
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
2015-09-15 03:41:51 -07:00
|
|
|
if (nextfocus_item)
|
|
|
|
elm_object_item_focus_set(nextfocus_item, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_focus_set(nextfocus, EINA_TRUE);
|
2013-02-20 02:00:49 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2017-09-26 16:26:33 -07:00
|
|
|
*/
|
2013-02-20 02:00:49 -08:00
|
|
|
|
|
|
|
if (!l) l = it->item_focus_chain;
|
|
|
|
|
|
|
|
if (dir == ELM_FOCUS_RIGHT)
|
|
|
|
{
|
|
|
|
l = eina_list_next(l);
|
|
|
|
if (!l) l = it->item_focus_chain;
|
|
|
|
}
|
|
|
|
else if (dir == ELM_FOCUS_LEFT)
|
|
|
|
{
|
|
|
|
l = eina_list_prev(l);
|
|
|
|
if (!l) l = eina_list_last(it->item_focus_chain);
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_object_focus_set(eina_list_data_get(l), EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2014-04-23 22:12:52 -07:00
|
|
|
static Eina_Bool
|
2014-04-26 19:21:46 -07:00
|
|
|
_key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
Elm_Object_Item *it = NULL;
|
|
|
|
Eina_Bool ret = EINA_FALSE;
|
|
|
|
Evas_Coord v = 0;
|
|
|
|
Evas_Coord min = 0;
|
2014-04-26 20:38:27 -07:00
|
|
|
Eina_Bool focus_only = EINA_FALSE;
|
2014-04-23 22:12:52 -07:00
|
|
|
|
|
|
|
// get content size and viewport size
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, NULL, &v);
|
|
|
|
elm_interface_scrollable_content_size_get(obj, NULL, &min);
|
2014-04-23 22:12:52 -07:00
|
|
|
|
2014-04-26 20:55:58 -07:00
|
|
|
if (_elm_config->item_select_on_focus_disable)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
2014-04-26 20:55:58 -07:00
|
|
|
ret = _item_focused_next(obj, dir);
|
2014-04-23 22:12:52 -07:00
|
|
|
}
|
2014-04-26 20:55:58 -07:00
|
|
|
else
|
2014-04-26 20:38:27 -07:00
|
|
|
{
|
2014-04-26 20:55:58 -07:00
|
|
|
if (multi)
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_UP)
|
|
|
|
ret = _item_multi_select_up(sd);
|
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
|
|
|
ret = _item_multi_select_down(sd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-23 03:46:35 -08:00
|
|
|
if ((sd->focused_item) && (dir == ELM_FOCUS_UP))
|
2014-04-26 20:55:58 -07:00
|
|
|
ret = _item_single_select_up(sd);
|
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
|
|
|
ret = _item_single_select_down(sd);
|
|
|
|
}
|
2014-04-26 20:38:27 -07:00
|
|
|
}
|
2014-04-23 22:12:52 -07:00
|
|
|
if (ret)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
2015-08-04 23:57:11 -07:00
|
|
|
focus_only = _elm_config->item_select_on_focus_disable;
|
2014-04-23 22:12:52 -07:00
|
|
|
// handle item loop feature
|
2014-07-21 23:11:17 -07:00
|
|
|
if (sd->item_loop_enable && !sd->item_looping_on)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
2017-06-29 20:18:33 -07:00
|
|
|
if (min < v)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_UP)
|
2014-07-21 23:11:17 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,looping,up", "elm");
|
|
|
|
sd->item_looping_on = EINA_TRUE;
|
|
|
|
}
|
2014-04-23 22:12:52 -07:00
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
2014-07-21 23:11:17 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,looping,down", "elm");
|
|
|
|
sd->item_looping_on = EINA_TRUE;
|
|
|
|
}
|
2014-04-23 22:12:52 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_UP)
|
2017-06-29 20:18:33 -07:00
|
|
|
{
|
|
|
|
it = elm_genlist_last_item_get(obj);
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(it, gen_it);
|
|
|
|
while (_is_no_select(gen_it) || elm_wdg_item_disabled_get(it))
|
|
|
|
it = elm_genlist_item_prev_get(it);
|
|
|
|
}
|
2014-05-10 07:15:54 -07:00
|
|
|
else if (dir == ELM_FOCUS_DOWN)
|
2017-06-29 20:18:33 -07:00
|
|
|
{
|
|
|
|
it = elm_genlist_first_item_get(obj);
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(it, gen_it);
|
|
|
|
while (_is_no_select(gen_it) || elm_wdg_item_disabled_get(it))
|
|
|
|
it = elm_genlist_item_next_get(it);
|
|
|
|
}
|
2014-04-23 22:12:52 -07:00
|
|
|
|
2014-04-26 20:38:27 -07:00
|
|
|
if (it && focus_only)
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
|
|
|
else if (it)
|
2014-04-23 22:12:52 -07:00
|
|
|
elm_genlist_item_selected_set(it, EINA_TRUE);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-07-21 23:11:17 -07:00
|
|
|
else if (sd->item_looping_on)
|
|
|
|
return EINA_TRUE;
|
2014-04-23 22:12:52 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-16 01:18:22 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-04-16 01:18:22 -07:00
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Coord x = 0;
|
|
|
|
Evas_Coord y = 0;
|
|
|
|
Evas_Coord v_w = 0;
|
|
|
|
Evas_Coord v_h = 0;
|
|
|
|
Evas_Coord step_x = 0;
|
|
|
|
Evas_Coord step_y = 0;
|
|
|
|
Evas_Coord page_x = 0;
|
|
|
|
Evas_Coord page_y = 0;
|
|
|
|
Elm_Object_Item *it = NULL;
|
|
|
|
Evas_Coord pan_max_x = 0, pan_max_y = 0;
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!sd->items) return EINA_FALSE;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_get(obj, &x, &y);
|
|
|
|
elm_interface_scrollable_step_size_get(obj, &step_x, &step_y);
|
|
|
|
elm_interface_scrollable_page_size_get(obj, &page_x, &page_y);
|
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &v_w, &v_h);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2018-04-24 13:18:35 -07:00
|
|
|
if (!strcmp(dir, "up_multi"))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-04-26 19:21:46 -07:00
|
|
|
if (_key_action_move_dir(obj, ELM_FOCUS_UP, EINA_TRUE)) return EINA_TRUE;
|
|
|
|
else if (_key_action_move_dir(obj, ELM_FOCUS_UP, EINA_FALSE)) return EINA_TRUE;
|
2014-04-16 01:18:22 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "down_multi"))
|
|
|
|
{
|
2014-04-26 19:21:46 -07:00
|
|
|
if (_key_action_move_dir(obj, ELM_FOCUS_DOWN, EINA_TRUE)) return EINA_TRUE;
|
|
|
|
else if (_key_action_move_dir(obj, ELM_FOCUS_DOWN, EINA_FALSE)) return EINA_TRUE;
|
2014-04-16 01:18:22 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "first"))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
it = elm_genlist_first_item_get(obj);
|
2014-03-18 03:14:39 -07:00
|
|
|
if (it)
|
|
|
|
{
|
2016-09-01 04:20:53 -07:00
|
|
|
if (_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
|
|
|
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(it, EINA_TRUE);
|
|
|
|
}
|
2014-04-01 03:55:08 -07:00
|
|
|
return EINA_TRUE;
|
2014-03-18 03:14:39 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2014-04-16 01:18:22 -07:00
|
|
|
else if (!strcmp(dir, "last"))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
it = elm_genlist_last_item_get(obj);
|
2014-03-18 03:14:39 -07:00
|
|
|
if (it)
|
|
|
|
{
|
2016-09-01 04:20:53 -07:00
|
|
|
if (_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
|
|
|
elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(it, EINA_TRUE);
|
|
|
|
}
|
2014-04-01 03:55:08 -07:00
|
|
|
return EINA_TRUE;
|
2014-03-18 03:14:39 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2014-04-16 01:18:22 -07:00
|
|
|
else if (!strcmp(dir, "prior"))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (page_y < 0)
|
|
|
|
y -= -(page_y * v_h) / 100;
|
|
|
|
else
|
|
|
|
y -= page_y;
|
|
|
|
}
|
2014-04-16 01:18:22 -07:00
|
|
|
else if (!strcmp(dir, "next"))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (page_y < 0)
|
|
|
|
y += -(page_y * v_h) / 100;
|
|
|
|
else
|
|
|
|
y += page_y;
|
|
|
|
}
|
2014-04-01 03:55:08 -07:00
|
|
|
else return EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_pan_pos_max_get(sd->pan_obj, &pan_max_x, &pan_max_y);
|
2016-04-11 05:11:28 -07:00
|
|
|
if (x < 0)
|
|
|
|
x = 0;
|
|
|
|
else if (x > pan_max_x)
|
|
|
|
x = pan_max_x;
|
|
|
|
if (y < 0)
|
|
|
|
y = 0;
|
|
|
|
else if (y > pan_max_y)
|
|
|
|
y = pan_max_y;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_set(obj, x, y, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-16 01:18:22 -07:00
|
|
|
static Eina_Bool
|
2015-02-12 00:31:00 -08:00
|
|
|
_key_action_select(Evas_Object *obj, const char *params)
|
2014-04-16 01:18:22 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-04-16 01:18:22 -07:00
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
if (!sd->items) return EINA_FALSE;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it = elm_object_focused_item_get(obj);
|
|
|
|
if (!eo_it) return EINA_TRUE;
|
|
|
|
elm_genlist_item_expanded_set(eo_it, !elm_genlist_item_expanded_get(eo_it));
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2015-02-12 00:31:00 -08:00
|
|
|
|
|
|
|
if (sd->multi &&
|
|
|
|
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
|
|
|
(!strcmp(params, "multi"))))
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
_item_highlight(it);
|
|
|
|
if (_item_select(it)) goto deleted;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Gen_Item *sel = efl_data_scope_get(eo_sel, ELM_GENLIST_ITEM_CLASS);
|
2015-02-12 00:31:00 -08:00
|
|
|
_item_unselect(sel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
|
|
|
Elm_Object_Item *eo_it2;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_it2)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
|
|
|
if (it2 != it)
|
|
|
|
_item_unselect(it2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_item_highlight(it);
|
|
|
|
if (_item_select(it)) goto deleted;
|
|
|
|
}
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_ACTIVATED, EO_OBJ(it));
|
2014-04-16 01:18:22 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2015-02-12 00:31:00 -08:00
|
|
|
|
|
|
|
deleted:
|
|
|
|
return EINA_FALSE;
|
2014-04-16 01:18:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!_all_items_deselect(sd)) return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_genlist_efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Genlist_Data *_pd EINA_UNUSED, Evas_Object *sobj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
/* skipping layout's code, which registers size hint changing
|
|
|
|
* callback on sub objects. this is here because items'
|
|
|
|
* content_get() routines may change hints on the objects after
|
|
|
|
* creation, thus issuing TOO MANY sizing_eval()'s here. they are
|
|
|
|
* not needed at here anyway, so let's skip listening to those
|
|
|
|
* hints changes */
|
2018-01-07 20:55:35 -08:00
|
|
|
return elm_widget_sub_object_add(efl_cast(obj, EFL_UI_WIDGET_CLASS), sobj);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_genlist_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Genlist_Data *sd, Evas_Object *sobj)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
/* XXX: hack -- also skipping sizing recalculation on
|
|
|
|
* sub-object-del. genlist's crazy code paths (like groups and
|
|
|
|
* such) seem to issue a whole lot of deletions and Evas bitches
|
|
|
|
* about too many recalculations */
|
|
|
|
sd->on_sub_del = EINA_TRUE;
|
2017-08-23 04:41:37 -07:00
|
|
|
int_ret = elm_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->on_sub_del = EINA_FALSE;
|
2017-08-02 05:39:25 -07:00
|
|
|
return int_ret;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 08:48:07 -07:00
|
|
|
/*
|
|
|
|
* This function searches the nearest visible item based on the given item.
|
2014-03-23 01:58:34 -07:00
|
|
|
* If the given item is in the genlist viewport, this returns the given item.
|
|
|
|
* Or this searches the realized items and checks the nearest fully visible item
|
2014-03-18 08:48:07 -07:00
|
|
|
* according to the given item's position.
|
|
|
|
*/
|
|
|
|
static Elm_Object_Item *
|
2014-09-27 22:15:28 -07:00
|
|
|
_elm_genlist_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
|
2014-03-18 08:48:07 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vx = 0, vy = 0, vw = 0, vh = 0; // genlist viewport geometry
|
|
|
|
Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry
|
|
|
|
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry
|
|
|
|
Eina_List *item_list = NULL, *l = NULL;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_item = NULL;
|
2014-03-18 08:48:07 -07:00
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
2014-03-23 10:07:41 -07:00
|
|
|
Eina_Bool search_next = EINA_FALSE;
|
2014-03-18 08:48:07 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2014-03-18 08:48:07 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, &vx, &vy, &vw, &vh);
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih); // FIXME: check if the item is realized or not
|
|
|
|
|
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
|
2014-03-23 10:07:41 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_it))
|
|
|
|
return eo_it;
|
2014-03-23 10:07:41 -07:00
|
|
|
else
|
|
|
|
search_next = EINA_TRUE;
|
|
|
|
}
|
2014-03-18 08:48:07 -07:00
|
|
|
|
2014-12-26 01:40:14 -08:00
|
|
|
item_list = elm_genlist_realized_items_get(obj);
|
|
|
|
|
2014-03-23 10:07:41 -07:00
|
|
|
if ((iy < vy) || search_next)
|
2014-03-18 08:48:07 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FOREACH(item_list, l, eo_item)
|
2014-03-18 08:48:07 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_item, item);
|
2014-03-18 08:48:07 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 10:07:41 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:28 -07:00
|
|
|
!elm_object_item_disabled_get(eo_item))
|
2014-12-26 01:40:14 -08:00
|
|
|
{
|
|
|
|
eina_list_free(item_list);
|
|
|
|
return eo_item;
|
|
|
|
}
|
2014-03-18 08:48:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_REVERSE_FOREACH(item_list, l, eo_item)
|
2014-03-18 08:48:07 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_item, item);
|
2014-03-18 08:48:07 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 10:07:41 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:28 -07:00
|
|
|
!elm_object_item_disabled_get(eo_item))
|
2014-12-26 01:40:14 -08:00
|
|
|
{
|
|
|
|
eina_list_free(item_list);
|
|
|
|
return eo_item;
|
|
|
|
}
|
2014-03-18 08:48:07 -07:00
|
|
|
}
|
|
|
|
}
|
2014-12-26 03:22:57 -08:00
|
|
|
eina_list_free(item_list);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return eo_it;
|
2014-03-18 08:48:07 -07:00
|
|
|
}
|
|
|
|
|
2018-03-11 09:56:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Genlist_Data *sd, Efl_Ui_Focus_Direction direction EINA_UNUSED, Efl_Ui_Focus_Object *entry EINA_UNUSED)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2014-03-22 07:28:19 -07:00
|
|
|
Eina_Bool is_sel = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2018-03-11 09:56:07 -07:00
|
|
|
if (sd->last_focused_item)
|
|
|
|
eo_it = sd->last_focused_item;
|
|
|
|
else if (sd->last_selected_item)
|
|
|
|
eo_it = sd->last_selected_item;
|
2018-04-24 13:41:39 -07:00
|
|
|
else if (_elm_config->first_item_focus_on_first_focus_in)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
2018-03-11 09:56:07 -07:00
|
|
|
eo_it = elm_genlist_first_item_get(obj);
|
|
|
|
is_sel = EINA_TRUE;
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2018-03-11 09:56:07 -07:00
|
|
|
while (eo_it)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2018-03-11 09:56:07 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
if ((!_is_no_select(it)) && (!elm_object_item_disabled_get(eo_it)))
|
|
|
|
break;
|
|
|
|
eo_it = EO_OBJ(ELM_GEN_ITEM_NEXT(it));
|
|
|
|
}
|
2014-03-18 08:48:07 -07:00
|
|
|
|
2018-03-11 09:56:07 -07:00
|
|
|
if (eo_it)
|
|
|
|
{
|
|
|
|
eo_it = _elm_genlist_nearest_visible_item_get(obj, eo_it);
|
2014-09-27 22:15:28 -07:00
|
|
|
if (eo_it)
|
2014-03-18 08:48:07 -07:00
|
|
|
{
|
2018-03-11 09:56:07 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable && is_sel)
|
|
|
|
elm_genlist_item_selected_set(eo_it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
|
|
|
//set it again in the manager, there might be the case that the manager focus history and internal item foused logic are in different states
|
2018-03-11 13:08:42 -07:00
|
|
|
if (efl_ui_focus_manager_request_subchild(obj, eo_it))
|
|
|
|
efl_ui_focus_manager_focus_set(obj, eo_it);
|
2014-03-18 08:48:07 -07:00
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
2018-04-24 13:41:39 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
//Just set evas focus on the genlist itself, events will pass on and a other element will be taken
|
|
|
|
evas_object_focus_set(obj, EINA_TRUE);
|
|
|
|
}
|
2018-03-11 09:56:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
|
|
|
int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
|
|
|
|
if (!int_ret) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (efl_ui_focus_object_focus_get(obj) && (sd->items) && (sd->selected) &&
|
|
|
|
(!sd->last_selected_item))
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2018-03-11 09:56:07 -07:00
|
|
|
sd->last_selected_item = eina_list_data_get(sd->selected);
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static Eina_Bool _elm_genlist_smart_focus_next_enable = EINA_FALSE;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
2012-10-22 07:34:43 -07:00
|
|
|
_item_cache_zero(sd);
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_ui_mirrored_set(obj, rtl);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_genlist_efl_ui_widget_theme_apply(Eo *obj, Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Item_Block *itb;
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
2014-03-08 08:04:34 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Elm_Gen_Item *it;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-04-24 04:41:37 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2015-12-01 23:23:39 -08:00
|
|
|
eina_hash_free_buckets(sd->size_caches);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->minw = sd->minh = sd->realminw = 0;
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (itb->realized) _item_block_unrealize(itb);
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->mincalcd = EINA_FALSE;
|
|
|
|
|
|
|
|
itb->changed = EINA_TRUE;
|
|
|
|
}
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-04-24 04:41:37 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: take off later. maybe this show region coords belong in the
|
|
|
|
* interface (new api functions, set/get)? */
|
|
|
|
static void
|
2017-09-13 19:59:44 -07:00
|
|
|
_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rect r)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-01-10 06:06:46 -08:00
|
|
|
ELM_GENLIST_DATA_GET_OR_RETURN(obj, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
//x & y are screen coordinates, Add with pan coordinates
|
2017-08-21 23:16:54 -07:00
|
|
|
r.x += sd->pan_x;
|
|
|
|
r.y += sd->pan_y;
|
|
|
|
elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_highlight(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
const char *selectraise;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
if (_is_no_select(it) ||
|
2013-05-02 11:13:36 -07:00
|
|
|
(!sd->highlight) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
(it->highlighted) || elm_wdg_item_disabled_get(EO_OBJ(it)) ||
|
2014-08-21 08:12:40 -07:00
|
|
|
(it->item->deco_it_view))
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
|
|
|
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_SELECTED, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_SELECTED, "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_HIGHLIGHTED, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
|
|
|
if ((selectraise) && (!strcmp(selectraise, "on")))
|
|
|
|
{
|
2013-06-22 23:17:39 -07:00
|
|
|
if (it->deco_all_view) evas_object_stack_below(it->deco_all_view, sd->stack[1]);
|
|
|
|
else evas_object_stack_below(VIEW(it), sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((it->item->group_item) && (it->item->group_item->realized))
|
2013-06-22 23:17:39 -07:00
|
|
|
evas_object_stack_above(it->item->VIEW(group_item), sd->stack[1]);
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (sd->pin_item && sd->pin_item->realized)
|
|
|
|
evas_object_stack_above(VIEW(sd->pin_item), sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
it->highlighted = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_unhighlight(Elm_Gen_Item *it)
|
|
|
|
{
|
2015-01-08 06:03:52 -08:00
|
|
|
if (!it->highlighted) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_UNSELECTED, "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_UNHIGHLIGHTED, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
2017-03-13 04:18:33 -07:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_UNSELECTED, "elm");
|
|
|
|
_item_restack(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->highlighted = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_block_position_update(Eina_Inlist *list,
|
|
|
|
int idx)
|
|
|
|
{
|
|
|
|
Item_Block *tmp;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(list, tmp)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
tmp->position = idx++;
|
|
|
|
tmp->position_update = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_position_update(Eina_List *list,
|
|
|
|
int idx)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Eina_List *l;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(list, l, it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
it->position = idx++;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_block_merge(Item_Block *left,
|
|
|
|
Item_Block *right)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Gen_Item *it2;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(right->items, l, it2)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2018-08-06 21:25:34 -07:00
|
|
|
if (right->realized)
|
|
|
|
efl_ui_focus_manager_calc_unregister(right->sd->obj, EO_OBJ(it2));
|
2012-07-16 14:56:30 -07:00
|
|
|
it2->item->block = left;
|
|
|
|
left->count++;
|
|
|
|
left->changed = EINA_TRUE;
|
2018-08-06 21:25:34 -07:00
|
|
|
if (left->realized)
|
|
|
|
efl_ui_focus_manager_calc_register_logical(right->sd->obj, EO_OBJ(it2), left->adapter, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
left->items = eina_list_merge(left->items, right->items);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_block_del(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Eina_Inlist *il;
|
|
|
|
Item_Block *itb = it->item->block;
|
|
|
|
Eina_Bool block_changed = EINA_FALSE;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
itb->items = eina_list_remove(itb->items, it);
|
|
|
|
itb->count--;
|
|
|
|
itb->changed = EINA_TRUE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (itb->count < 1)
|
|
|
|
{
|
|
|
|
Item_Block *itbn;
|
|
|
|
|
|
|
|
il = EINA_INLIST_GET(itb);
|
|
|
|
itbn = (Item_Block *)(il->next);
|
|
|
|
if (it->parent)
|
2017-02-21 20:53:03 -08:00
|
|
|
{
|
|
|
|
it->parent->item->items =
|
|
|
|
eina_list_remove(it->parent->item->items, EO_OBJ(it));
|
|
|
|
if (!it->parent->item->items)
|
|
|
|
sd->top_level_parent_items--;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_item_block_position_update(il->next, itb->position);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->blocks = eina_inlist_remove(sd->blocks, il);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
free(itb);
|
|
|
|
if (itbn) itbn->changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if (itb->count < (sd->max_items_per_block / 2))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Item_Block *itbp;
|
|
|
|
Item_Block *itbn;
|
|
|
|
|
|
|
|
il = EINA_INLIST_GET(itb);
|
|
|
|
itbp = (Item_Block *)(il->prev);
|
|
|
|
itbn = (Item_Block *)(il->next);
|
|
|
|
|
|
|
|
/* merge block with previous */
|
|
|
|
if ((itbp) &&
|
|
|
|
((itbp->count + itb->count) <
|
2013-05-02 11:13:36 -07:00
|
|
|
(sd->max_items_per_block +
|
|
|
|
(sd->max_items_per_block / 2))))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
_item_block_merge(itbp, itb);
|
|
|
|
_item_block_position_update
|
|
|
|
(EINA_INLIST_GET(itb)->next, itb->position);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->blocks = eina_inlist_remove
|
|
|
|
(sd->blocks, EINA_INLIST_GET(itb));
|
2012-07-16 14:56:30 -07:00
|
|
|
free(itb);
|
|
|
|
block_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
/* merge block with next */
|
|
|
|
else if ((itbn) &&
|
|
|
|
((itbn->count + itb->count) <
|
2013-05-02 11:13:36 -07:00
|
|
|
(sd->max_items_per_block +
|
|
|
|
(sd->max_items_per_block / 2))))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
_item_block_merge(itb, itbn);
|
|
|
|
_item_block_position_update
|
|
|
|
(EINA_INLIST_GET(itbn)->next, itbn->position);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->blocks =
|
|
|
|
eina_inlist_remove(sd->blocks, EINA_INLIST_GET(itbn));
|
2012-07-16 14:56:30 -07:00
|
|
|
free(itbn);
|
|
|
|
block_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (block_changed)
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->pan_changed = EINA_TRUE;
|
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->calc_job = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_decorate_all_item_unrealize(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
if ((!it) || (!it->item->decorate_all_item_realized)) return;
|
|
|
|
|
|
|
|
edje_object_part_unswallow(it->deco_all_view, VIEW(it));
|
2017-02-22 22:52:31 -08:00
|
|
|
evas_object_smart_member_add(VIEW(it), it->item->wsd->pan_obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_widget_sub_object_add(WIDGET(it), VIEW(it));
|
2013-08-22 11:13:04 -07:00
|
|
|
_elm_genlist_item_position_state_update(it);
|
genlist: Refactoring genlist item cache logics.
Summary:
This patch is code refactoring for genlist item cache logic
as same as gengrid item cache and removing unnecessary
Item_Cache properties.
{selected, disabled, expanded} exist in Item_Cache,
but _item_cache_find ignore those flagged properties,
so _elm_genlist_item_status_update will not working with
itc properties(all itc properties are EINA_FALSE).
Test Plan: Need to check elementary_test genlist sample working properly.
Reviewers: raster, Hermet, seoz, jaehwan, cedric
Reviewed By: cedric
Subscribers: cedric, singh.amitesh, eagleeye
Differential Revision: https://phab.enlightenment.org/D2660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:22:28 -07:00
|
|
|
_elm_genlist_item_state_update(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-03-14 03:13:06 -07:00
|
|
|
if (it->item->wsd->reorder_mode)
|
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm");
|
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_REORDER_MODE_UNSET,
|
|
|
|
"elm");
|
2013-03-14 03:13:06 -07:00
|
|
|
}
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
_view_clear(it->deco_all_view, &(it->item->deco_all_texts),
|
|
|
|
&(it->item->deco_all_contents));
|
2013-09-05 21:00:42 -07:00
|
|
|
|
2014-12-29 04:44:07 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_DECORATE_DISABLED, "elm");
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
edje_object_message_signal_process(it->deco_all_view);
|
|
|
|
_item_mouse_callbacks_del(it, it->deco_all_view);
|
|
|
|
_item_mouse_callbacks_add(it, VIEW(it));
|
|
|
|
|
2014-07-27 01:19:57 -07:00
|
|
|
ELM_SAFE_FREE(it->deco_all_view, evas_object_del);
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->decorate_all_item_realized = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_genlist_item_del_not_serious(Elm_Gen_Item *it)
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_pre_notify_del(eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (it->selected)
|
2014-03-23 07:37:47 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, EO_OBJ(it));
|
2014-03-23 07:37:47 -07:00
|
|
|
if (sd->deselecting)
|
|
|
|
sd->deselecting = eina_list_remove(sd->deselecting, it);
|
|
|
|
}
|
2014-09-27 22:15:28 -07:00
|
|
|
if (sd->last_focused_item == eo_it)
|
2014-03-08 09:55:35 -08:00
|
|
|
sd->last_focused_item = NULL;
|
2014-09-27 22:15:28 -07:00
|
|
|
if (sd->focused_item == eo_it)
|
2014-03-08 09:55:35 -08:00
|
|
|
sd->focused_item = NULL;
|
2014-09-27 22:15:28 -07:00
|
|
|
if (sd->last_selected_item == eo_it)
|
2014-03-08 09:55:35 -08:00
|
|
|
sd->last_selected_item = NULL;
|
2017-09-12 02:38:44 -07:00
|
|
|
if (sd->mode_item == it)
|
|
|
|
sd-> mode_item = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (it->itc->func.del)
|
2014-09-14 04:51:26 -07:00
|
|
|
it->itc->func.del((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_genlist_item_del_serious(Elm_Gen_Item *it)
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2015-05-28 08:58:46 -07:00
|
|
|
sd->item_count--;
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_del_not_serious(it);
|
|
|
|
|
2018-04-16 16:40:39 -07:00
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_GROUP)
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->group_items = eina_list_remove(sd->group_items, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->item, free);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_del(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2013-09-09 00:12:45 -07:00
|
|
|
|
2017-09-14 20:11:50 -07:00
|
|
|
if (it->item->rel_revs)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *tmp;
|
|
|
|
EINA_LIST_FREE(it->item->rel_revs, tmp)
|
|
|
|
{
|
|
|
|
if (tmp->item->queued && !(tmp->base)->on_deletion)
|
|
|
|
{
|
|
|
|
tmp->item->queued = EINA_FALSE;
|
|
|
|
sd->queue = eina_list_remove(sd->queue, tmp);
|
2017-10-18 04:01:35 -07:00
|
|
|
if (_item_process(sd, tmp))
|
|
|
|
_item_process_post(sd, tmp);
|
2017-09-14 20:11:50 -07:00
|
|
|
}
|
|
|
|
tmp->item->rel = NULL;
|
|
|
|
}
|
|
|
|
}
|
2015-01-14 06:19:29 -08:00
|
|
|
if (it->item->rel)
|
|
|
|
{
|
|
|
|
it->item->rel->item->rel_revs =
|
|
|
|
eina_list_remove(it->item->rel->item->rel_revs, it);
|
|
|
|
}
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_subitems_clear(EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->show_item == it) sd->show_item = NULL;
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (sd->pin_item == it) sd->pin_item = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE);
|
|
|
|
if (it->item->decorate_all_item_realized) _decorate_all_item_unrealize(it);
|
|
|
|
if (it->item->block) _item_block_del(it);
|
|
|
|
if (it->item->queued)
|
|
|
|
sd->queue = eina_list_remove(sd->queue, it);
|
|
|
|
if (sd->anchor_item == it)
|
|
|
|
{
|
2017-10-24 00:53:18 -07:00
|
|
|
sd->anchor_item = ELM_GEN_ITEM_NEXT(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->anchor_item)
|
|
|
|
sd->anchor_item =
|
2017-10-24 00:53:18 -07:00
|
|
|
ELM_GEN_ITEM_PREV(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
if (sd->expanded_item == it)
|
|
|
|
{
|
|
|
|
if (sd->tree_effect_animator)
|
|
|
|
{
|
|
|
|
_item_tree_effect_finish(sd);
|
2016-01-28 17:07:34 -08:00
|
|
|
_elm_genlist_tree_effect_stop(sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
sd->expanded_item = NULL;
|
|
|
|
sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE;
|
|
|
|
}
|
|
|
|
if (sd->expanded_next_item == it) sd->expanded_next_item = NULL;
|
|
|
|
if (sd->move_items) sd->move_items = eina_list_remove(sd->move_items, it);
|
|
|
|
if (it->parent)
|
2017-02-21 20:53:03 -08:00
|
|
|
{
|
|
|
|
it->parent->item->items = eina_list_remove(it->parent->item->items, EO_OBJ(it));
|
|
|
|
if (!it->parent->item->items)
|
|
|
|
sd->top_level_parent_items--;
|
|
|
|
}
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_del_serious(it);
|
2015-12-01 23:23:39 -08:00
|
|
|
|
|
|
|
if (it->itc->refcount <= 1 && eina_hash_find(sd->size_caches, &(it->itc)))
|
|
|
|
eina_hash_del_by_key(sd->size_caches, it->itc);
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc);
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2013-11-27 23:36:55 -08:00
|
|
|
if (!sd->queue) _item_scroll(sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_unselect(Elm_Gen_Item *it)
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unhighlight(it); /* unhighlight the item first */
|
2012-11-16 06:26:12 -08:00
|
|
|
if (!it->selected) return; /* then check whether the item is selected */
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->focus_on_selection_enabled)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
|
|
|
Evas_Object* eobj;
|
|
|
|
Eina_List* l;
|
|
|
|
EINA_LIST_FOREACH(it->item_focus_chain, l, eobj)
|
|
|
|
elm_object_focus_set(eobj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->selected = EINA_FALSE;
|
2014-09-27 22:15:28 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, EO_OBJ(it));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_UNSELECTED, EO_OBJ(it));
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_SELECTED, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:25:03 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_in_cb(void *data,
|
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
if (!elm_object_item_disabled_get(EO_OBJ(it)) &&
|
2014-04-01 04:25:03 -07:00
|
|
|
(_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN))
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2014-04-01 04:25:03 -07:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_move_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
|
2013-07-02 03:33:00 -07:00
|
|
|
Evas_Coord minw = 0, minh = 0, x, y, w, h, dx, dy, adx, ady;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
|
|
|
if (!sd->on_hold)
|
|
|
|
{
|
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
if ((!sd->wasselected) && (!it->flipped))
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
2017-06-23 14:43:58 -07:00
|
|
|
else if (it->down && ELM_RECTS_POINT_OUT(x, y, w, h, ev->cur.canvas.x, ev->cur.canvas.y) &&
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
!sd->reorder_it)
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
if ((!sd->wasselected) && (!it->flipped))
|
|
|
|
_item_unselect(it);
|
|
|
|
it->base->still_in = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->multi_touched)
|
|
|
|
{
|
|
|
|
sd->cur_x = ev->cur.canvas.x;
|
|
|
|
sd->cur_y = ev->cur.canvas.y;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((it->dragging) && (it->down))
|
|
|
|
{
|
|
|
|
if (sd->movements == SWIPE_MOVES)
|
|
|
|
sd->swipe = EINA_TRUE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->history[sd->movements].x = ev->cur.canvas.x;
|
|
|
|
sd->history[sd->movements].y = ev->cur.canvas.y;
|
|
|
|
if (abs((sd->history[sd->movements].x -
|
|
|
|
sd->history[0].x)) > 40)
|
|
|
|
sd->swipe = EINA_TRUE;
|
|
|
|
else
|
|
|
|
sd->movements++;
|
|
|
|
}
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((!it->down) || (sd->longpressed))
|
|
|
|
{
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
2012-10-01 01:55:46 -07:00
|
|
|
|
|
|
|
if (ev->cur.canvas.y < (oy + (sd->reorder_it->item->h / 2)))
|
|
|
|
sd->reorder_fast = 1;
|
|
|
|
else if (ev->cur.canvas.y > (oy + oh - (sd->reorder_it->item->h / 2)))
|
|
|
|
sd->reorder_fast = -1;
|
|
|
|
else sd->reorder_fast = 0;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it_scrl_y = ev->cur.canvas.y - sd->reorder_it->dy;
|
|
|
|
|
|
|
|
if (!sd->reorder_start_y)
|
|
|
|
sd->reorder_start_y = it->item->block->y + it->y;
|
|
|
|
|
|
|
|
if (it_scrl_y < oy)
|
|
|
|
y_pos = oy;
|
|
|
|
else if (it_scrl_y + sd->reorder_it->item->h > oy + oh)
|
|
|
|
y_pos = oy + oh - sd->reorder_it->item->h;
|
|
|
|
else
|
|
|
|
y_pos = it_scrl_y;
|
|
|
|
|
|
|
|
if (it->deco_all_view)
|
|
|
|
_item_position(it, it->deco_all_view, it->item->scrl_x, y_pos);
|
|
|
|
else
|
|
|
|
_item_position(it, VIEW(it), it->item->scrl_x, y_pos);
|
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
|
2013-07-02 03:33:00 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
2012-07-16 14:56:30 -07:00
|
|
|
x = ev->cur.canvas.x - x;
|
|
|
|
y = ev->cur.canvas.y - y;
|
|
|
|
dx = x - it->dx;
|
|
|
|
adx = dx;
|
|
|
|
if (adx < 0) adx = -dx;
|
|
|
|
|
|
|
|
dy = y - it->dy;
|
|
|
|
ady = dy;
|
|
|
|
if (ady < 0) ady = -dy;
|
|
|
|
|
|
|
|
minw /= 2;
|
|
|
|
minh /= 2;
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-07-02 03:33:00 -07:00
|
|
|
// gah! annoying drag detection - leave this alone
|
|
|
|
if (h < w)
|
|
|
|
{
|
|
|
|
if (minw < h) minw = h;
|
|
|
|
if (minh < h) minh = h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (minw < w) minw = w;
|
|
|
|
if (minh < w) minh = w;
|
|
|
|
}
|
|
|
|
if (minw < 5) minw = 5;
|
|
|
|
if (minh < 5) minh = 5;
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((adx > minw) || (ady > minh))
|
|
|
|
{
|
|
|
|
it->dragging = EINA_TRUE;
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (dy < 0)
|
|
|
|
{
|
|
|
|
if (ady > adx)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_START_UP, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dx < 0)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_START_LEFT, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_START_RIGHT, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ady > adx)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_START_DOWN, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dx < 0)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_START_LEFT, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_START_RIGHT, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_long_press_cb(void *data)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Elm_Object_Item *eo_it_tmp;
|
2013-03-13 04:25:12 -07:00
|
|
|
Eina_List *list;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
if (_is_no_select(it) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_disabled_get(EO_OBJ(it)) || (it->dragging))
|
2015-06-22 02:59:21 -07:00
|
|
|
goto end;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->longpressed = EINA_TRUE;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_LONGPRESSED, EO_OBJ(it));
|
2017-02-22 22:52:31 -08:00
|
|
|
if ((sd->reorder_mode) && !(it->item->type & ELM_GENLIST_ITEM_GROUP))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->reorder_it = it;
|
|
|
|
sd->reorder_start_y = 0;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
2013-06-22 23:17:39 -07:00
|
|
|
evas_object_stack_below(it->deco_all_view, sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2013-06-22 23:17:39 -07:00
|
|
|
evas_object_stack_below(VIEW(it), sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(sd->obj, EINA_TRUE);
|
|
|
|
elm_interface_scrollable_bounce_allow_set
|
|
|
|
(sd->obj, EINA_FALSE, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
list = elm_genlist_realized_items_get
|
2013-05-02 11:13:36 -07:00
|
|
|
((sd)->obj);
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FREE(list, eo_it_tmp)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it_tmp, it_tmp);
|
2015-01-08 06:23:44 -08:00
|
|
|
if (it != it_tmp) _item_unselect(it_tmp);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2013-03-13 04:25:12 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (elm_genlist_item_expanded_get(EO_OBJ(it)))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_expanded_set(EO_OBJ(it), EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if (!sd->decorate_all_mode)
|
2017-11-21 21:17:41 -08:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_ENABLED, "elm");
|
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_ANIMATED, EINA_TRUE);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2015-06-22 02:59:21 -07:00
|
|
|
end:
|
|
|
|
it->long_timer = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_swipe_do(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
int i, sum = 0;
|
2015-10-04 09:51:29 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
if (_is_no_select(it) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_disabled_get(EO_OBJ(it))) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
for (i = 0; i < sd->movements; i++)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sum += sd->history[i].x;
|
|
|
|
if (abs(sd->history[0].y - sd->history[i].y) > 10)
|
|
|
|
return;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sum /= sd->movements;
|
|
|
|
if (abs(sum - sd->history[0].x) <= 10) return;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_SWIPE, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_swipe_cancel(void *data)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
if (!it) return ECORE_CALLBACK_CANCEL;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
sd->movements = 0;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_multi_cancel(void *data)
|
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!sd) return ECORE_CALLBACK_CANCEL;
|
|
|
|
sd->multi_timeout = EINA_TRUE;
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-07-05 21:00:39 -07:00
|
|
|
_multi_touch_gesture_eval(Elm_Gen_Item *it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Evas_Coord minw = 0, minh = 0;
|
|
|
|
Evas_Coord off_x, off_y, off_mx, off_my;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->multi_touched = EINA_FALSE;
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del);
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->multi_timeout)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->multi_timeout = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
2013-05-02 11:13:36 -07:00
|
|
|
off_x = abs(sd->cur_x - sd->prev_x);
|
|
|
|
off_y = abs(sd->cur_y - sd->prev_y);
|
|
|
|
off_mx = abs(sd->cur_mx - sd->prev_mx);
|
|
|
|
off_my = abs(sd->cur_my - sd->prev_my);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw)
|
|
|
|
|| (off_my > minh)))
|
|
|
|
{
|
|
|
|
if ((off_x + off_mx) > (off_y + off_my))
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->cur_x > sd->prev_x) && (sd->cur_mx > sd->prev_mx))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_SWIPE_RIGHT, eo_it);
|
2013-05-02 11:13:36 -07:00
|
|
|
else if ((sd->cur_x < sd->prev_x) && (sd->cur_mx < sd->prev_mx))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_SWIPE_LEFT, eo_it);
|
2013-05-02 11:13:36 -07:00
|
|
|
else if (abs(sd->cur_x - sd->cur_mx) >
|
|
|
|
abs(sd->prev_x - sd->prev_mx))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_PINCH_OUT, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_PINCH_IN, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->cur_y > sd->prev_y) && (sd->cur_my > sd->prev_my))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_SWIPE_DOWN, eo_it);
|
2013-05-02 11:13:36 -07:00
|
|
|
else if ((sd->cur_y < sd->prev_y) && (sd->cur_my < sd->prev_my))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_SWIPE_UP, eo_it);
|
2013-05-02 11:13:36 -07:00
|
|
|
else if (abs(sd->cur_y - sd->cur_my) >
|
|
|
|
abs(sd->prev_y - sd->prev_my))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_PINCH_OUT, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_MULTI_PINCH_IN, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->multi_timeout = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_multi_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-07-16 14:56:30 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Event_Multi_Down *ev = event_info;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if ((sd->multi_device != 0) || (sd->multi_touched)
|
|
|
|
|| (sd->multi_timeout))
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->multi_device = ev->device;
|
|
|
|
sd->multi_down = EINA_TRUE;
|
|
|
|
sd->multi_touched = EINA_TRUE;
|
|
|
|
sd->prev_mx = ev->canvas.x;
|
|
|
|
sd->prev_my = ev->canvas.y;
|
2015-01-08 06:23:44 -08:00
|
|
|
if (!sd->wasselected) _item_unselect(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->wasselected = EINA_FALSE;
|
|
|
|
sd->longpressed = EINA_FALSE;
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->dragging)
|
|
|
|
{
|
|
|
|
it->dragging = EINA_FALSE;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_STOP, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->on_hold)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
sd->movements = 0;
|
|
|
|
sd->on_hold = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_multi_up_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-07-16 14:56:30 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Event_Multi_Up *ev = event_info;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->multi_device != ev->device) return;
|
|
|
|
sd->multi_device = 0;
|
|
|
|
sd->multi_down = EINA_FALSE;
|
|
|
|
if (sd->mouse_down) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
_multi_touch_gesture_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_multi_move_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-07-16 14:56:30 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Event_Multi_Move *ev = event_info;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->multi_device != ev->device) return;
|
|
|
|
sd->cur_mx = ev->cur.canvas.x;
|
|
|
|
sd->cur_my = ev->cur.canvas.y;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_mouse_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Coord x, y;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-12-26 09:46:28 -08:00
|
|
|
if (ev->button == 3)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
it->dx = ev->canvas.x - x;
|
|
|
|
it->dy = ev->canvas.y - y;
|
|
|
|
return;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (ev->button != 1) return;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
it->down = EINA_TRUE;
|
|
|
|
it->dragging = EINA_FALSE;
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
it->dx = ev->canvas.x - x;
|
|
|
|
it->dy = ev->canvas.y - y;
|
|
|
|
sd->mouse_down = EINA_TRUE;
|
|
|
|
if (!sd->multi_touched)
|
|
|
|
{
|
|
|
|
sd->prev_x = ev->canvas.x;
|
|
|
|
sd->prev_y = ev->canvas.y;
|
|
|
|
sd->multi_timeout = EINA_FALSE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->multi_timer);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->multi_timer = ecore_timer_add(MULTI_DOWN_TIME, _multi_cancel, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
sd->longpressed = EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
|
|
|
if (sd->on_hold) return;
|
|
|
|
sd->wasselected = it->selected;
|
2016-02-12 11:14:13 -08:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(it->item->swipe_timer);
|
2013-03-26 10:33:01 -07:00
|
|
|
it->item->swipe_timer = ecore_timer_add(SWIPE_TIME, _swipe_cancel, it);
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->realized)
|
|
|
|
it->long_timer = ecore_timer_add
|
|
|
|
(sd->longpress_timeout, _long_press_cb, it);
|
|
|
|
else
|
|
|
|
it->long_timer = NULL;
|
|
|
|
sd->swipe = EINA_FALSE;
|
|
|
|
sd->movements = 0;
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
it->base->still_in = EINA_TRUE;
|
2014-08-09 08:53:46 -07:00
|
|
|
|
2014-08-21 10:47:24 -07:00
|
|
|
if (_is_no_select(it) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_disabled_get((Eo *)eo_it))
|
2014-08-21 10:47:24 -07:00
|
|
|
return;
|
|
|
|
|
2014-08-09 08:53:46 -07:00
|
|
|
// and finally call the user callbacks.
|
|
|
|
// NOTE: keep this code at the bottom, as the user can change the
|
|
|
|
// list at this point (clear, delete, etc...)
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_highlight(it);
|
2014-08-09 08:53:46 -07:00
|
|
|
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
2014-08-21 10:47:24 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, eo_it);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_ACTIVATED, eo_it);
|
2014-08-21 10:47:24 -07:00
|
|
|
}
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_PRESSED, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Item_Block *
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_block_new(Elm_Genlist_Data *sd,
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool prepend)
|
|
|
|
{
|
|
|
|
Item_Block *itb;
|
|
|
|
|
|
|
|
itb = calloc(1, sizeof(Item_Block));
|
|
|
|
if (!itb) return NULL;
|
|
|
|
itb->sd = sd;
|
|
|
|
if (prepend)
|
|
|
|
{
|
|
|
|
sd->blocks = eina_inlist_prepend(sd->blocks, EINA_INLIST_GET(itb));
|
|
|
|
_item_block_position_update(sd->blocks, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->blocks = eina_inlist_append(sd->blocks, EINA_INLIST_GET(itb));
|
|
|
|
itb->position_update = EINA_TRUE;
|
|
|
|
if (sd->blocks != EINA_INLIST_GET(itb))
|
|
|
|
{
|
|
|
|
itb->position =
|
|
|
|
((Item_Block *)(EINA_INLIST_GET(itb)->prev))->position + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itb->position = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return itb;
|
|
|
|
}
|
|
|
|
|
2018-08-02 06:42:06 -07:00
|
|
|
static void
|
|
|
|
_update_block_registration(Item_Block *itb, Elm_Gen_Item *element)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = NULL;
|
|
|
|
Eina_List *order = NULL;
|
2018-08-02 13:42:56 -07:00
|
|
|
const Eina_List *l;
|
2018-08-02 06:42:06 -07:00
|
|
|
|
|
|
|
if (!itb->realized) return;
|
|
|
|
|
|
|
|
efl_ui_focus_manager_calc_register_logical(itb->sd->obj, EO_OBJ(element), itb->adapter, NULL);
|
|
|
|
|
2018-08-02 13:42:56 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2018-08-02 06:42:06 -07:00
|
|
|
{
|
|
|
|
order = eina_list_append(order, EO_OBJ(it));
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_ui_focus_manager_calc_update_order(itb->sd->obj, itb->adapter, order);
|
|
|
|
}
|
|
|
|
|
2013-03-29 07:03:29 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* This function adds an item to a block's item list. This may or may not
|
|
|
|
* rearrange existing blocks and create a new block.
|
|
|
|
*
|
|
|
|
*/
|
2012-07-16 14:56:30 -07:00
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_block_add(Elm_Genlist_Data *sd,
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Item_Block *itb = NULL;
|
|
|
|
|
2013-03-29 07:03:29 -07:00
|
|
|
// when a new item does not depend on another item
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->item->rel)
|
|
|
|
{
|
|
|
|
newblock:
|
|
|
|
if (it->item->rel)
|
|
|
|
{
|
2017-02-23 22:16:45 -08:00
|
|
|
// FIXME: Why is this case here??? This doesn't make sense at all!
|
|
|
|
// There shouldn't be a goto in the first place!
|
2012-07-16 14:56:30 -07:00
|
|
|
itb = calloc(1, sizeof(Item_Block));
|
|
|
|
if (!itb) return EINA_FALSE;
|
|
|
|
itb->sd = sd;
|
|
|
|
if (!it->item->rel->item->block)
|
|
|
|
{
|
|
|
|
sd->blocks =
|
|
|
|
eina_inlist_append(sd->blocks, EINA_INLIST_GET(itb));
|
|
|
|
itb->items = eina_list_append(itb->items, it);
|
2018-08-02 06:42:06 -07:00
|
|
|
_update_block_registration(itb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
itb->position_update = EINA_TRUE;
|
|
|
|
it->position = eina_list_count(itb->items);
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
|
|
|
|
if (sd->blocks != EINA_INLIST_GET(itb))
|
|
|
|
{
|
|
|
|
itb->position =
|
|
|
|
((Item_Block *)
|
|
|
|
(EINA_INLIST_GET(itb)->prev))->position + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itb->position = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Eina_List *tmp;
|
|
|
|
|
|
|
|
tmp = eina_list_data_find_list(itb->items, it->item->rel);
|
|
|
|
if (it->item->before)
|
|
|
|
{
|
|
|
|
sd->blocks = eina_inlist_prepend_relative
|
|
|
|
(sd->blocks, EINA_INLIST_GET(itb),
|
|
|
|
EINA_INLIST_GET(it->item->rel->item->block));
|
|
|
|
itb->items =
|
|
|
|
eina_list_prepend_relative_list(itb->items, it, tmp);
|
|
|
|
|
|
|
|
/* Update index from where we prepended */
|
|
|
|
_item_position_update
|
|
|
|
(eina_list_prev(tmp), it->item->rel->position);
|
|
|
|
_item_block_position_update
|
|
|
|
(EINA_INLIST_GET(itb),
|
|
|
|
it->item->rel->item->block->position);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->blocks = eina_inlist_append_relative
|
|
|
|
(sd->blocks, EINA_INLIST_GET(itb),
|
|
|
|
EINA_INLIST_GET(it->item->rel->item->block));
|
|
|
|
itb->items =
|
|
|
|
eina_list_append_relative_list(itb->items, it, tmp);
|
|
|
|
|
|
|
|
/* Update block index from where we appended */
|
|
|
|
_item_position_update
|
|
|
|
(eina_list_next(tmp), it->item->rel->position + 1);
|
|
|
|
_item_block_position_update
|
|
|
|
(EINA_INLIST_GET(itb),
|
|
|
|
it->item->rel->item->block->position + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-29 07:03:29 -07:00
|
|
|
// item move_before, prepend, insert_before, sorted_insert with before
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->before)
|
|
|
|
{
|
|
|
|
if (sd->blocks)
|
|
|
|
{
|
|
|
|
itb = (Item_Block *)(sd->blocks);
|
|
|
|
if (itb->count >= sd->max_items_per_block)
|
|
|
|
{
|
|
|
|
itb = _item_block_new(sd, EINA_TRUE);
|
|
|
|
if (!itb) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itb = _item_block_new(sd, EINA_TRUE);
|
|
|
|
if (!itb) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
itb->items = eina_list_prepend(itb->items, it);
|
2018-08-02 06:42:06 -07:00
|
|
|
_update_block_registration(itb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position_update(itb->items, 0);
|
|
|
|
}
|
2013-03-29 07:03:29 -07:00
|
|
|
// item move_after, append, insert_after, sorted_insert without before
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->blocks)
|
|
|
|
{
|
|
|
|
itb = (Item_Block *)(sd->blocks->last);
|
|
|
|
if (itb->count >= sd->max_items_per_block)
|
|
|
|
{
|
|
|
|
itb = _item_block_new(sd, EINA_FALSE);
|
|
|
|
if (!itb) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itb = _item_block_new(sd, EINA_FALSE);
|
|
|
|
if (!itb) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
itb->items = eina_list_append(itb->items, it);
|
2018-08-02 06:42:06 -07:00
|
|
|
_update_block_registration(itb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->position = eina_list_count(itb->items);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-29 07:03:29 -07:00
|
|
|
// when a new item depends on another item
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Eina_List *tmp;
|
|
|
|
|
|
|
|
if (it->item->rel->item->queued)
|
|
|
|
{
|
|
|
|
/* NOTE: for a strange reason eina_list and eina_inlist
|
|
|
|
don't have the same property on sorted insertion
|
|
|
|
order, so the queue is not always ordered like the
|
|
|
|
item list. This lead to issue where we depend on an
|
|
|
|
item that is not yet created. As a quick work around,
|
|
|
|
we reschedule the calc of the item and stop reordering
|
|
|
|
the list to prevent any nasty issue to show up here.
|
|
|
|
*/
|
|
|
|
sd->queue = eina_list_append(sd->queue, it);
|
|
|
|
sd->requeued = EINA_TRUE;
|
|
|
|
it->item->queued = EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
itb = it->item->rel->item->block;
|
|
|
|
if (!itb) goto newblock;
|
|
|
|
tmp = eina_list_data_find_list(itb->items, it->item->rel);
|
|
|
|
if (it->item->before)
|
|
|
|
{
|
|
|
|
itb->items = eina_list_prepend_relative_list(itb->items, it, tmp);
|
2018-08-02 06:42:06 -07:00
|
|
|
_update_block_registration(itb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position_update
|
|
|
|
(eina_list_prev(tmp), it->item->rel->position);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itb->items = eina_list_append_relative_list(itb->items, it, tmp);
|
2018-08-02 06:42:06 -07:00
|
|
|
_update_block_registration(itb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position_update
|
|
|
|
(eina_list_next(tmp), it->item->rel->position + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
itb->count++;
|
|
|
|
itb->changed = EINA_TRUE;
|
|
|
|
it->item->block = itb;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(itb->sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
itb->sd->calc_job = ecore_job_add(_calc_job, itb->sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (itb->count > itb->sd->max_items_per_block)
|
|
|
|
{
|
|
|
|
int newc;
|
|
|
|
Item_Block *itb2;
|
|
|
|
Elm_Gen_Item *it2;
|
|
|
|
Eina_Bool done = EINA_FALSE;
|
|
|
|
|
|
|
|
newc = itb->count / 2;
|
|
|
|
|
|
|
|
if (EINA_INLIST_GET(itb)->prev)
|
|
|
|
{
|
|
|
|
Item_Block *itbp = (Item_Block *)(EINA_INLIST_GET(itb)->prev);
|
|
|
|
|
|
|
|
if (itbp->count + newc < sd->max_items_per_block / 2)
|
|
|
|
{
|
|
|
|
/* moving items to previous block */
|
|
|
|
while ((itb->count > newc) && (itb->items))
|
|
|
|
{
|
|
|
|
it2 = eina_list_data_get(itb->items);
|
|
|
|
itb->items = eina_list_remove_list
|
|
|
|
(itb->items, itb->items);
|
|
|
|
itb->count--;
|
2018-08-06 21:25:34 -07:00
|
|
|
efl_ui_focus_manager_calc_unregister(itb->sd->obj, EO_OBJ(it2));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
itbp->items = eina_list_append(itbp->items, it2);
|
2018-08-06 21:25:34 -07:00
|
|
|
_update_block_registration(itbp, it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
it2->item->block = itbp;
|
|
|
|
itbp->count++;
|
2017-02-23 22:16:45 -08:00
|
|
|
if (!it2->hide)
|
|
|
|
{
|
|
|
|
itb->vis_count--;
|
|
|
|
itbp->num--;
|
|
|
|
itbp->vis_count++;
|
|
|
|
}
|
2017-01-03 21:32:11 -08:00
|
|
|
|
2018-08-06 21:25:34 -07:00
|
|
|
if (it2->realized)
|
|
|
|
{
|
|
|
|
_item_block_realize(itbp);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
done = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!done && EINA_INLIST_GET(itb)->next)
|
|
|
|
{
|
|
|
|
Item_Block *itbn = (Item_Block *)(EINA_INLIST_GET(itb)->next);
|
|
|
|
|
|
|
|
if (itbn->count + newc < sd->max_items_per_block / 2)
|
|
|
|
{
|
|
|
|
/* moving items to next block */
|
|
|
|
while ((itb->count > newc) && (itb->items))
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
l = eina_list_last(itb->items);
|
|
|
|
it2 = eina_list_data_get(l);
|
|
|
|
itb->items = eina_list_remove_list(itb->items, l);
|
|
|
|
itb->count--;
|
2018-08-06 21:25:34 -07:00
|
|
|
efl_ui_focus_manager_calc_unregister(itb->sd->obj, EO_OBJ(it2));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
itbn->items = eina_list_prepend(itbn->items, it2);
|
2018-08-06 21:25:34 -07:00
|
|
|
_update_block_registration(itbn, it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
it2->item->block = itbn;
|
|
|
|
itbn->count++;
|
2017-02-23 22:16:45 -08:00
|
|
|
if (!it2->hide)
|
|
|
|
{
|
|
|
|
itb->h -= it->item->h;
|
|
|
|
itb->vis_count--;
|
|
|
|
itbn->h += it->item->h;
|
|
|
|
itbn->vis_count++;
|
|
|
|
}
|
2017-01-03 21:32:11 -08:00
|
|
|
|
2018-08-06 21:25:34 -07:00
|
|
|
if (it2->realized)
|
|
|
|
{
|
|
|
|
_item_block_realize(itbn);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
done = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!done)
|
|
|
|
{
|
|
|
|
/* moving items to new block */
|
|
|
|
itb2 = calloc(1, sizeof(Item_Block));
|
|
|
|
if (!itb2) return EINA_FALSE;
|
|
|
|
itb2->sd = sd;
|
|
|
|
sd->blocks =
|
|
|
|
eina_inlist_append_relative(sd->blocks, EINA_INLIST_GET(itb2),
|
|
|
|
EINA_INLIST_GET(itb));
|
|
|
|
itb2->changed = EINA_TRUE;
|
|
|
|
while ((itb->count > newc) && (itb->items))
|
|
|
|
{
|
2011-03-22 00:54:24 -07:00
|
|
|
Eina_List *l;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
l = eina_list_last(itb->items);
|
|
|
|
it2 = l->data;
|
|
|
|
itb->items = eina_list_remove_list(itb->items, l);
|
|
|
|
itb->count--;
|
2018-08-06 21:25:34 -07:00
|
|
|
efl_ui_focus_manager_calc_unregister(itb->sd->obj, EO_OBJ(it2));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
itb2->items = eina_list_prepend(itb2->items, it2);
|
2018-08-06 21:25:34 -07:00
|
|
|
_update_block_registration(itb2, it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
it2->item->block = itb2;
|
|
|
|
itb2->count++;
|
2017-02-23 22:16:45 -08:00
|
|
|
if (!it2->hide)
|
|
|
|
{
|
|
|
|
itb->vis_count--;
|
|
|
|
itb->h -= it2->item->h;
|
|
|
|
itb2->vis_count++;
|
|
|
|
itb2->h += it2->item->h;
|
|
|
|
}
|
2017-01-03 21:32:11 -08:00
|
|
|
|
2018-08-06 21:25:34 -07:00
|
|
|
if (it2->realized)
|
|
|
|
{
|
|
|
|
_item_block_realize(itb2);
|
|
|
|
}
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
2017-02-23 22:16:45 -08:00
|
|
|
|
|
|
|
itb2->num = itb->num + itb->vis_count;
|
|
|
|
itb2->x = itb->x;
|
|
|
|
itb2->w = itb->w;
|
|
|
|
itb2->y = itb->y + itb->h;
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2015-01-11 16:58:35 -08:00
|
|
|
static Eina_Bool
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_process(Elm_Genlist_Data *sd,
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it)
|
|
|
|
{
|
2015-06-22 03:02:55 -07:00
|
|
|
if (!_item_block_add(sd, it)) return EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->blocks)
|
|
|
|
_item_block_realize(it->item->block);
|
|
|
|
|
2015-06-22 03:02:55 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-02-21 22:34:34 -08:00
|
|
|
_item_process_post(Elm_Genlist_Data *sd, Elm_Gen_Item *it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Eina_Bool show_me = EINA_FALSE;
|
|
|
|
|
2017-10-18 04:01:35 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(it && it->item && it->item->block);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->block->changed)
|
|
|
|
{
|
|
|
|
show_me = _item_block_recalc
|
2017-02-21 22:34:34 -08:00
|
|
|
(it->item->block, it->item->block->num, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->block->changed = 0;
|
|
|
|
if (sd->pan_changed)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
2015-06-22 03:06:21 -07:00
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
if (show_me) it->item->block->show_me = EINA_TRUE;
|
|
|
|
|
|
|
|
/* when prepending, move the scroller along with the first selected
|
|
|
|
* item to create the illusion that we're watching the selected
|
|
|
|
* item this prevents the selected item being scrolled off the
|
|
|
|
* viewport
|
|
|
|
*/
|
2017-02-23 22:34:42 -08:00
|
|
|
if (sd->selected && it->item->before && !it->hide)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-04-03 08:09:35 -07:00
|
|
|
int y = 0, h;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it2;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = sd->selected->data;
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2012-08-28 02:53:35 -07:00
|
|
|
if (!it2->item->block) return;
|
2017-02-23 22:34:42 -08:00
|
|
|
if (it2->item->order_num_in < it->item->order_num_in) return;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_get(sd->obj, NULL, &y);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, NULL, &h);
|
|
|
|
if ((it->y + it->item->block->y > y + h) ||
|
|
|
|
(it->y + it->item->block->y + it->item->h < y))
|
|
|
|
/* offscreen, just update */
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show
|
|
|
|
(sd->obj, it2->x + it2->item->block->x, y, it2->item->block->w, h);
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show
|
|
|
|
(sd->obj, it->x + it->item->block->x, y + it->item->h, it->item->block->w, h);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-04-01 03:55:08 -07:00
|
|
|
_queue_process(Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
double t0, t;
|
|
|
|
|
2013-11-18 22:10:03 -08:00
|
|
|
t0 = ecore_time_get();
|
2018-06-29 08:33:18 -07:00
|
|
|
|
2016-07-28 19:21:27 -07:00
|
|
|
for (n = 0; (sd->queue) && (n < ITEM_QUEUE_MAX); n++)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
it = eina_list_data_get(sd->queue);
|
|
|
|
sd->queue = eina_list_remove_list(sd->queue, sd->queue);
|
|
|
|
it->item->queued = EINA_FALSE;
|
2015-06-22 03:02:55 -07:00
|
|
|
if (!_item_process(sd, it)) continue;
|
2012-07-16 14:56:30 -07:00
|
|
|
t = ecore_time_get();
|
2017-02-21 22:34:34 -08:00
|
|
|
_item_process_post(sd, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
/* same as eina_inlist_count > 1 */
|
|
|
|
if (sd->blocks && sd->blocks->next)
|
|
|
|
{
|
|
|
|
if ((t - t0) > (ecore_animator_frametime_get())) break;
|
|
|
|
}
|
|
|
|
}
|
2013-11-27 23:36:55 -08:00
|
|
|
if (!sd->queue) _item_scroll(sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_idle_process(void *data,
|
|
|
|
Eina_Bool *wakeup)
|
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Data *sd = data;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (_queue_process(sd) > 0) *wakeup = EINA_TRUE;
|
|
|
|
if (!sd->queue)
|
|
|
|
{
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_idle_enterer(void *data)
|
|
|
|
{
|
|
|
|
Eina_Bool wakeup = EINA_FALSE;
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
|
|
|
Eina_Bool ok = _idle_process(sd, &wakeup);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (wakeup)
|
|
|
|
{
|
|
|
|
// wake up mainloop
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, data);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2012-10-10 04:03:44 -07:00
|
|
|
if (ok == ECORE_CALLBACK_CANCEL) sd->queue_idle_enterer = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2013-12-05 23:08:09 -08:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_requeue_idle_enterer(Elm_Genlist_Data *sd)
|
2013-12-05 23:08:09 -08:00
|
|
|
{
|
2014-01-21 16:55:58 -08:00
|
|
|
ecore_idle_enterer_del(sd->queue_idle_enterer);
|
2013-12-05 23:08:09 -08:00
|
|
|
sd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, sd->obj);
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_item_queue(Elm_Genlist_Data *sd,
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it,
|
|
|
|
Eina_Compare_Cb cb)
|
|
|
|
{
|
2013-12-05 23:08:09 -08:00
|
|
|
Evas_Coord w = 0;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->queued) return;
|
|
|
|
it->item->queued = EINA_TRUE;
|
|
|
|
if (cb && !sd->requeued)
|
|
|
|
sd->queue = eina_list_sorted_insert(sd->queue, cb, it);
|
|
|
|
else
|
|
|
|
sd->queue = eina_list_append(sd->queue, it);
|
|
|
|
// FIXME: why does a freeze then thaw here cause some genlist
|
|
|
|
// elm_genlist_item_append() to be much much slower?
|
|
|
|
// evas_event_freeze(evas_object_evas_get(sd->obj));
|
|
|
|
while ((sd->queue) && ((!sd->blocks) || (!sd->blocks->next)))
|
|
|
|
{
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
_queue_process(sd);
|
|
|
|
}
|
|
|
|
while ((sd->queue) && (sd->blocks) &&
|
|
|
|
(sd->homogeneous) && (sd->mode == ELM_LIST_COMPRESS))
|
|
|
|
{
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
_queue_process(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
// evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
// evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2013-12-05 23:08:09 -08:00
|
|
|
evas_object_geometry_get(sd->obj, NULL, NULL, &w, NULL);
|
|
|
|
if (w > 0) _requeue_idle_enterer(sd);
|
2015-09-03 05:07:23 -07:00
|
|
|
|
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_added(EO_OBJ(it));
|
|
|
|
efl_access_children_changed_added_signal_emit(sd->obj, EO_OBJ(it));
|
2015-09-03 05:07:23 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the application wants to know the relative item, use
|
|
|
|
* elm_genlist_item_prev_get(it)*/
|
|
|
|
static void
|
|
|
|
_item_move_after(Elm_Gen_Item *it,
|
|
|
|
Elm_Gen_Item *after)
|
|
|
|
{
|
|
|
|
if (!it) return;
|
|
|
|
if (!after) return;
|
2012-10-23 08:13:09 -07:00
|
|
|
if (it == after) return;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->items =
|
|
|
|
eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
|
2012-10-26 03:27:13 -07:00
|
|
|
if (it->item->block) _item_block_del(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
|
2013-09-09 00:12:45 -07:00
|
|
|
if (it->item->rel)
|
|
|
|
it->item->rel->item->rel_revs =
|
|
|
|
eina_list_remove(it->item->rel->item->rel_revs, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->rel = after;
|
2013-03-29 06:23:38 -07:00
|
|
|
after->item->rel_revs = eina_list_append(after->item->rel_revs, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->before = EINA_FALSE;
|
|
|
|
if (after->item->group_item) it->item->group_item = after->item->group_item;
|
2013-05-02 11:13:36 -07:00
|
|
|
_item_queue(sd, it, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_MOVED_AFTER, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2012-11-16 01:17:56 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_activate_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *part_obj EINA_UNUSED,
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it)
|
2012-11-16 01:17:56 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-11-16 01:17:56 -08:00
|
|
|
if (!it) return;
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-11-16 01:17:56 -08:00
|
|
|
if (!sd) return;
|
|
|
|
|
|
|
|
if (sd->multi)
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_highlight(it);
|
|
|
|
_item_select(it);
|
2012-11-16 01:17:56 -08:00
|
|
|
}
|
|
|
|
else
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(it);
|
2012-11-16 01:17:56 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Gen_Item *sel = efl_data_scope_get(eo_sel, ELM_GENLIST_ITEM_CLASS);
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(sel);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-11-16 01:17:56 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it2;
|
2012-11-16 01:17:56 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_it2)
|
2013-03-26 10:46:35 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2013-03-26 10:46:35 -07:00
|
|
|
if (it2 != it)
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(it2);
|
2013-03-26 10:46:35 -07:00
|
|
|
}
|
2012-11-16 01:17:56 -08:00
|
|
|
}
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_highlight(it);
|
|
|
|
_item_select(it);
|
2012-11-16 01:17:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
/* If the application wants to know the relative item, use
|
|
|
|
* elm_genlist_item_next_get(it)*/
|
|
|
|
static void
|
|
|
|
_item_move_before(Elm_Gen_Item *it,
|
|
|
|
Elm_Gen_Item *before)
|
|
|
|
{
|
|
|
|
if (!it) return;
|
|
|
|
if (!before) return;
|
2012-10-23 08:13:09 -07:00
|
|
|
if (it == before) return;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->items =
|
|
|
|
eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
|
2012-10-26 03:27:13 -07:00
|
|
|
if (it->item->block) _item_block_del(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
|
2013-09-09 00:12:45 -07:00
|
|
|
if (it->item->rel)
|
|
|
|
it->item->rel->item->rel_revs =
|
|
|
|
eina_list_remove(it->item->rel->item->rel_revs, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->rel = before;
|
2013-03-29 06:23:38 -07:00
|
|
|
before->item->rel_revs = eina_list_append(before->item->rel_revs, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->before = EINA_TRUE;
|
|
|
|
if (before->item->group_item)
|
|
|
|
it->item->group_item = before->item->group_item;
|
2013-05-02 11:13:36 -07:00
|
|
|
_item_queue(sd, it, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_MOVED_BEFORE, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_mouse_up_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-07-16 14:56:30 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
|
|
|
Eina_Bool dragged = EINA_FALSE;
|
|
|
|
Elm_Gen_Item *it = data;
|
2014-12-26 09:46:28 -08:00
|
|
|
Evas_Coord x, y, dx, dy;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-12-29 02:19:21 -08:00
|
|
|
if ((ev->button == 3) && (!it->dragging))
|
2014-12-26 09:46:28 -08:00
|
|
|
{
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
dx = it->dx - (ev->canvas.x - x);
|
|
|
|
dy = it->dy - (ev->canvas.y - y);
|
|
|
|
if (dx < 0) dx = -dx;
|
|
|
|
if (dy < 0) dy = -dy;
|
|
|
|
if ((dx < 5) && (dy < 5))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_CLICKED_RIGHT, EO_OBJ(it));
|
2014-12-26 09:46:28 -08:00
|
|
|
return;
|
|
|
|
}
|
2014-12-26 08:29:51 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (ev->button != 1) return;
|
|
|
|
it->down = EINA_FALSE;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2018-05-07 15:16:29 -07:00
|
|
|
evas_object_ref(WIDGET(it));
|
|
|
|
efl_ref(EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->mouse_down = EINA_FALSE;
|
2018-05-07 15:16:29 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_RELEASED, EO_OBJ(it));
|
2018-05-07 15:16:29 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->multi_touched)
|
|
|
|
{
|
|
|
|
if ((!sd->multi) && (!it->selected) && (it->highlighted))
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unhighlight(it);
|
2018-05-07 15:16:29 -07:00
|
|
|
if (sd->multi_down) goto early;
|
2013-07-05 21:00:39 -07:00
|
|
|
_multi_touch_gesture_eval(it);
|
2018-05-07 15:16:29 -07:00
|
|
|
goto early;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->dragging)
|
|
|
|
{
|
|
|
|
it->dragging = EINA_FALSE;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:42:03 -07:00
|
|
|
(WIDGET(it), EFL_UI_EVENT_DRAG_STOP, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
dragged = 1;
|
|
|
|
}
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->multi_timer)
|
|
|
|
{
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->multi_timeout = EINA_FALSE;
|
|
|
|
}
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
if (sd->swipe)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
if (!sd->wasselected) _item_unselect(it);
|
|
|
|
_swipe_do(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
|
|
|
sd->on_hold = EINA_FALSE;
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
sd->wasselected = EINA_FALSE;
|
2018-05-07 15:16:29 -07:00
|
|
|
goto early;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
|
|
|
{
|
|
|
|
Evas_Coord it_scrl_y = ev->canvas.y - sd->reorder_it->dy;
|
2012-10-01 01:55:46 -07:00
|
|
|
sd->reorder_fast = 0;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (sd->reorder_rel &&
|
|
|
|
(sd->reorder_it->parent == sd->reorder_rel->parent))
|
|
|
|
{
|
|
|
|
if (it_scrl_y <= sd->reorder_rel->item->scrl_y)
|
|
|
|
_item_move_before(sd->reorder_it, sd->reorder_rel);
|
|
|
|
else
|
|
|
|
_item_move_after(sd->reorder_it, sd->reorder_rel);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_MOVED, EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_DISABLED, "elm");
|
2017-11-21 21:17:41 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
efl_access_state_changed_signal_emit(EO_OBJ(it), EFL_ACCESS_STATE_ANIMATED, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->reorder_it = sd->reorder_rel = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(sd->obj, EINA_FALSE);
|
|
|
|
elm_interface_scrollable_bounce_allow_set
|
|
|
|
(sd->obj, sd->h_bounce, sd->v_bounce);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
if (sd->longpressed)
|
|
|
|
{
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
if (!sd->wasselected) _item_unselect(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
|
|
|
sd->wasselected = EINA_FALSE;
|
2018-05-07 15:16:29 -07:00
|
|
|
goto early;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
if (dragged)
|
|
|
|
{
|
|
|
|
if (it->want_unrealize)
|
|
|
|
{
|
|
|
|
_elm_genlist_item_unrealize(it, EINA_FALSE);
|
|
|
|
if (it->item->block->want_unrealize)
|
|
|
|
_item_block_unrealize(it->item->block);
|
|
|
|
}
|
|
|
|
}
|
2014-08-21 10:47:24 -07:00
|
|
|
|
2016-08-15 03:59:46 -07:00
|
|
|
if (!it->selected && it->highlighted)
|
|
|
|
_item_unhighlight(it);
|
|
|
|
|
2016-01-24 07:44:57 -08:00
|
|
|
if ((ev->flags != EVAS_BUTTON_NONE) ||
|
|
|
|
(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) ||
|
|
|
|
!it->base->still_in ||
|
|
|
|
_is_no_select(it) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
(elm_wdg_item_disabled_get(EO_OBJ(it))))
|
2018-05-07 15:16:29 -07:00
|
|
|
goto early;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2015-01-14 23:12:37 -08:00
|
|
|
evas_object_ref(sd->obj);
|
|
|
|
|
2016-04-22 00:08:22 -07:00
|
|
|
if (sd->focused_item != EO_OBJ(it))
|
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
|
|
|
|
2013-11-02 04:50:59 -07:00
|
|
|
if (sd->multi &&
|
2013-11-03 06:58:57 -08:00
|
|
|
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
2013-11-02 04:50:59 -07:00
|
|
|
(evas_key_modifier_is_set(ev->modifiers, "Control"))))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_highlight(it);
|
2015-01-14 23:12:37 -08:00
|
|
|
if (_item_select(it)) goto deleted;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Gen_Item *sel = efl_data_scope_get(eo_sel, ELM_GENLIST_ITEM_CLASS);
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(sel);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it2;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_it2)
|
2013-03-26 10:46:35 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2013-03-26 10:46:35 -07:00
|
|
|
if (it2 != it)
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(it2);
|
2013-03-26 10:46:35 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_highlight(it);
|
2015-01-14 23:12:37 -08:00
|
|
|
if (_item_select(it)) goto deleted;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2015-01-08 06:03:52 -08:00
|
|
|
|
2018-05-07 15:16:29 -07:00
|
|
|
deleted:
|
2015-01-14 23:12:37 -08:00
|
|
|
evas_object_unref(sd->obj);
|
2018-05-07 15:16:29 -07:00
|
|
|
early:
|
|
|
|
evas_object_unref(WIDGET(it));
|
|
|
|
efl_unref(EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_mouse_callbacks_add(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view)
|
|
|
|
{
|
2018-05-07 15:16:29 -07:00
|
|
|
if (it->callbacks) return ;
|
|
|
|
it->callbacks = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MULTI_DOWN, _item_multi_down_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MULTI_UP, _item_multi_up_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MULTI_MOVE, _item_multi_move_cb, it);
|
2014-04-01 04:25:03 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in_cb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_mouse_callbacks_del(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view)
|
|
|
|
{
|
2018-05-07 15:16:29 -07:00
|
|
|
if (!it->callbacks) return ;
|
|
|
|
it->callbacks = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MULTI_DOWN, _item_multi_down_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MULTI_UP, _item_multi_up_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MULTI_MOVE, _item_multi_move_cb, it);
|
2014-04-01 04:25:03 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in_cb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_scroll_hold_timer_cb(void *data)
|
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!data) return ECORE_CALLBACK_CANCEL;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(sd->obj, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->scr_hold_timer = NULL;
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-03-13 08:26:50 -07:00
|
|
|
_decorate_item_unrealize(Elm_Gen_Item *it, Eina_Bool state_update)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-07-27 01:19:57 -07:00
|
|
|
Evas_Object *obj = sd->obj;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!it->item->deco_it_view) return;
|
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
_view_clear(it->item->deco_it_view, &(it->item->deco_it_texts),
|
|
|
|
&(it->item->deco_it_contents));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
edje_object_part_unswallow(it->item->deco_it_view, VIEW(it));
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(it->item->deco_it_view, evas_object_del);
|
2017-03-13 08:26:50 -07:00
|
|
|
evas_object_smart_member_add(VIEW(it), sd->pan_obj);
|
|
|
|
evas_object_clip_set(VIEW(it), evas_object_clip_get(sd->pan_obj));
|
|
|
|
if (state_update)
|
|
|
|
{
|
|
|
|
_elm_genlist_item_state_update(it);
|
|
|
|
_item_order_update(it, it->item->order_num_in, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sd->mode_item != it)
|
|
|
|
it->decorate_it_set = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_decorate_item_finished_signal_cb(void *data,
|
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
char buf[1024];
|
|
|
|
Evas *te;
|
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if (!it || !obj) return;
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
te = evas_object_evas_get(obj);
|
|
|
|
|
2015-01-08 06:03:52 -08:00
|
|
|
if ((!it->realized) || (!it->item->deco_it_view)) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
evas_event_freeze(te);
|
2016-11-08 03:15:08 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished",
|
|
|
|
sd->decorate_it_type);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(it->item->deco_it_view, buf, "elm", _decorate_item_finished_signal_cb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->nocache_once = EINA_FALSE;
|
2017-03-13 08:26:50 -07:00
|
|
|
_decorate_item_unrealize(it, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->group_item)
|
2013-06-22 23:17:39 -07:00
|
|
|
evas_object_stack_above(it->item->VIEW(group_item), sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
evas_event_thaw(te);
|
|
|
|
evas_event_thaw_eval(te);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unrealize(Elm_Gen_Item *it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2016-02-12 11:14:13 -08:00
|
|
|
Evas_Object *c;
|
|
|
|
Eina_List *cache = NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(it->item->flip_contents, c)
|
|
|
|
evas_object_del(c);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-11-19 05:08:54 -08:00
|
|
|
/* access */
|
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
2014-08-19 00:52:24 -07:00
|
|
|
_elm_access_widget_item_unregister(it->base);
|
2012-11-19 05:08:54 -08:00
|
|
|
|
2012-07-25 22:50:21 -07:00
|
|
|
// unswallow VIEW(it) first then manipulate VIEW(it)
|
2017-03-13 08:26:50 -07:00
|
|
|
_decorate_item_unrealize(it, EINA_FALSE);
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->decorate_all_mode) _decorate_all_item_unrealize(it);
|
2012-07-25 22:50:21 -07:00
|
|
|
|
2016-02-12 11:14:13 -08:00
|
|
|
if (!_item_cache_add(it, _content_cache_add(it, &cache)))
|
2012-10-22 07:34:43 -07:00
|
|
|
{
|
2018-05-07 15:16:29 -07:00
|
|
|
ELM_SAFE_FREE(VIEW(it), efl_del);
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(it->spacer, evas_object_del);
|
2016-02-12 11:14:13 -08:00
|
|
|
EINA_LIST_FREE(cache, c)
|
|
|
|
{
|
|
|
|
evas_object_del(c);
|
|
|
|
}
|
2012-10-22 07:34:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
it->states = NULL;
|
|
|
|
it->realized = EINA_FALSE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Evas_Coord minw = 0, minh = 0;
|
|
|
|
Eina_Bool show_me = EINA_FALSE, changed = EINA_FALSE;
|
|
|
|
Evas_Coord y = 0;
|
2015-12-01 23:23:39 -08:00
|
|
|
Item_Size *size = NULL;
|
2017-02-23 00:10:16 -08:00
|
|
|
int vis_count = 0;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-02-26 21:27:24 -08:00
|
|
|
itb->num = blk_idx;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2011-12-23 20:20:18 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
show_me |= it->item->show_me;
|
2015-09-23 04:50:05 -07:00
|
|
|
|
|
|
|
if (!it->filtered) _item_filtered_get(it);
|
|
|
|
if (it->hide)
|
|
|
|
{
|
|
|
|
if (it->realized) evas_object_hide(VIEW(it));
|
|
|
|
continue;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!itb->realized)
|
2011-12-23 20:20:18 -08:00
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
if (itb->sd->homogeneous &&
|
|
|
|
((!size) || it->itc != size->itc))
|
|
|
|
size = eina_hash_find(itb->sd->size_caches, &(it->itc));
|
|
|
|
if (qadd || (itb->sd->homogeneous && !size))
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
if (!it->item->mincalcd) changed = EINA_TRUE;
|
|
|
|
if (changed)
|
|
|
|
{
|
2016-01-21 23:55:37 -08:00
|
|
|
if (!size || (it->item->expanded_depth != size->expanded_depth))
|
2013-09-30 20:54:28 -07:00
|
|
|
{
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_realize(it, blk_idx + vis_count, EINA_TRUE);
|
2013-09-30 20:54:28 -07:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_TRUE);
|
|
|
|
}
|
2013-10-03 23:00:26 -07:00
|
|
|
else
|
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
it->item->w = it->item->minw = size->minw;
|
|
|
|
it->item->h = it->item->minh = size->minh;
|
2013-10-03 23:00:26 -07:00
|
|
|
it->item->mincalcd = EINA_TRUE;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2012-03-14 21:03:10 -07:00
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
if ((itb->sd->homogeneous) && size &&
|
2016-01-21 23:55:37 -08:00
|
|
|
(it->item->expanded_depth == size->expanded_depth) &&
|
2012-07-16 14:56:30 -07:00
|
|
|
(itb->sd->mode == ELM_LIST_COMPRESS))
|
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
it->item->w = it->item->minw = size->minw;
|
|
|
|
it->item->h = it->item->minh = size->minh;
|
2013-10-03 23:00:26 -07:00
|
|
|
it->item->mincalcd = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_realize(it, blk_idx + vis_count, EINA_TRUE);
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_TRUE);
|
|
|
|
}
|
2012-03-14 21:03:10 -07:00
|
|
|
}
|
2011-12-23 20:20:18 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->item->mincalcd) changed = EINA_TRUE;
|
2017-02-26 21:27:24 -08:00
|
|
|
_item_realize(it, blk_idx + vis_count, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
minh += it->item->minh;
|
|
|
|
if (minw < it->item->minw) minw = it->item->minw;
|
2017-02-26 21:27:24 -08:00
|
|
|
vis_count++;
|
2012-07-16 14:56:30 -07:00
|
|
|
it->x = 0;
|
|
|
|
it->y = y;
|
|
|
|
y += it->item->h;
|
2011-12-23 20:20:18 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
if (changed) itb->sd->pan_changed = changed;
|
|
|
|
itb->minw = minw;
|
|
|
|
itb->minh = minh;
|
|
|
|
itb->changed = EINA_FALSE;
|
|
|
|
itb->position_update = EINA_FALSE;
|
2017-02-23 00:10:16 -08:00
|
|
|
itb->vis_count = vis_count;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return show_me;
|
2009-02-12 05:39:43 -08:00
|
|
|
}
|
|
|
|
|
2009-09-13 19:53:03 -07:00
|
|
|
static void
|
|
|
|
_update_job(void *data)
|
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
2009-09-13 19:53:03 -07:00
|
|
|
Item_Block *itb;
|
2016-01-21 23:55:37 -08:00
|
|
|
Eina_List *l2;
|
2011-06-03 18:52:08 -07:00
|
|
|
int num, num0;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
sd->update_job = NULL;
|
2009-09-13 19:53:03 -07:00
|
|
|
num = 0;
|
2011-05-29 19:31:21 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
|
|
|
Evas_Coord itminw, itminh;
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2011-03-22 00:54:24 -07:00
|
|
|
|
|
|
|
if (!itb->updateme)
|
|
|
|
{
|
|
|
|
if (position)
|
|
|
|
_item_block_position(itb, num);
|
2017-02-26 21:27:24 -08:00
|
|
|
num += itb->vis_count;
|
2011-03-22 00:54:24 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
num0 = num;
|
2011-06-03 18:52:08 -07:00
|
|
|
recalc = EINA_FALSE;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l2, it)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->item->updateme)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
itminw = it->item->minw;
|
|
|
|
itminh = it->item->minh;
|
2011-03-22 00:54:24 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->updateme = EINA_FALSE;
|
2011-03-22 00:54:24 -07:00
|
|
|
if (it->realized)
|
|
|
|
{
|
2011-11-30 09:31:01 -08:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_FALSE);
|
2011-03-22 00:54:24 -07:00
|
|
|
_item_realize(it, num, EINA_FALSE);
|
2011-06-03 18:52:08 -07:00
|
|
|
position = EINA_TRUE;
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_item_realize(it, num, EINA_TRUE);
|
2011-11-30 09:31:01 -08:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_TRUE);
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
if ((it->item->minw != itminw) || (it->item->minh != itminh))
|
2011-06-03 18:52:08 -07:00
|
|
|
recalc = EINA_TRUE;
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
2017-02-26 21:27:24 -08:00
|
|
|
if (!it->hide) num++;
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
|
|
|
itb->updateme = EINA_FALSE;
|
|
|
|
if (recalc)
|
|
|
|
{
|
2011-06-03 18:52:08 -07:00
|
|
|
position = EINA_TRUE;
|
2011-03-22 00:54:24 -07:00
|
|
|
itb->changed = EINA_TRUE;
|
2011-06-08 03:58:00 -07:00
|
|
|
_item_block_recalc(itb, num0, EINA_FALSE);
|
2011-03-22 00:54:24 -07:00
|
|
|
_item_block_position(itb, num0);
|
|
|
|
}
|
|
|
|
}
|
2009-09-13 19:53:03 -07:00
|
|
|
if (position)
|
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_scroll_animate_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2009-09-07 23:20:32 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_ANIM_START, NULL);
|
2009-09-07 23:20:32 -07:00
|
|
|
}
|
|
|
|
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_scroll_animate_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_ANIM_STOP, NULL);
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_scroll_drag_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
}
|
|
|
|
|
2014-12-29 01:59:14 -08:00
|
|
|
static void
|
|
|
|
_scroll_cb(Evas_Object *obj,
|
|
|
|
void *data EINA_UNUSED)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL, NULL);
|
2014-12-29 01:59:14 -08:00
|
|
|
}
|
|
|
|
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_scroll_drag_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_edge_left_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_EDGE_LEFT, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_edge_right_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_EDGE_RIGHT, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_edge_top_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_EDGE_TOP, NULL);
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_edge_bottom_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
This small patch allows to get a smart callback when the scrollers in an
elm_list or in an elm_genlist fire the edge,{top,bottom,left,right}
signals, backporting them to the list object.
The new smart callbacks called are:
· "scroll,edge,top" - the list is scrolled until the top edge
· "scroll,edge,bottom" - the list is scrolled until the bottom edge
· "scroll,edge,left" - the list is scrolled until the left edge
· "scroll,edge,right" - the list is scrolled until the right edge
SVN revision: 3
SVN revision: 54393
2010-11-09 18:48:59 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_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
|
|
|
}
|
|
|
|
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
static void
|
|
|
|
_vbar_drag_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_VBAR_DRAG, NULL);
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_vbar_press_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_VBAR_PRESS, NULL);
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_vbar_unpress_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_VBAR_UNPRESS, NULL);
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_hbar_drag_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_HBAR_DRAG, NULL);
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_hbar_press_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_HBAR_PRESS, NULL);
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_hbar_unpress_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENLIST_EVENT_HBAR_UNPRESS, NULL);
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
}
|
|
|
|
|
2011-04-21 04:47:36 -07:00
|
|
|
static void
|
2012-04-03 02:56:53 -07:00
|
|
|
_decorate_item_realize(Elm_Gen_Item *it)
|
2011-04-21 04:47:36 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Evas_Object *obj = sd->obj;
|
2015-01-09 21:14:57 -08:00
|
|
|
char buf[1024];
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->deco_it_view) return;
|
2011-10-21 01:52:03 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2014-07-26 21:44:51 -07:00
|
|
|
it->item->deco_it_view = _view_create(it, it->itc->decorate_item_style);
|
2011-04-21 04:47:36 -07:00
|
|
|
|
|
|
|
/* signal callback add */
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_event_callback_add
|
2017-02-22 22:52:31 -08:00
|
|
|
(it->item->deco_it_view, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down_cb,
|
2012-07-16 14:56:30 -07:00
|
|
|
it);
|
|
|
|
evas_object_event_callback_add
|
2017-02-22 22:52:31 -08:00
|
|
|
(it->item->deco_it_view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_event_callback_add
|
2017-02-22 22:52:31 -08:00
|
|
|
(it->item->deco_it_view, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move_cb,
|
2012-07-16 14:56:30 -07:00
|
|
|
it);
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
_view_inflate(it->item->deco_it_view, it, &it->item->deco_it_texts,
|
2018-08-02 06:42:06 -07:00
|
|
|
&it->item->deco_it_contents, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
edje_object_part_swallow
|
|
|
|
(it->item->deco_it_view,
|
|
|
|
edje_object_data_get(it->item->deco_it_view, "mode_part"), VIEW(it));
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2015-01-09 21:14:57 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,active", sd->decorate_it_type);
|
2017-02-22 22:52:31 -08:00
|
|
|
edje_object_signal_emit(it->item->deco_it_view, buf, "elm");
|
2015-01-09 23:58:45 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), buf, "elm");
|
2015-01-09 21:14:57 -08:00
|
|
|
|
2012-02-22 23:39:10 -08:00
|
|
|
it->want_unrealize = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2012-02-22 23:39:10 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_decorate_item_set(Elm_Gen_Item *it)
|
2012-02-22 23:39:10 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it) return;
|
2012-02-22 23:39:10 -08:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-02-22 23:39:10 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->mode_item = it;
|
|
|
|
it->item->nocache_once = EINA_TRUE;
|
2011-06-14 02:18:54 -07:00
|
|
|
|
2013-05-29 04:54:11 -07:00
|
|
|
ELM_SAFE_FREE(sd->scr_hold_timer, ecore_timer_del);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(sd->obj, EINA_TRUE);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->scr_hold_timer = ecore_timer_add(SCR_HOLD_TIME, _scroll_hold_timer_cb, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
_decorate_item_realize(it);
|
|
|
|
if (it->item->group_item)
|
2013-06-22 23:17:39 -07:00
|
|
|
evas_object_stack_above(it->item->VIEW(group_item), sd->stack[1]);
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_position
|
|
|
|
(it, it->item->deco_it_view, it->item->scrl_x, it->item->scrl_y);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2011-06-14 02:18:54 -07:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_decorate_item_unset(Elm_Genlist_Data *sd)
|
2009-02-09 03:23:59 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
char buf[1024], buf2[1024];
|
|
|
|
Elm_Gen_Item *it;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->mode_item) return;
|
2011-05-06 17:30:39 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it = sd->mode_item;
|
|
|
|
it->item->nocache_once = EINA_TRUE;
|
2017-03-13 04:48:31 -07:00
|
|
|
it->decorate_it_set = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,passive", sd->decorate_it_type);
|
|
|
|
snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished",
|
|
|
|
sd->decorate_it_type);
|
|
|
|
edje_object_signal_emit(it->item->deco_it_view, buf, "elm");
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(it->item->deco_it_view, buf2, "elm", _decorate_item_finished_signal_cb,
|
|
|
|
it);
|
|
|
|
sd->mode_item = NULL;
|
2009-02-09 03:23:59 -08:00
|
|
|
}
|
|
|
|
|
2014-04-23 22:12:52 -07:00
|
|
|
static void
|
|
|
|
_elm_genlist_looping_up_cb(void *data,
|
2014-07-21 23:56:16 -07:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
|
|
|
Evas_Object *genlist = data;
|
2014-07-21 23:11:17 -07:00
|
|
|
|
|
|
|
ELM_GENLIST_DATA_GET(genlist, sd);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it = elm_genlist_last_item_get(genlist);
|
2014-07-21 23:56:16 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN);
|
2014-04-23 22:12:52 -07:00
|
|
|
elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm");
|
2014-07-21 23:11:17 -07:00
|
|
|
sd->item_looping_on = EINA_FALSE;
|
2015-06-25 07:15:06 -07:00
|
|
|
|
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_genlist_item_selected_set(eo_it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2014-04-23 22:12:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_genlist_looping_down_cb(void *data,
|
2014-07-21 23:56:16 -07:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
|
|
|
Evas_Object *genlist = data;
|
2014-07-21 23:11:17 -07:00
|
|
|
|
|
|
|
ELM_GENLIST_DATA_GET(genlist, sd);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it = elm_genlist_first_item_get(genlist);
|
2014-07-21 23:56:16 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_show(eo_it, ELM_GENLIST_ITEM_SCROLLTO_IN);
|
2014-04-23 22:12:52 -07:00
|
|
|
elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm");
|
2014-07-21 23:11:17 -07:00
|
|
|
sd->item_looping_on = EINA_FALSE;
|
2014-07-21 23:56:16 -07:00
|
|
|
|
2015-06-25 07:15:06 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_genlist_item_selected_set(eo_it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2014-07-21 23:56:16 -07:00
|
|
|
}
|
2014-04-23 22:12:52 -07:00
|
|
|
|
2015-05-18 04:29:37 -07:00
|
|
|
static void
|
|
|
|
_evas_viewport_resize_cb(void *d, Evas *e EINA_UNUSED, void *ei EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Data *priv = d;
|
|
|
|
evas_object_smart_changed(priv->pan_obj);
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_genlist_efl_canvas_group_group_add(Eo *obj, Elm_Genlist_Data *priv)
|
2011-11-30 09:13:57 -08:00
|
|
|
{
|
2013-10-05 01:14:25 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Pan_Data *pan_data;
|
2013-09-24 21:33:39 -07:00
|
|
|
Evas_Coord minw, minh;
|
|
|
|
int i;
|
2012-03-30 00:28:04 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2015-12-01 23:23:39 -08:00
|
|
|
priv->size_caches = eina_hash_pointer_new(_size_cache_free);
|
2012-07-16 14:56:30 -07:00
|
|
|
priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(priv->hit_rect, obj);
|
|
|
|
elm_widget_sub_object_add(obj, priv->hit_rect);
|
|
|
|
|
2012-07-18 14:03:39 -07:00
|
|
|
/* common scroller hit rectangle setup */
|
2012-07-16 14:56:30 -07:00
|
|
|
evas_object_color_set(priv->hit_rect, 0, 0, 0, 0);
|
|
|
|
evas_object_show(priv->hit_rect);
|
|
|
|
evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
|
2012-07-18 14:03:39 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2017-08-21 23:16:54 -07:00
|
|
|
elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL);
|
2012-07-18 14:03:39 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "genlist", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-07-18 14:03:39 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, wd->resize_obj, priv->hit_rect);
|
2012-07-18 14:03:39 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set
|
|
|
|
(obj, EINA_FALSE, _elm_config->thumbscroll_bounce_enable);
|
2012-07-18 14:03:39 -07:00
|
|
|
priv->v_bounce = _elm_config->thumbscroll_bounce_enable;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_animate_start_cb_set(obj, _scroll_animate_start_cb);
|
|
|
|
elm_interface_scrollable_animate_stop_cb_set(obj, _scroll_animate_stop_cb);
|
|
|
|
elm_interface_scrollable_scroll_cb_set(obj, _scroll_cb);
|
|
|
|
elm_interface_scrollable_drag_start_cb_set(obj, _scroll_drag_start_cb);
|
|
|
|
elm_interface_scrollable_drag_stop_cb_set(obj, _scroll_drag_stop_cb);
|
|
|
|
elm_interface_scrollable_edge_left_cb_set(obj, _edge_left_cb);
|
|
|
|
elm_interface_scrollable_edge_right_cb_set(obj, _edge_right_cb);
|
|
|
|
elm_interface_scrollable_edge_top_cb_set(obj, _edge_top_cb);
|
|
|
|
elm_interface_scrollable_edge_bottom_cb_set(obj, _edge_bottom_cb);
|
|
|
|
elm_interface_scrollable_vbar_drag_cb_set(obj, _vbar_drag_cb);
|
|
|
|
elm_interface_scrollable_vbar_press_cb_set(obj, _vbar_press_cb);
|
|
|
|
elm_interface_scrollable_vbar_unpress_cb_set(obj, _vbar_unpress_cb);
|
|
|
|
elm_interface_scrollable_hbar_drag_cb_set(obj, _hbar_drag_cb);
|
|
|
|
elm_interface_scrollable_hbar_press_cb_set(obj, _hbar_press_cb);
|
|
|
|
elm_interface_scrollable_hbar_unpress_cb_set(obj, _hbar_unpress_cb);
|
|
|
|
elm_interface_scrollable_content_min_limit_cb_set(obj, _content_min_limit_cb);
|
2012-07-18 14:03:39 -07:00
|
|
|
|
|
|
|
priv->mode = ELM_LIST_SCROLL;
|
|
|
|
priv->max_items_per_block = MAX_ITEMS_PER_BLOCK;
|
|
|
|
priv->item_cache_max = priv->max_items_per_block * 2;
|
|
|
|
priv->longpress_timeout = _elm_config->longpress_timeout;
|
|
|
|
priv->highlight = EINA_TRUE;
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
priv->pin_item = NULL;
|
|
|
|
priv->pin_item_top = EINA_FALSE;
|
2012-07-18 14:03:39 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
priv->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj));
|
|
|
|
pan_data = efl_data_scope_get(priv->pan_obj, MY_PAN_CLASS);
|
2017-02-14 22:04:20 -08:00
|
|
|
efl_data_ref(obj, MY_CLASS);
|
2012-11-25 22:32:53 -08:00
|
|
|
pan_data->wobj = obj;
|
2012-07-18 14:03:39 -07:00
|
|
|
pan_data->wsd = priv;
|
|
|
|
|
2013-06-22 23:17:39 -07:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
priv->stack[i] = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(priv->stack[i], priv->pan_obj);
|
|
|
|
}
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_extern_pan_set(obj, priv->pan_obj);
|
2012-07-18 14:03:39 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
|
2012-07-18 14:03:39 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-07-18 14:03:39 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2014-04-23 22:12:52 -07:00
|
|
|
|
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,looping,up,done", "elm", _elm_genlist_looping_up_cb, obj);
|
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,looping,down,done", "elm", _elm_genlist_looping_down_cb, obj);
|
2015-05-18 04:29:37 -07:00
|
|
|
evas_event_callback_add(evas_object_evas_get(obj),
|
|
|
|
EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE,
|
|
|
|
_evas_viewport_resize_cb, priv);
|
2011-11-30 09:13:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_genlist_efl_canvas_group_group_del(Eo *obj, Elm_Genlist_Data *sd)
|
2011-11-30 09:13:57 -08:00
|
|
|
{
|
2013-06-22 23:17:39 -07:00
|
|
|
int i;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
elm_genlist_clear(obj);
|
2018-05-15 10:52:12 -07:00
|
|
|
_item_cache_zero(sd);
|
|
|
|
|
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
|
|
|
|
2013-06-22 23:17:39 -07:00
|
|
|
for (i = 0; i < 2; i++)
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(sd->stack[i], evas_object_del);
|
2015-05-18 04:29:37 -07:00
|
|
|
|
|
|
|
evas_event_callback_del_full(evas_object_evas_get(obj),
|
|
|
|
EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE,
|
|
|
|
_evas_viewport_resize_cb, sd);
|
2018-05-15 10:52:12 -07:00
|
|
|
|
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
|
|
|
ELM_SAFE_FREE(sd->update_job, ecore_job_del);
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->pan_obj, evas_object_del);
|
2018-05-15 10:52:12 -07:00
|
|
|
ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
|
|
|
|
ELM_SAFE_FREE(sd->must_recalc_idler, ecore_idler_del);
|
|
|
|
ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(sd->size_caches, eina_hash_free);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2018-05-15 10:52:12 -07:00
|
|
|
eina_stringshare_replace(&sd->decorate_it_type, NULL);
|
2016-01-28 17:07:34 -08:00
|
|
|
|
|
|
|
_elm_genlist_tree_effect_stop(sd);
|
2011-11-30 09:13:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_genlist_efl_gfx_entity_position_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Position2D pos)
|
2011-11-30 09:13:57 -08:00
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
|
2016-10-10 20:39:05 -07:00
|
|
|
return;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
|
|
|
efl_gfx_entity_position_set(sd->hit_rect, pos);
|
2011-11-30 09:13:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_genlist_efl_gfx_entity_size_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Size2D sz)
|
2012-01-26 23:36:36 -08:00
|
|
|
{
|
2017-09-15 02:37:25 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, sz.w, sz.h))
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
return;
|
2012-01-26 23:36:36 -08:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(sd->hit_rect, sz);
|
2017-09-15 02:37:25 -07:00
|
|
|
if ((sd->queue) && (!sd->queue_idle_enterer) && (sz.w > 0))
|
2013-12-05 23:08:09 -08:00
|
|
|
_requeue_idle_enterer(sd);
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2012-01-26 23:36:36 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_genlist_efl_canvas_group_group_member_add(Eo *obj, Elm_Genlist_Data *sd, Evas_Object *member)
|
2012-01-27 03:59:22 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
2012-01-27 03:59:22 -08:00
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static void
|
2014-04-01 03:55:08 -07:00
|
|
|
_access_obj_process(Elm_Genlist_Data *sd, Eina_Bool is_access)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Item_Block *itb;
|
|
|
|
Eina_Bool done = EINA_FALSE;
|
2012-10-01 01:55:46 -07:00
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
|
|
|
{
|
|
|
|
if (itb->realized)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Gen_Item *it;
|
2012-10-01 01:55:46 -07:00
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
done = EINA_TRUE;
|
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
|
|
|
{
|
2015-09-23 04:50:05 -07:00
|
|
|
if (!it->realized || it->hide) continue;
|
2012-08-18 06:52:03 -07:00
|
|
|
if (is_access) _access_widget_item_register(it);
|
|
|
|
else
|
2014-08-19 00:52:24 -07:00
|
|
|
_elm_access_widget_item_unregister(it->base);
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (done) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_genlist_efl_ui_widget_on_access_update(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool acs)
|
2012-07-31 15:06:06 -07:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
_elm_genlist_smart_focus_next_enable = acs;
|
2012-11-25 22:32:53 -08:00
|
|
|
_access_obj_process(sd, _elm_genlist_smart_focus_next_enable);
|
2012-07-31 15:06:06 -07:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_genlist_add(Evas_Object *parent)
|
2011-11-30 09:13:57 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-03-09 08:27:03 -08:00
|
|
|
|
2017-11-11 09:26:53 -08:00
|
|
|
static void
|
|
|
|
_genlist_element_focused(void *data, const Efl_Event *ev)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(data, pd);
|
2018-01-07 20:55:35 -08:00
|
|
|
Efl_Ui_Widget *focused = efl_ui_focus_manager_focus_get(ev->object);
|
2017-11-11 09:26:53 -08:00
|
|
|
Elm_Widget_Item *item;
|
|
|
|
|
|
|
|
if (!focused) return;
|
|
|
|
|
2018-06-12 01:40:38 -07:00
|
|
|
item = efl_ui_focus_parent_provider_gen_item_fetch(pd->provider, focused);
|
2017-11-11 09:26:53 -08:00
|
|
|
|
2018-06-12 01:40:38 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(item, ELM_GENLIST_ITEM_CLASS));
|
|
|
|
elm_object_item_focus_set(item, EINA_TRUE);
|
2017-11-11 09:26:53 -08:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_genlist_efl_object_constructor(Eo *obj, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2017-11-11 09:26:53 -08:00
|
|
|
|
|
|
|
sd->content_item_map = eina_hash_pointer_new(NULL);
|
|
|
|
sd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_GEN_CLASS, obj,
|
|
|
|
efl_ui_focus_parent_provider_gen_container_set(efl_added, obj),
|
|
|
|
efl_ui_focus_parent_provider_gen_content_item_map_set(efl_added, sd->content_item_map));
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
sd->obj = obj;
|
2011-11-30 09:13:57 -08:00
|
|
|
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
2017-11-11 09:26:53 -08:00
|
|
|
efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _genlist_element_focused, obj);
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
return obj;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-08 06:03:52 -08:00
|
|
|
_internal_elm_genlist_clear(Evas_Object *obj)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
2015-01-14 05:04:26 -08:00
|
|
|
Elm_Gen_Item *it;
|
2009-09-23 15:56:47 -07:00
|
|
|
|
2015-01-06 21:38:25 -08:00
|
|
|
_elm_genlist_item_unfocused(sd->focused_item);
|
|
|
|
if (sd->mode_item) sd->mode_item = NULL;
|
|
|
|
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2015-09-23 04:50:05 -07:00
|
|
|
sd->filter_data = NULL;
|
|
|
|
if (sd->filter_queue)
|
|
|
|
ELM_SAFE_FREE(sd->queue_filter_enterer, ecore_idle_enterer_del);
|
|
|
|
ELM_SAFE_FREE(sd->filter_queue, eina_list_free);
|
|
|
|
ELM_SAFE_FREE(sd->filtered_list, eina_list_free);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
2015-01-14 23:12:37 -08:00
|
|
|
|
2015-01-08 06:37:06 -08:00
|
|
|
// Do not use EINA_INLIST_FOREACH or EINA_INLIST_FOREACH_SAFE
|
|
|
|
// because sd->items can be modified inside elm_widget_item_del()
|
2015-01-14 05:04:26 -08:00
|
|
|
while (sd->items)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2018-05-07 15:16:29 -07:00
|
|
|
it = EINA_INLIST_CONTAINER_GET(sd->items, Elm_Gen_Item);
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_del(EO_OBJ(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2015-01-14 23:12:37 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->pan_changed = EINA_TRUE;
|
2012-12-28 01:51:40 -08:00
|
|
|
if (!sd->queue)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
2015-01-06 21:38:25 -08:00
|
|
|
sd->anchor_item = NULL;
|
|
|
|
ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
|
|
|
|
ELM_SAFE_FREE(sd->must_recalc_idler, ecore_idler_del);
|
|
|
|
ELM_SAFE_FREE(sd->reorder_move_animator, ecore_animator_del);
|
|
|
|
sd->reorder_old_pan_y = 0;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2014-12-31 02:55:09 -08:00
|
|
|
|
|
|
|
if (sd->selected) ELM_SAFE_FREE(sd->selected, eina_list_free);
|
|
|
|
|
2015-01-06 21:38:25 -08:00
|
|
|
sd->show_item = NULL;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->pan_x = 0;
|
|
|
|
sd->pan_y = 0;
|
|
|
|
sd->minw = 0;
|
|
|
|
sd->minh = 0;
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->pan_obj)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(sd->pan_obj, sd->minw, sd->minh);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
elm_layout_sizing_eval(sd->obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show(obj, 0, 0, 0, 0);
|
2015-01-06 21:38:25 -08:00
|
|
|
|
2016-01-28 17:07:34 -08:00
|
|
|
_elm_genlist_tree_effect_stop(sd);
|
|
|
|
|
2015-05-28 03:59:22 -07:00
|
|
|
ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(sd->update_job, ecore_job_del);
|
|
|
|
ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
|
|
|
|
ELM_SAFE_FREE(sd->must_recalc_idler, ecore_idler_del);
|
2015-01-06 21:38:25 -08:00
|
|
|
ELM_SAFE_FREE(sd->event_block_rect, evas_object_del);
|
|
|
|
ELM_SAFE_FREE(sd->scr_hold_timer, ecore_timer_del);
|
|
|
|
ELM_SAFE_FREE(sd->queue, eina_list_free);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
2016-02-19 15:58:30 -08:00
|
|
|
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2015-01-14 23:12:37 -08:00
|
|
|
/* Return EINA_TRUE if the item is deleted in this function */
|
|
|
|
static Eina_Bool
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_select(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2018-05-07 15:16:29 -07:00
|
|
|
Eina_Bool r = EINA_FALSE;
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it)) return EINA_FALSE;
|
2015-01-14 23:12:37 -08:00
|
|
|
if (_is_no_select(it) || (it->decorate_it_set)) return EINA_FALSE;
|
2015-01-08 06:58:11 -08:00
|
|
|
if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) &&
|
|
|
|
(it->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) && it->selected)
|
2015-01-14 23:12:37 -08:00
|
|
|
return EINA_FALSE;
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2015-01-06 03:17:03 -08:00
|
|
|
if (!sd->multi)
|
|
|
|
{
|
|
|
|
const Eina_List *l, *ll;
|
2015-01-07 18:13:02 -08:00
|
|
|
Elm_Object_Item *eo_it2;
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, ll, eo_it2)
|
2015-01-06 03:17:03 -08:00
|
|
|
{
|
2015-01-07 18:13:02 -08:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2015-01-06 03:17:03 -08:00
|
|
|
if (it2 != it) _item_unselect(it2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
it->selected = EINA_TRUE;
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->selected =
|
2014-11-25 04:55:12 -08:00
|
|
|
eina_list_append(sd->selected, eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2018-04-16 16:40:39 -07:00
|
|
|
efl_ref(eo_it);
|
2018-05-07 15:16:29 -07:00
|
|
|
|
2015-01-18 22:26:21 -08:00
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2015-07-19 08:09:23 -07:00
|
|
|
if ((it->base)->on_deletion) goto item_deleted;
|
2015-01-18 22:26:21 -08:00
|
|
|
_elm_genlist_item_content_focus_set(it, ELM_FOCUS_PREVIOUS);
|
|
|
|
sd->last_selected_item = eo_it;
|
|
|
|
_item_highlight(it);
|
|
|
|
|
2015-01-14 11:41:50 -08:00
|
|
|
if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it);
|
2015-01-15 05:36:28 -08:00
|
|
|
// delete item if it's requested deletion in the above callbacks.
|
|
|
|
if ((it->base)->on_deletion) goto item_deleted;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_SELECTED, eo_it);
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_SELECTED, EINA_TRUE);
|
2015-01-14 23:12:37 -08:00
|
|
|
// delete item if it's requested deletion in the above callbacks.
|
2018-05-07 15:16:29 -07:00
|
|
|
if ((it->base)->on_deletion)
|
|
|
|
{
|
|
|
|
r = EINA_TRUE;
|
|
|
|
goto item_deleted;
|
|
|
|
}
|
2015-01-14 23:12:37 -08:00
|
|
|
|
2014-09-05 09:47:55 -07:00
|
|
|
if (!(sd->focus_on_selection_enabled || _elm_config->item_select_on_focus_disable))
|
|
|
|
{
|
2017-11-11 09:26:53 -08:00
|
|
|
efl_ui_focus_manager_focus_set(obj, it->base->eo_obj);
|
2014-09-05 09:47:55 -07:00
|
|
|
}
|
|
|
|
|
2018-05-07 15:16:29 -07:00
|
|
|
item_deleted:
|
|
|
|
efl_unref(eo_it);
|
2015-01-15 05:36:28 -08:00
|
|
|
|
2018-05-07 15:16:29 -07:00
|
|
|
return r;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2011-12-05 08:43:29 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_elm_widget_item_part_content_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char * part)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2013-02-25 20:42:28 -08:00
|
|
|
Evas_Object *ret = NULL;
|
|
|
|
if (it->deco_all_view)
|
|
|
|
ret = edje_object_part_swallow_get(it->deco_all_view, part);
|
|
|
|
else if (it->decorate_it_set)
|
|
|
|
ret = edje_object_part_swallow_get(it->item->deco_it_view, part);
|
|
|
|
if (!ret)
|
2013-11-30 01:28:47 -08:00
|
|
|
{
|
|
|
|
if (part)
|
|
|
|
ret = edje_object_part_swallow_get(VIEW(it), part);
|
|
|
|
else
|
|
|
|
ret = edje_object_part_swallow_get(VIEW(it), "elm.swallow.icon");
|
|
|
|
}
|
2013-02-25 20:42:28 -08:00
|
|
|
return ret;
|
2009-02-12 05:39:43 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_elm_widget_item_part_text_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char * part)
|
2012-05-15 22:28:40 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->itc->func.text_get) return NULL;
|
2013-02-25 20:42:28 -08:00
|
|
|
const char *ret = NULL;
|
|
|
|
if (it->deco_all_view)
|
|
|
|
ret = edje_object_part_text_get(it->deco_all_view, part);
|
|
|
|
else if (it->decorate_it_set)
|
|
|
|
ret = edje_object_part_text_get(it->item->deco_it_view, part);
|
|
|
|
if (!ret)
|
2013-11-30 01:28:47 -08:00
|
|
|
{
|
|
|
|
if (part)
|
|
|
|
ret = edje_object_part_text_get(VIEW(it), part);
|
|
|
|
else
|
|
|
|
ret = edje_object_part_text_get(VIEW(it), "elm.text");
|
|
|
|
}
|
2013-02-25 20:42:28 -08:00
|
|
|
return ret;
|
2012-05-15 22:28:40 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
2015-01-08 02:47:14 -08:00
|
|
|
_elm_genlist_item_elm_widget_item_disable(Eo *eo_it, Elm_Gen_Item *it)
|
2012-05-15 22:28:40 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *obj;
|
2012-05-23 21:59:52 -07:00
|
|
|
|
2015-01-08 02:43:57 -08:00
|
|
|
_item_unselect(it);
|
2017-02-22 22:52:31 -08:00
|
|
|
if (eo_it == it->item->wsd->focused_item)
|
2015-01-08 02:47:14 -08:00
|
|
|
_elm_genlist_item_unfocused(eo_it);
|
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (it->realized)
|
2012-05-15 22:28:40 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-05-15 22:28:40 -07:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_DISABLED, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
|
|
|
edje_object_signal_emit
|
2014-12-29 02:49:19 -08:00
|
|
|
(it->deco_all_view, SIGNAL_DISABLED, "elm");
|
2012-05-15 22:28:40 -07:00
|
|
|
}
|
2012-05-30 03:44:59 -07:00
|
|
|
else
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-12-29 02:49:19 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_ENABLED, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->deco_all_view)
|
|
|
|
edje_object_signal_emit
|
2014-12-29 02:49:19 -08:00
|
|
|
(it->deco_all_view, SIGNAL_ENABLED, "elm");
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2015-01-02 02:04:34 -08:00
|
|
|
EINA_LIST_FOREACH(it->contents, l, obj)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_widget_disabled_set(obj, elm_wdg_item_disabled_get(EO_OBJ(it)));
|
2012-05-29 03:25:55 -07:00
|
|
|
}
|
2012-05-15 22:28:40 -07:00
|
|
|
}
|
|
|
|
|
2018-04-16 16:56:23 -07:00
|
|
|
EOLIAN static void
|
2015-01-14 06:19:29 -08:00
|
|
|
_elm_genlist_item_elm_widget_item_del_pre(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Gen_Item *it)
|
2009-02-12 05:39:43 -08:00
|
|
|
{
|
2015-01-15 05:36:28 -08:00
|
|
|
/* This item is getting removed from a callback that triggered in the
|
|
|
|
_item_select(). Just pend removing. Because this will be removed right
|
|
|
|
after in the _item_select(). So pratically, this item won't be
|
|
|
|
dangled. */
|
2015-12-01 07:55:12 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_children_changed_del_signal_emit(WIDGET(it),eo_it);
|
2015-01-15 05:36:28 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_del(it);
|
2010-03-28 19:27:26 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char *emission, const char *source)
|
2010-03-28 19:27:26 -07:00
|
|
|
{
|
2015-01-08 02:49:39 -08:00
|
|
|
if (!it->realized)
|
|
|
|
{
|
|
|
|
WRN("Item is not realized yet");
|
|
|
|
return;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), emission, source);
|
2015-01-08 02:50:52 -08:00
|
|
|
if (it->deco_all_view)
|
|
|
|
edje_object_signal_emit(it->deco_all_view, emission, source);
|
2009-02-12 05:39:43 -08:00
|
|
|
}
|
|
|
|
|
2016-04-01 00:53:57 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_style_set(Eo *eo_it,
|
|
|
|
Elm_Gen_Item *it,
|
|
|
|
const char *style)
|
|
|
|
{
|
|
|
|
if (it->itc && !strcmp(it->itc->item_style, style)) return;
|
|
|
|
|
|
|
|
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
|
|
|
|
|
|
|
|
itc->item_style = style;
|
|
|
|
if (it->itc)
|
|
|
|
{
|
|
|
|
itc->func.text_get = it->itc->func.text_get;
|
|
|
|
itc->func.content_get = it->itc->func.content_get;
|
|
|
|
itc->func.state_get = it->itc->func.state_get;
|
|
|
|
itc->func.filter_get = it->itc->func.filter_get;
|
|
|
|
itc->func.reusable_content_get = it->itc->func.reusable_content_get;
|
|
|
|
itc->decorate_item_style = it->itc->decorate_item_style;
|
|
|
|
itc->decorate_all_item_style = it->itc->decorate_all_item_style;
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_genlist_item_item_class_update(eo_it, itc);
|
|
|
|
elm_genlist_item_class_free(itc);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_elm_widget_item_style_get(const Eo *eo_it EINA_UNUSED,
|
2016-04-01 00:53:57 -07:00
|
|
|
Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
if (it->itc) return it->itc->item_style;
|
|
|
|
else return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_genlist_item_elm_widget_item_item_focus_set(Eo *eo_it, Elm_Gen_Item *it, Eina_Bool focused)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (focused)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
sd->last_focused_item = eo_it;
|
2014-03-08 08:04:34 -08:00
|
|
|
if (!elm_object_focus_get(obj))
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
|
|
|
2017-11-30 10:28:18 -08:00
|
|
|
if (!elm_object_focus_get(obj))
|
2015-02-02 22:47:32 -08:00
|
|
|
return;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (eo_it != sd->focused_item)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:28 -07:00
|
|
|
_elm_genlist_item_unfocused(sd->focused_item);
|
|
|
|
_elm_genlist_item_focused(eo_it);
|
2014-05-11 09:04:25 -07:00
|
|
|
|
2015-03-11 03:59:58 -07:00
|
|
|
/* If item is not realized state, widget couldn't get focus_highlight data. */
|
|
|
|
if (it->realized)
|
|
|
|
{
|
|
|
|
_elm_widget_item_highlight_in_theme(obj, EO_OBJ(it));
|
|
|
|
_elm_widget_highlight_in_theme_update(obj);
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
2018-03-11 13:08:42 -07:00
|
|
|
efl_ui_focus_manager_focus_set(it->base->widget, eo_it);
|
|
|
|
sd->focus_on_realization = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->focus_on_realization = it;
|
2015-03-11 03:59:58 -07:00
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2015-02-02 22:47:32 -08:00
|
|
|
{
|
2017-11-29 00:39:42 -08:00
|
|
|
if (!efl_ui_focus_object_focus_get(obj))
|
2015-02-02 22:47:32 -08:00
|
|
|
return;
|
|
|
|
_elm_genlist_item_unfocused(eo_it);
|
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_elm_widget_item_item_focus_get(const Eo *eo_it, Elm_Gen_Item *it)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
2014-03-08 08:04:34 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_genlist_item_efl_object_constructor(Eo *eo_it, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_it = efl_constructor(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS));
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
it->base = efl_data_scope_get(eo_it, ELM_WIDGET_ITEM_CLASS);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(eo_it, EFL_ACCESS_ROLE_LIST_ITEM);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return eo_it;
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static Elm_Gen_Item *
|
2014-04-01 03:55:08 -07:00
|
|
|
_elm_genlist_item_new(Elm_Genlist_Data *sd,
|
2012-11-16 06:26:07 -08:00
|
|
|
const Elm_Genlist_Item_Class *itc,
|
2012-07-16 14:56:30 -07:00
|
|
|
const void *data,
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_parent,
|
2012-11-16 06:26:07 -08:00
|
|
|
Elm_Genlist_Item_Type type,
|
2012-07-16 14:56:30 -07:00
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *func_data)
|
2011-04-27 03:17:26 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Gen_Item *it2;
|
2012-11-16 06:26:07 -08:00
|
|
|
int depth = 0;
|
2011-05-07 01:37:47 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!itc) return NULL;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
Eo *eo_it = efl_add(ELM_GENLIST_ITEM_CLASS, sd->obj);
|
2014-09-27 22:15:28 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
it->itc = itc;
|
|
|
|
elm_genlist_item_class_ref((Elm_Genlist_Item_Class *)itc);
|
2012-11-16 06:26:04 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_parent, parent);
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(EO_OBJ(it), data);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->parent = parent;
|
|
|
|
it->func.func = func;
|
|
|
|
it->func.data = func_data;
|
2012-11-16 06:26:04 -08:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
it->item = ELM_NEW(Elm_Gen_Item_Type);
|
|
|
|
it->item->wsd = sd;
|
|
|
|
it->item->type = type;
|
2017-02-26 21:27:24 -08:00
|
|
|
it->item->order_num_in = -1;
|
2012-11-16 06:26:07 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->parent)
|
2010-03-24 03:00:50 -07:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->parent->item->type & ELM_GENLIST_ITEM_GROUP)
|
|
|
|
it->item->group_item = parent;
|
|
|
|
else if (it->parent->item->group_item)
|
|
|
|
it->item->group_item = it->parent->item->group_item;
|
2010-03-24 03:00:50 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
|
2012-06-18 02:54:00 -07:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if (!(it2->parent->item->type & ELM_GENLIST_ITEM_GROUP)) depth += 1;
|
2012-06-18 02:54:00 -07:00
|
|
|
}
|
2017-02-22 22:52:31 -08:00
|
|
|
it->item->expanded_depth = depth;
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->item_count++;
|
2012-06-21 01:36:21 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
return it;
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
|
|
|
|
2011-05-25 07:58:39 -07:00
|
|
|
static int
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_compare(const void *data,
|
|
|
|
const void *data1)
|
2011-05-25 07:58:39 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
const Elm_Gen_Item *it, *item1;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2011-10-21 15:55:45 -07:00
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
|
|
|
item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
|
2017-02-22 22:52:31 -08:00
|
|
|
return it->item->wsd->item_compare_cb(EO_OBJ(it), EO_OBJ(item1));
|
2011-05-25 07:58:39 -07:00
|
|
|
}
|
|
|
|
|
2011-07-28 09:43:15 -07:00
|
|
|
static int
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_list_compare(const void *data,
|
|
|
|
const void *data1)
|
2011-07-28 09:43:15 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
const Elm_Gen_Item *it = data;
|
|
|
|
const Elm_Gen_Item *item1 = data1;
|
2011-06-01 20:10:11 -07:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
return it->item->wsd->item_compare_cb(EO_OBJ(it), EO_OBJ(item1));
|
2011-06-01 20:10:11 -07:00
|
|
|
}
|
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
static int
|
|
|
|
_elm_genlist_eo_item_list_compare(const void *data,
|
|
|
|
const void *data1)
|
|
|
|
{
|
|
|
|
const Elm_Object_Item *eo_it = data;
|
|
|
|
const Elm_Object_Item *eo_item1 = data1;
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
return it->item->wsd->item_compare_cb(eo_it, eo_item1);
|
2014-11-21 23:09:11 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static unsigned int
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_genlist_items_count(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->item_count;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-02-15 12:23:18 -08:00
|
|
|
static Eina_List *
|
|
|
|
_list_last_recursive(Eina_List *list)
|
|
|
|
{
|
|
|
|
Eina_List *ll, *ll2;
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it2;
|
2014-02-15 12:23:18 -08:00
|
|
|
|
|
|
|
ll = eina_list_last(list);
|
|
|
|
if (!ll) return NULL;
|
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
eo_it2 = ll->data;
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2014-02-15 12:23:18 -08:00
|
|
|
|
|
|
|
if (it2->item->items)
|
|
|
|
{
|
|
|
|
ll2 = _list_last_recursive(it2->item->items);
|
|
|
|
if (ll2)
|
|
|
|
{
|
|
|
|
return ll2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ll;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-01-08 01:10:12 -08:00
|
|
|
_elm_genlist_item_append(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2015-01-08 01:10:12 -08:00
|
|
|
if (eo_parent)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_parent, parent);
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(parent, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(parent)), NULL);
|
|
|
|
}
|
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
it = _elm_genlist_item_new
|
2015-01-08 01:10:12 -08:00
|
|
|
(sd, itc, data, eo_parent, type, func, func_data);
|
2014-04-01 03:55:08 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2009-02-12 05:39:43 -08:00
|
|
|
if (!it->parent)
|
2009-03-12 22:50:38 -07:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_GROUP)
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->group_items = eina_list_append(sd->group_items, it);
|
|
|
|
sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it));
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->rel = NULL;
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
2009-02-11 03:49:43 -08:00
|
|
|
else
|
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it2 = NULL;
|
2014-02-15 12:23:18 -08:00
|
|
|
Eina_List *ll = _list_last_recursive(it->parent->item->items);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
if (ll) eo_it2 = ll->data;
|
2017-02-21 20:53:03 -08:00
|
|
|
if (!it->parent->item->items)
|
|
|
|
sd->top_level_parent_items++;
|
2012-07-16 14:56:30 -07:00
|
|
|
it->parent->item->items =
|
2014-11-21 23:09:11 -08:00
|
|
|
eina_list_append(it->parent->item->items, EO_OBJ(it));
|
|
|
|
if (!eo_it2) eo_it2 = EO_OBJ(it->parent);
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2017-02-22 23:45:29 -08:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2));
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->rel = it2;
|
2013-03-29 06:23:38 -07:00
|
|
|
it2->item->rel_revs = eina_list_append(it2->item->rel_revs, it);
|
2017-02-21 20:53:03 -08:00
|
|
|
_item_expanded_set_noevent(it->parent, EINA_TRUE);
|
2009-02-11 03:49:43 -08:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->before = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_queue(sd, it, NULL);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-01-08 01:10:12 -08:00
|
|
|
_elm_genlist_item_prepend(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2015-01-08 01:10:12 -08:00
|
|
|
if (eo_parent)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_parent, parent);
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(parent, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(parent)), NULL);
|
2015-08-28 04:18:23 -07:00
|
|
|
/* first sub-item should allways be appended */
|
|
|
|
if (!parent->item->items)
|
|
|
|
return _elm_genlist_item_append(obj, sd, itc, data, eo_parent, type, func, func_data);
|
2015-01-08 01:10:12 -08:00
|
|
|
}
|
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
it = _elm_genlist_item_new
|
2015-01-08 01:10:12 -08:00
|
|
|
(sd, itc, data, eo_parent, type, func, func_data);
|
2014-04-01 03:55:08 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2009-02-18 04:41:45 -08:00
|
|
|
if (!it->parent)
|
2011-01-04 21:59:30 -08:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_GROUP)
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->group_items = eina_list_prepend(sd->group_items, it);
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it));
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->rel = NULL;
|
2011-01-04 21:59:30 -08:00
|
|
|
}
|
2009-02-18 04:41:45 -08:00
|
|
|
else
|
|
|
|
{
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it2 = NULL;
|
2011-10-21 01:52:03 -07:00
|
|
|
Eina_List *ll = it->parent->item->items;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
if (ll) eo_it2 = ll->data;
|
2017-02-21 20:53:03 -08:00
|
|
|
if (!it->parent->item->items)
|
|
|
|
sd->top_level_parent_items++;
|
2012-07-16 14:56:30 -07:00
|
|
|
it->parent->item->items =
|
2014-11-21 23:09:11 -08:00
|
|
|
eina_list_prepend(it->parent->item->items, EO_OBJ(it));
|
|
|
|
if (!eo_it2) eo_it2 = EO_OBJ(it->parent);
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
2015-01-08 01:10:12 -08:00
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(it2));
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->rel = it2;
|
2013-03-29 06:23:38 -07:00
|
|
|
it2->item->rel_revs = eina_list_append(it2->item->rel_revs, it);
|
2017-02-21 20:53:03 -08:00
|
|
|
_item_expanded_set_noevent(it->parent, EINA_TRUE);
|
2009-02-18 04:41:45 -08:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->before = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_queue(sd, it, NULL);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-01-07 01:11:51 -08:00
|
|
|
_elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Object_Item *eo_after, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_after, after);
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(after, NULL);
|
2015-01-07 01:11:51 -08:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(after)), NULL);
|
|
|
|
if (eo_parent)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_parent, parent);
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(parent, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(parent)), NULL);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
/* It makes no sense to insert after in an empty list with after !=
|
|
|
|
* NULL, something really bad is happening in your app. */
|
2014-04-01 03:55:08 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->items, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
it = _elm_genlist_item_new
|
2015-01-07 01:11:51 -08:00
|
|
|
(sd, itc, data, eo_parent, type, func, func_data);
|
2014-04-01 03:55:08 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2011-08-01 23:59:45 -07:00
|
|
|
if (!it->parent)
|
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if ((it->item->type & ELM_GENLIST_ITEM_GROUP) &&
|
|
|
|
(after->item->type & ELM_GENLIST_ITEM_GROUP))
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->group_items = eina_list_append_relative
|
2015-01-08 00:53:53 -08:00
|
|
|
(sd->group_items, it, after);
|
2017-02-22 22:52:31 -08:00
|
|
|
else if (it->item->type & ELM_GENLIST_ITEM_GROUP)
|
2016-04-30 11:31:29 -07:00
|
|
|
CRI("GROUP ITEM INSERT FAILED: NON-GROUP ITEM PASSED AS 'after'!");
|
2011-08-01 23:59:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-21 20:53:03 -08:00
|
|
|
if (!it->parent->item->items)
|
|
|
|
sd->top_level_parent_items++;
|
2012-01-19 21:18:31 -08:00
|
|
|
it->parent->item->items =
|
2014-11-21 23:09:11 -08:00
|
|
|
eina_list_append_relative(it->parent->item->items, EO_OBJ(it), eo_after);
|
2017-02-21 20:53:03 -08:00
|
|
|
_item_expanded_set_noevent(it->parent, EINA_TRUE);
|
2011-08-01 23:59:45 -07:00
|
|
|
}
|
2017-02-21 05:04:10 -08:00
|
|
|
|
2017-02-21 20:53:03 -08:00
|
|
|
if (after->item->items)
|
2017-02-21 05:04:10 -08:00
|
|
|
{
|
2017-02-21 20:53:03 -08:00
|
|
|
Eina_List *ll = _list_last_recursive(after->item->items);
|
|
|
|
if (ll)
|
|
|
|
{
|
|
|
|
eo_after = ll->data;
|
|
|
|
after = efl_data_scope_get(eo_after, ELM_GENLIST_ITEM_CLASS);
|
|
|
|
}
|
2017-02-21 05:04:10 -08:00
|
|
|
}
|
2017-02-21 20:53:03 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
|
|
|
|
|
|
|
|
it->item->rel = after;
|
2013-03-29 06:23:38 -07:00
|
|
|
after->item->rel_revs = eina_list_append(after->item->rel_revs, it);
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->before = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_queue(sd, it, NULL);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2011-08-01 23:59:45 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-01-07 01:11:51 -08:00
|
|
|
_elm_genlist_item_insert_before(Eo *obj, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Object_Item *eo_before, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_before, before);
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(before, NULL);
|
2015-01-07 01:11:51 -08:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(before)), NULL);
|
|
|
|
if (eo_parent)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_parent, parent);
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(parent, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(parent)), NULL);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
/* It makes no sense to insert before in an empty list with before
|
|
|
|
* != NULL, something really bad is happening in your app. */
|
2014-04-01 03:55:08 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->items, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
it = _elm_genlist_item_new
|
2015-01-07 01:11:51 -08:00
|
|
|
(sd, itc, data, eo_parent, type, func, func_data);
|
2014-04-01 03:55:08 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2011-08-01 23:50:34 -07:00
|
|
|
if (!it->parent)
|
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
if ((it->item->type & ELM_GENLIST_ITEM_GROUP) &&
|
|
|
|
(before->item->type & ELM_GENLIST_ITEM_GROUP))
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->group_items =
|
|
|
|
eina_list_prepend_relative(sd->group_items, it, before);
|
2017-02-22 22:52:31 -08:00
|
|
|
else if (it->item->type & ELM_GENLIST_ITEM_GROUP)
|
2016-04-30 11:31:29 -07:00
|
|
|
CRI("GROUP ITEM INSERT FAILED: NON-GROUP ITEM PASSED AS 'after'!");
|
2011-08-01 23:50:34 -07:00
|
|
|
}
|
|
|
|
else
|
2009-02-18 04:41:45 -08:00
|
|
|
{
|
2017-02-21 20:53:03 -08:00
|
|
|
if (!it->parent->item->items)
|
|
|
|
sd->top_level_parent_items++;
|
2012-01-19 21:18:31 -08:00
|
|
|
it->parent->item->items =
|
2014-11-21 23:09:11 -08:00
|
|
|
eina_list_prepend_relative(it->parent->item->items, EO_OBJ(it), eo_before);
|
2017-02-21 20:53:03 -08:00
|
|
|
_item_expanded_set_noevent(it->parent, EINA_TRUE);
|
2009-02-18 04:41:45 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
|
|
|
|
|
|
|
|
it->item->rel = before;
|
2017-02-22 22:52:31 -08:00
|
|
|
before->item->rel_revs = eina_list_append(before->item->rel_revs, it);
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->before = EINA_TRUE;
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_queue(sd, it, NULL);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-01-07 01:11:51 -08:00
|
|
|
_elm_genlist_item_sorted_insert(Eo *obj, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Genlist_Item_Type type, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2017-02-21 04:48:11 -08:00
|
|
|
Elm_Object_Item *eo_rel = NULL;
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *rel = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2017-02-21 04:48:11 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(comp, NULL);
|
2015-01-07 01:11:51 -08:00
|
|
|
if (eo_parent)
|
2015-01-06 22:49:19 -08:00
|
|
|
{
|
2015-01-07 01:11:51 -08:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_parent, parent);
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(parent, NULL);
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL((obj == WIDGET(parent)), NULL);
|
2015-01-06 22:49:19 -08:00
|
|
|
}
|
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
it = _elm_genlist_item_new
|
2015-01-07 01:11:51 -08:00
|
|
|
(sd, itc, data, eo_parent, type, func, func_data);
|
2014-04-01 03:55:08 -07:00
|
|
|
if (!it) return NULL;
|
2014-11-21 23:09:11 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2011-05-25 07:58:39 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->item_compare_cb = comp;
|
2011-06-25 16:20:22 -07:00
|
|
|
|
2011-05-25 07:58:39 -07:00
|
|
|
if (it->parent)
|
|
|
|
{
|
2017-02-21 04:48:11 -08:00
|
|
|
Eina_List *l;
|
2011-07-28 09:43:15 -07:00
|
|
|
int cmp_result;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
l = eina_list_search_sorted_near_list
|
2014-11-21 23:09:11 -08:00
|
|
|
(it->parent->item->items, _elm_genlist_eo_item_list_compare, eo_it,
|
2012-07-16 14:56:30 -07:00
|
|
|
&cmp_result);
|
|
|
|
|
2011-07-28 09:43:15 -07:00
|
|
|
if (l)
|
2014-02-19 02:30:10 -08:00
|
|
|
{
|
2014-11-22 23:18:42 -08:00
|
|
|
eo_rel = eina_list_data_get(l);
|
2016-08-15 06:44:41 -07:00
|
|
|
rel = efl_data_scope_get(eo_rel, ELM_GENLIST_ITEM_CLASS);
|
2011-07-28 09:43:15 -07:00
|
|
|
|
2014-02-19 02:30:10 -08:00
|
|
|
if (cmp_result >= 0)
|
|
|
|
{
|
|
|
|
it->parent->item->items = eina_list_prepend_relative_list
|
2014-11-21 23:09:11 -08:00
|
|
|
(it->parent->item->items, eo_it, l);
|
2014-02-19 02:30:10 -08:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
|
|
|
|
it->item->before = EINA_TRUE;
|
|
|
|
}
|
2017-02-21 20:53:03 -08:00
|
|
|
else // if (cmp_result < 0)
|
2014-02-19 02:30:10 -08:00
|
|
|
{
|
|
|
|
it->parent->item->items = eina_list_append_relative_list
|
2014-11-21 23:09:11 -08:00
|
|
|
(it->parent->item->items, eo_it, l);
|
2017-03-20 06:24:41 -07:00
|
|
|
if (rel->item->items)
|
2016-04-26 05:12:14 -07:00
|
|
|
{
|
2017-03-20 06:24:41 -07:00
|
|
|
Eina_List *ll = _list_last_recursive(rel->item->items);
|
|
|
|
eo_rel = ll->data;
|
2016-08-15 06:44:41 -07:00
|
|
|
rel = efl_data_scope_get(eo_rel, ELM_GENLIST_ITEM_CLASS);
|
2016-04-26 05:12:14 -07:00
|
|
|
}
|
2014-02-19 02:30:10 -08:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
|
|
|
|
it->item->before = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2011-07-28 09:43:15 -07:00
|
|
|
{
|
2017-02-21 20:53:03 -08:00
|
|
|
// parent had no child
|
2014-02-19 02:30:10 -08:00
|
|
|
rel = it->parent;
|
|
|
|
|
2017-02-21 04:48:11 -08:00
|
|
|
it->parent->item->items = eina_list_prepend
|
|
|
|
(it->parent->item->items, eo_it);
|
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
|
2011-10-21 01:52:03 -07:00
|
|
|
it->item->before = EINA_FALSE;
|
2017-02-21 20:53:03 -08:00
|
|
|
sd->top_level_parent_items++;
|
2011-07-28 09:43:15 -07:00
|
|
|
}
|
2017-02-21 04:48:11 -08:00
|
|
|
|
|
|
|
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
2017-02-21 20:53:03 -08:00
|
|
|
|
|
|
|
// ensure expanded state is on
|
|
|
|
_item_expanded_set_noevent(it->parent, EINA_TRUE);
|
2011-05-25 07:58:39 -07:00
|
|
|
}
|
2011-07-28 09:43:15 -07:00
|
|
|
else
|
2011-05-25 07:58:39 -07:00
|
|
|
{
|
2017-02-21 20:53:03 -08:00
|
|
|
if (!sd->state && !sd->top_level_parent_items)
|
2011-09-05 13:31:51 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->state = eina_inlist_sorted_state_new();
|
|
|
|
eina_inlist_sorted_state_init(sd->state, sd->items);
|
|
|
|
sd->requeued = EINA_FALSE;
|
2011-09-05 13:31:51 -07:00
|
|
|
}
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->type == ELM_GENLIST_ITEM_GROUP)
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->group_items = eina_list_append(sd->group_items, it);
|
2011-07-28 09:43:15 -07:00
|
|
|
|
2017-02-21 20:53:03 -08:00
|
|
|
if (!sd->top_level_parent_items)
|
2011-07-28 09:43:15 -07:00
|
|
|
{
|
2017-02-21 04:48:11 -08:00
|
|
|
sd->items = eina_inlist_sorted_state_insert
|
|
|
|
(sd->items, EINA_INLIST_GET(it), _elm_genlist_item_compare,
|
|
|
|
sd->state);
|
|
|
|
|
|
|
|
if (EINA_INLIST_GET(it)->next)
|
|
|
|
{
|
2017-10-24 00:53:18 -07:00
|
|
|
rel = ELM_GEN_ITEM_NEXT(it);
|
2017-02-21 04:48:11 -08:00
|
|
|
it->item->before = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (EINA_INLIST_GET(it)->prev)
|
|
|
|
{
|
2017-10-24 00:53:18 -07:00
|
|
|
rel = ELM_GEN_ITEM_PREV(it);
|
2017-02-21 04:48:11 -08:00
|
|
|
it->item->before = EINA_FALSE;
|
|
|
|
}
|
2011-07-28 09:43:15 -07:00
|
|
|
}
|
2017-02-21 04:48:11 -08:00
|
|
|
else
|
2011-07-28 09:43:15 -07:00
|
|
|
{
|
2017-02-21 04:48:11 -08:00
|
|
|
// Inlist is not sorted!
|
|
|
|
Elm_Gen_Item *prev_rel = NULL;
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, rel)
|
|
|
|
{
|
|
|
|
cmp = comp(EO_OBJ(it), EO_OBJ(rel));
|
|
|
|
if (cmp < 0) break;
|
|
|
|
prev_rel = rel;
|
2017-02-21 20:53:03 -08:00
|
|
|
if (rel->item->items)
|
2017-02-21 04:48:11 -08:00
|
|
|
{
|
2017-02-21 20:53:03 -08:00
|
|
|
Eina_List *ll = _list_last_recursive(rel->item->items);
|
|
|
|
if (ll)
|
|
|
|
{
|
|
|
|
eo_rel = ll->data;
|
|
|
|
rel = efl_data_scope_get(eo_rel, ELM_GENLIST_ITEM_CLASS);
|
|
|
|
}
|
2017-02-21 04:48:11 -08:00
|
|
|
}
|
|
|
|
if (!EINA_INLIST_GET(rel)->next)
|
|
|
|
{
|
|
|
|
cmp = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rel)
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_prepend_relative(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(prev_rel));
|
|
|
|
it->item->before = EINA_TRUE;
|
|
|
|
rel = prev_rel;
|
|
|
|
}
|
|
|
|
else if (cmp >= 0)
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
|
|
|
|
it->item->before = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_prepend_relative(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
|
|
|
|
it->item->before = EINA_TRUE;
|
|
|
|
}
|
2011-07-28 09:43:15 -07:00
|
|
|
}
|
2011-05-25 07:58:39 -07:00
|
|
|
}
|
2011-07-28 09:43:15 -07:00
|
|
|
|
|
|
|
if (rel)
|
2011-05-25 07:58:39 -07:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
it->item->rel = rel;
|
2013-03-29 06:23:38 -07:00
|
|
|
rel->item->rel_revs = eina_list_append(rel->item->rel_revs, it);
|
2011-05-25 07:58:39 -07:00
|
|
|
}
|
2011-07-28 09:43:15 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_queue(sd, it, _elm_genlist_item_list_compare);
|
2011-05-25 07:58:39 -07:00
|
|
|
|
2014-11-21 23:09:11 -08:00
|
|
|
return eo_it;
|
2011-12-02 05:43:02 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_clear(Eo *obj, Elm_Genlist_Data *sd EINA_UNUSED)
|
2009-02-10 03:57:47 -08:00
|
|
|
{
|
2015-01-08 06:03:52 -08:00
|
|
|
_internal_elm_genlist_clear(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_multi_select_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool multi)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->multi = !!multi;
|
2015-01-06 21:10:18 -08:00
|
|
|
|
|
|
|
if (!sd->multi && sd->selected)
|
|
|
|
{
|
|
|
|
Eina_List *l, *ll;
|
2015-01-07 18:13:02 -08:00
|
|
|
Elm_Object_Item *eo_it;
|
|
|
|
Elm_Object_Item *last = sd->selected->data;
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, ll, eo_it)
|
2015-01-06 21:10:18 -08:00
|
|
|
{
|
2015-01-07 18:13:02 -08:00
|
|
|
if (last != eo_it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
|
|
|
_item_unselect(it);
|
|
|
|
}
|
2015-01-06 21:10:18 -08:00
|
|
|
}
|
|
|
|
}
|
2009-02-10 03:57:47 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_multi_select_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2013-11-03 06:58:57 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->multi;
|
2013-11-03 08:15:58 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_multi_select_mode_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Elm_Object_Multi_Select_Mode mode)
|
2013-11-03 08:15:58 -08:00
|
|
|
{
|
|
|
|
if (mode >= ELM_OBJECT_MULTI_SELECT_MODE_MAX)
|
|
|
|
return;
|
2013-11-03 06:58:57 -08:00
|
|
|
|
2013-11-03 08:15:58 -08:00
|
|
|
if (sd->multi_select_mode != mode)
|
|
|
|
sd->multi_select_mode = mode;
|
2013-11-03 06:58:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Multi_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_multi_select_mode_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2009-02-10 03:57:47 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->multi_select_mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_selected_item_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
if (sd->selected)
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->selected->data;
|
2012-11-25 22:32:53 -08:00
|
|
|
else
|
2014-04-01 03:55:08 -07:00
|
|
|
return NULL;
|
2009-02-10 03:57:47 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static const Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_selected_items_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->selected;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_realized_items_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2010-01-24 21:54:31 -08:00
|
|
|
{
|
|
|
|
Item_Block *itb;
|
2010-06-05 06:12:45 -07:00
|
|
|
Eina_Bool done = EINA_FALSE;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
Eina_List *ret = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
|
|
|
if (itb->realized)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2011-03-22 00:54:24 -07:00
|
|
|
|
2012-02-27 21:26:49 -08:00
|
|
|
done = EINA_TRUE;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
if (it->realized) ret = eina_list_append(ret, EO_OBJ(it));
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (done) break;
|
|
|
|
}
|
|
|
|
}
|
2010-01-24 21:54:31 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_genlist_at_xy_item_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Evas_Coord x, Evas_Coord y, int *posret)
|
2009-09-22 20:22:07 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ox, oy, ow, oh;
|
|
|
|
Evas_Coord lasty;
|
2012-07-16 14:56:30 -07:00
|
|
|
Item_Block *itb;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
2009-09-22 20:22:07 -07:00
|
|
|
lasty = oy;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2011-03-22 00:54:24 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->sd->pan_x,
|
|
|
|
oy + itb->y - itb->sd->pan_y,
|
2011-03-22 00:54:24 -07:00
|
|
|
itb->w, itb->h, x, y, 1, 1))
|
|
|
|
continue;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
|
|
|
Evas_Coord itx, ity;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
itx = ox + itb->x + it->x - itb->sd->pan_x;
|
|
|
|
ity = oy + itb->y + it->y - itb->sd->pan_y;
|
|
|
|
if (ELM_RECTS_INTERSECT
|
|
|
|
(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
|
2011-03-22 00:54:24 -07:00
|
|
|
{
|
|
|
|
if (posret)
|
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (y <= (ity + (it->item->h / 4))) *posret = -1;
|
|
|
|
else if (y >= (ity + it->item->h - (it->item->h / 4)))
|
2011-03-22 00:54:24 -07:00
|
|
|
*posret = 1;
|
|
|
|
else *posret = 0;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
lasty = ity + it->item->h;
|
2011-03-22 00:54:24 -07:00
|
|
|
}
|
|
|
|
}
|
2009-09-22 20:22:07 -07:00
|
|
|
if (posret)
|
|
|
|
{
|
|
|
|
if (y > lasty) *posret = 1;
|
|
|
|
else *posret = -1;
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
return NULL;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_first_item_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2009-02-10 03:57:47 -08:00
|
|
|
{
|
2018-04-28 01:21:57 -07:00
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
2015-11-09 16:03:05 -08:00
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
while (it && sd->filter && !_item_filtered_get(it))
|
|
|
|
it = ELM_GEN_ITEM_NEXT(it);
|
|
|
|
|
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_last_item_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2009-02-16 23:50:35 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
if (!sd->items) return NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
while (it && sd->filter && !_item_filtered_get(it))
|
|
|
|
it = ELM_GEN_ITEM_PREV(it);
|
|
|
|
|
|
|
|
return EO_OBJ(it);
|
2009-02-16 23:50:35 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_next_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
2015-11-09 16:03:05 -08:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
do it = ELM_GEN_ITEM_NEXT(it);
|
|
|
|
while (it && sd->filter && !_item_filtered_get(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
return EO_OBJ(it);
|
2009-02-16 23:50:35 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_prev_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
2015-11-09 16:03:05 -08:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
do it = ELM_GEN_ITEM_PREV(it);
|
|
|
|
while (it && sd->filter && !_item_filtered_get(it));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
return EO_OBJ(it);
|
2009-02-10 03:57:47 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_parent_item_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2009-03-12 22:50:38 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it->parent);
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static unsigned int
|
|
|
|
_elm_genlist_item_subitems_count(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *item)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(item, 0);
|
2014-02-07 22:14:36 -08:00
|
|
|
|
|
|
|
return eina_list_count(item->item->items);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static const Eina_List *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_subitems_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *item)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(item, NULL);
|
2014-02-08 13:02:27 -08:00
|
|
|
|
|
|
|
return item->item->items;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_subitems_clear(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
if (!sd->tree_effect_enabled || !sd->move_effect_mode)
|
|
|
|
_item_sub_items_clear(it);
|
2012-03-07 04:15:36 -08:00
|
|
|
else
|
|
|
|
{
|
2016-01-28 17:07:34 -08:00
|
|
|
if (!_elm_genlist_tree_effect_setup(sd))
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_sub_items_clear(it);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
Eina_Bool selected)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it))) return;
|
2015-01-06 03:17:03 -08:00
|
|
|
|
2011-11-30 09:13:57 -08:00
|
|
|
selected = !!selected;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->selected == selected) return;
|
2011-11-30 09:13:57 -08:00
|
|
|
|
2015-01-06 03:17:03 -08:00
|
|
|
if (selected) _item_select(it);
|
|
|
|
else _item_unselect(it);
|
2009-02-10 03:57:47 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_selected_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
2009-02-17 20:51:22 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
return it->selected;
|
2009-02-17 20:51:22 -08:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
static Elm_Gen_Item *
|
2012-03-07 04:15:36 -08:00
|
|
|
_elm_genlist_expanded_next_item_get(Elm_Gen_Item *it)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
|
|
|
Elm_Object_Item *eo_it2;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-03-07 04:15:36 -08:00
|
|
|
if (it->item->expanded)
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = elm_genlist_item_next_get(eo_it);
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
|
|
|
return it2;
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = elm_genlist_item_next_get(eo_it);
|
|
|
|
while (eo_it2)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
|
|
|
if (it->item->expanded_depth >= it2->item->expanded_depth) return it2;
|
|
|
|
eo_it2 = elm_genlist_item_next_get(eo_it2);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
}
|
2016-08-15 06:44:41 -07:00
|
|
|
return efl_data_scope_get(eo_it2, ELM_GENLIST_ITEM_CLASS);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-02-21 20:53:03 -08:00
|
|
|
_elm_genlist_move_items_set(Elm_Gen_Item *it, Eina_Bool expanded)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-04-20 07:31:51 -07:00
|
|
|
Eina_List *l, *ll;
|
2012-03-07 04:15:36 -08:00
|
|
|
Elm_Gen_Item *it2 = NULL;
|
|
|
|
Evas_Coord ox, oy, ow, oh, dh = 0;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->expanded_next_item =
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_expanded_next_item_get(it);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2017-02-21 20:53:03 -08:00
|
|
|
if (expanded)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
|
|
|
l = elm_genlist_realized_items_get((sd)->obj);
|
|
|
|
EINA_LIST_FREE(l, eo_item)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_item, item);
|
|
|
|
sd->move_items = eina_list_append(sd->move_items, item);
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->move_items, l, ll, it2)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
if (it2 == sd->expanded_next_item) break;
|
|
|
|
sd->move_items = eina_list_remove(sd->move_items, it2);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it2 = NULL;
|
2013-05-02 11:13:36 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
2014-09-27 22:15:28 -07:00
|
|
|
if (sd->expanded_next_item) eo_it2 = EO_OBJ(sd->expanded_next_item);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
while (eo_it2 && (dh < oy + oh))
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
it2 = efl_data_scope_get(eo_it2, ELM_GENLIST_ITEM_CLASS);
|
2012-03-07 04:15:36 -08:00
|
|
|
dh += it2->item->h;
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->move_items = eina_list_append(sd->move_items, it2);
|
2014-09-27 22:15:28 -07:00
|
|
|
eo_it2 = elm_genlist_item_next_get(eo_it2);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-08 11:46:24 -08:00
|
|
|
static void
|
|
|
|
_event_block_rect_update(const Evas_Object *obj)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ox, oy, ow, oh;
|
|
|
|
|
2014-03-08 11:46:24 -08:00
|
|
|
ELM_GENLIST_CHECK(obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
2014-03-08 11:46:24 -08:00
|
|
|
if (!sd->event_block_rect)
|
|
|
|
{
|
|
|
|
sd->event_block_rect = evas_object_rectangle_add(
|
|
|
|
evas_object_evas_get(sd->obj));
|
2014-04-08 13:23:07 -07:00
|
|
|
evas_object_smart_member_add(sd->event_block_rect, sd->pan_obj);
|
2014-03-08 11:46:24 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-03-08 11:46:24 -08:00
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
|
|
|
evas_object_color_set(sd->event_block_rect, 0, 0, 0, 0);
|
|
|
|
evas_object_resize(sd->event_block_rect, ow, oh);
|
|
|
|
evas_object_move(sd->event_block_rect, ox, oy);
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2017-02-21 20:53:03 -08:00
|
|
|
static void
|
|
|
|
_item_expanded_set_noevent(Elm_Gen_Item *it, Eina_Bool expanded)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(it);
|
|
|
|
|
|
|
|
if (it->item->expanded == expanded) return;
|
|
|
|
it->item->expanded = expanded;
|
|
|
|
if (expanded)
|
|
|
|
{
|
|
|
|
if (it->realized)
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_EXPANDED, "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->realized)
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_CONTRACTED, "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_expanded_set(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, Eina_Bool expanded)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2012-02-27 21:26:49 -08:00
|
|
|
expanded = !!expanded;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->expanded == expanded) return;
|
|
|
|
if (it->item->type != ELM_GENLIST_ITEM_TREE) return;
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->expanded_item = it;
|
2017-02-21 20:53:03 -08:00
|
|
|
_elm_genlist_move_items_set(it, expanded);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-03-08 11:46:24 -08:00
|
|
|
if (sd->tree_effect_enabled)
|
|
|
|
_event_block_rect_update(WIDGET(it));
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2017-02-21 20:53:03 -08:00
|
|
|
if (expanded)
|
2009-03-12 22:50:38 -07:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_EXPAND;
|
2017-02-21 20:53:03 -08:00
|
|
|
_item_expanded_set_noevent(it, EINA_TRUE);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_EXPANDED, EO_OBJ(it));
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->auto_scroll_enabled = EINA_TRUE;
|
2015-07-01 01:42:45 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(eo_item, EFL_ACCESS_STATE_EXPANDED, EINA_TRUE);
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_CONTRACT;
|
2017-02-21 20:53:03 -08:00
|
|
|
_item_expanded_set_noevent(it, EINA_FALSE);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENLIST_EVENT_CONTRACTED, EO_OBJ(it));
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->auto_scroll_enabled = EINA_FALSE;
|
2015-07-01 01:42:45 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(eo_item, EFL_ACCESS_STATE_EXPANDED, EINA_FALSE);
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
2009-02-10 03:57:47 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_expanded_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
2009-02-17 20:51:22 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
return it->item->expanded;
|
2009-02-17 20:51:22 -08:00
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_expanded_depth_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
2010-10-06 23:45:36 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, 0);
|
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
return it->item->expanded_depth;
|
2010-10-06 23:45:36 -07:00
|
|
|
}
|
|
|
|
|
2012-03-08 02:58:29 -08:00
|
|
|
static Eina_Bool
|
2014-09-27 22:15:28 -07:00
|
|
|
_elm_genlist_item_coordinates_calc(Elm_Gen_Item *it,
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Genlist_Item_Scrollto_Type type,
|
|
|
|
Eina_Bool bring_in,
|
|
|
|
Evas_Coord *x,
|
|
|
|
Evas_Coord *y,
|
|
|
|
Evas_Coord *w,
|
|
|
|
Evas_Coord *h)
|
|
|
|
{
|
2011-01-05 21:13:11 -08:00
|
|
|
Evas_Coord gith = 0;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-12-06 21:17:33 -08:00
|
|
|
Eina_Bool deferred_show = EINA_FALSE;
|
|
|
|
|
2017-03-01 22:36:00 -08:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_IN:
|
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_TOP:
|
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
|
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_BOTTOM:
|
|
|
|
break;
|
|
|
|
default: /* Filters unsupported type */
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2016-12-06 21:17:33 -08:00
|
|
|
//Can't goto the item right now. Reserve it instead.
|
|
|
|
if (sd->queue || !(sd->homogeneous && (sd->mode == ELM_LIST_COMPRESS)))
|
2012-05-23 21:44:44 -07:00
|
|
|
{
|
2013-11-27 23:36:55 -08:00
|
|
|
if ((it->item->queued) || (!it->item->mincalcd) || (sd->queue))
|
2016-12-06 21:17:33 -08:00
|
|
|
deferred_show = EINA_TRUE;
|
2009-02-17 06:39:08 -08:00
|
|
|
}
|
2016-12-06 21:17:33 -08:00
|
|
|
else if (it->item->block->w < 1) deferred_show = EINA_TRUE;
|
|
|
|
|
|
|
|
if (deferred_show)
|
2016-06-23 10:09:13 -07:00
|
|
|
{
|
|
|
|
sd->check_scroll = EINA_TRUE;
|
|
|
|
sd->show_item = it;
|
|
|
|
sd->bring_in = bring_in;
|
|
|
|
sd->scroll_to_type = type;
|
|
|
|
it->item->show_me = EINA_TRUE;
|
|
|
|
|
|
|
|
ecore_job_del(sd->calc_job);
|
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2016-12-06 21:17:33 -08:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->show_item)
|
2009-02-17 06:39:08 -08:00
|
|
|
{
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->show_item->item->show_me = EINA_FALSE;
|
|
|
|
sd->show_item = NULL;
|
2009-02-17 06:39:08 -08:00
|
|
|
}
|
2012-03-07 00:29:32 -08:00
|
|
|
|
2013-05-02 11:13:36 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, w, h);
|
2012-03-22 02:34:57 -07:00
|
|
|
switch (type)
|
2012-03-07 00:29:32 -08:00
|
|
|
{
|
2012-03-19 20:19:13 -07:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_IN:
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((it->item->group_item) &&
|
2013-05-02 11:13:36 -07:00
|
|
|
(sd->pan_y > (it->y + it->item->block->y)))
|
2012-07-16 14:56:30 -07:00
|
|
|
gith = it->item->group_item->item->h;
|
|
|
|
*h = it->item->h;
|
|
|
|
*y = it->y + it->item->block->y - gith;
|
|
|
|
break;
|
|
|
|
|
2012-03-19 20:19:13 -07:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_TOP:
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->group_item) gith = it->item->group_item->item->h;
|
|
|
|
*y = it->y + it->item->block->y - gith;
|
|
|
|
break;
|
|
|
|
|
2012-03-19 20:19:13 -07:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
|
2012-07-16 14:56:30 -07:00
|
|
|
*y = it->y + it->item->block->y - (*h / 2) + (it->item->h / 2);
|
|
|
|
break;
|
|
|
|
|
2016-01-04 14:05:29 -08:00
|
|
|
case ELM_GENLIST_ITEM_SCROLLTO_BOTTOM:
|
|
|
|
*y = it->y + it->item->block->y - *h + it->item->h;
|
|
|
|
break;
|
|
|
|
|
2012-03-19 20:19:13 -07:00
|
|
|
default:
|
2012-07-16 14:56:30 -07:00
|
|
|
return EINA_FALSE;
|
2012-03-07 00:29:32 -08:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
*x = it->x + it->item->block->x;
|
|
|
|
*w = it->item->block->w;
|
|
|
|
|
2012-03-07 00:29:32 -08:00
|
|
|
return EINA_TRUE;
|
2009-02-10 03:57:47 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_promote(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_first_item = elm_genlist_first_item_get(WIDGET(it));
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_first_item, first_item);
|
|
|
|
_item_move_before(it, first_item);
|
2011-11-25 12:27:27 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_demote(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
Elm_Object_Item *eo_last_item = elm_genlist_last_item_get(WIDGET(it));
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_last_item, last_item);
|
|
|
|
_item_move_after(it, last_item);
|
2011-11-25 12:27:27 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_show(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *item, Elm_Genlist_Item_Scrollto_Type type)
|
2009-09-10 02:25:11 -07:00
|
|
|
{
|
2012-03-07 00:29:28 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(item);
|
|
|
|
|
|
|
|
if (_elm_genlist_item_coordinates_calc
|
|
|
|
(item, type, EINA_FALSE, &x, &y, &w, &h))
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show
|
|
|
|
(WIDGET(item), x, y, w, h);
|
2009-09-10 02:25:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_bring_in(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *item, Elm_Genlist_Item_Scrollto_Type type)
|
2009-09-10 02:25:11 -07:00
|
|
|
{
|
2012-03-07 00:29:32 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
2009-09-26 11:24:06 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(item);
|
|
|
|
|
|
|
|
if (_elm_genlist_item_coordinates_calc
|
|
|
|
(item, type, EINA_TRUE, &x, &y, &w, &h))
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_region_bring_in(WIDGET(item), x, y, w, h);
|
2009-09-10 02:25:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, Eina_List **l)
|
2011-10-23 19:10:35 -07:00
|
|
|
{
|
|
|
|
Evas_Object *content;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2015-01-02 02:04:34 -08:00
|
|
|
EINA_LIST_FREE(it->contents, content)
|
2010-11-06 00:05:00 -07:00
|
|
|
{
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(WIDGET(it), content);
|
2015-01-05 22:46:35 -08:00
|
|
|
edje_object_part_unswallow(VIEW(it), content);
|
2011-10-23 19:10:35 -07:00
|
|
|
evas_object_hide(content);
|
2012-03-22 02:34:57 -07:00
|
|
|
if (l) *l = eina_list_append(*l, content);
|
2010-11-06 00:05:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-04 10:14:19 -08:00
|
|
|
static void
|
|
|
|
_mark_item_update(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
it->item->mincalcd = EINA_FALSE;
|
|
|
|
it->item->updateme = EINA_TRUE;
|
|
|
|
it->item->block->updateme = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (!it->item->block) return;
|
2016-02-04 10:14:19 -08:00
|
|
|
_mark_item_update(it);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->update_job);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->update_job = ecore_job_add(_update_job, sd->obj);
|
2009-03-12 22:50:38 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_fields_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
const char *parts,
|
|
|
|
Elm_Genlist_Item_Field_Type itf)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-01-19 21:18:31 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->item->block) return;
|
2011-11-29 06:03:14 -08:00
|
|
|
|
2012-02-28 22:52:05 -08:00
|
|
|
if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_TEXT))
|
2012-06-18 02:54:00 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
_item_text_realize(it, VIEW(it), &it->texts, parts);
|
2012-06-18 02:54:00 -07:00
|
|
|
}
|
2011-11-29 06:03:14 -08:00
|
|
|
if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT))
|
|
|
|
{
|
2018-08-02 06:42:06 -07:00
|
|
|
_item_content_realize(it, VIEW(it), &it->contents, "contents", parts, EINA_FALSE);
|
2015-01-01 23:17:16 -08:00
|
|
|
if (it->flipped)
|
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
_item_content_realize(it, VIEW(it), &it->item->flip_contents,
|
2018-08-02 06:42:06 -07:00
|
|
|
"flips", parts, EINA_FALSE);
|
2015-01-01 23:17:16 -08:00
|
|
|
}
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->deco_it_view)
|
2015-01-01 23:17:16 -08:00
|
|
|
{
|
2017-02-22 22:52:31 -08:00
|
|
|
_item_content_realize(it, it->item->deco_it_view,
|
|
|
|
&it->item->deco_it_contents,
|
2018-08-02 06:42:06 -07:00
|
|
|
"contents", parts, EINA_FALSE);
|
2015-01-01 23:17:16 -08:00
|
|
|
}
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->decorate_all_mode)
|
2015-01-01 23:17:16 -08:00
|
|
|
{
|
2015-01-02 02:59:39 -08:00
|
|
|
_item_content_realize(it, it->deco_all_view,
|
2017-02-22 22:52:31 -08:00
|
|
|
&it->item->deco_all_contents,
|
2018-08-02 06:42:06 -07:00
|
|
|
"contents", parts, EINA_FALSE);
|
2015-01-01 23:17:16 -08:00
|
|
|
}
|
2016-04-28 00:00:00 -07:00
|
|
|
if (it->has_contents != (!!it->contents))
|
|
|
|
it->item->mincalcd = EINA_FALSE;
|
2015-01-02 02:04:34 -08:00
|
|
|
it->has_contents = !!it->contents;
|
2013-02-20 02:00:49 -08:00
|
|
|
if (it->item->type == ELM_GENLIST_ITEM_NONE)
|
|
|
|
{
|
|
|
|
Evas_Object* eobj;
|
|
|
|
Eina_List* l;
|
2014-01-21 17:47:33 -08:00
|
|
|
it->item_focus_chain = eina_list_free(it->item_focus_chain);
|
2015-01-02 02:04:34 -08:00
|
|
|
EINA_LIST_FOREACH(it->contents, l, eobj)
|
2014-04-23 01:00:50 -07:00
|
|
|
if (elm_widget_is(eobj) && elm_object_focus_allow_get(eobj))
|
2013-02-20 02:00:49 -08:00
|
|
|
it->item_focus_chain = eina_list_append(it->item_focus_chain, eobj);
|
|
|
|
}
|
2011-11-29 06:03:14 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2011-11-29 06:03:14 -08:00
|
|
|
if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
|
2015-01-02 00:34:05 -08:00
|
|
|
_item_state_realize(it, VIEW(it), parts);
|
|
|
|
|
2013-12-16 10:34:59 -08:00
|
|
|
if (!it->item->mincalcd)
|
2016-04-28 00:00:00 -07:00
|
|
|
elm_genlist_item_update(eo_item);
|
2011-11-29 06:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_item_class_update(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const Elm_Genlist_Item_Class *itc)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(itc);
|
2016-04-01 00:40:16 -07:00
|
|
|
|
|
|
|
/* Decrease the orignal item class refcount to prevent memory leak */
|
|
|
|
if (it->itc != itc)
|
|
|
|
{
|
|
|
|
elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc);
|
|
|
|
it->itc = itc;
|
|
|
|
elm_genlist_item_class_ref((Elm_Genlist_Item_Class *)it->itc);
|
|
|
|
}
|
|
|
|
|
2015-01-05 05:17:12 -08:00
|
|
|
if (!it->item->block) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->nocache_once = EINA_TRUE;
|
2012-04-06 00:10:29 -07:00
|
|
|
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(it->texts, elm_widget_stringlist_free);
|
2017-02-22 22:52:31 -08:00
|
|
|
ELM_SAFE_FREE(it->item->deco_it_texts, elm_widget_stringlist_free);
|
|
|
|
ELM_SAFE_FREE(it->item->deco_all_texts, elm_widget_stringlist_free);
|
2012-04-06 00:10:29 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
elm_genlist_item_update(eo_it);
|
2010-11-17 09:15:28 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static const Elm_Genlist_Item_Class *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_item_class_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return it->itc;
|
2011-06-25 16:20:22 -07:00
|
|
|
}
|
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
static Evas_Object *
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_label_create(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *tooltip,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *it EINA_UNUSED)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *label = elm_label_add(tooltip);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
if (!label)
|
|
|
|
return NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
elm_object_style_set(label, "tooltip");
|
2011-06-28 23:41:31 -07:00
|
|
|
elm_object_text_set(label, data);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_label_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(data);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
EAPI void
|
2012-01-19 21:18:31 -08:00
|
|
|
elm_genlist_item_tooltip_text_set(Elm_Object_Item *it,
|
2012-07-16 14:56:30 -07:00
|
|
|
const char *text)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_text_set(it, text);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_text_set(Eo *eo_it, Elm_Gen_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-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
text = eina_stringshare_add(text);
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_tooltip_content_cb_set
|
2014-08-19 00:52:24 -07:00
|
|
|
(eo_it, _elm_genlist_item_label_create, text,
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_label_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
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *item,
|
2010-12-07 11:18:14 -08:00
|
|
|
Elm_Tooltip_Item_Content_Cb func,
|
2012-07-16 14:56:30 -07:00
|
|
|
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
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set(item, func, data, del_cb);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_content_cb_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
Elm_Tooltip_Item_Content_Cb func,
|
|
|
|
const void *data,
|
|
|
|
Evas_Smart_Cb del_cb)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_GOTO(it, error);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
if ((it->tooltip.content_cb != func) || (it->tooltip.data != data))
|
|
|
|
{
|
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
it->tooltip.content_cb = func;
|
|
|
|
it->tooltip.data = data;
|
|
|
|
it->tooltip.del_cb = del_cb;
|
|
|
|
}
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (VIEW(it))
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set
|
2016-08-15 06:44:41 -07:00
|
|
|
(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS), it->tooltip.content_cb, it->tooltip.data, NULL);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_style_set(eo_it, it->tooltip.style);
|
|
|
|
elm_wdg_item_tooltip_window_mode_set(eo_it, it->tooltip.free_size);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
2010-12-07 11:18:14 -08:00
|
|
|
error:
|
2010-09-27 11:18:37 -07:00
|
|
|
if (del_cb) del_cb((void *)data, NULL, NULL);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_tooltip_unset(Elm_Object_Item *item)
|
2012-01-19 21:18:31 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_unset(item);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-01-19 21:18:31 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_unset(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-01-19 21:18:31 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((VIEW(it)) && (it->tooltip.content_cb))
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_wdg_item_tooltip_unset(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS));
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
|
|
|
it->tooltip.del_cb = NULL;
|
|
|
|
it->tooltip.content_cb = NULL;
|
|
|
|
it->tooltip.data = NULL;
|
|
|
|
it->tooltip.free_size = EINA_FALSE;
|
|
|
|
if (it->tooltip.style)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_style_set(eo_it, NULL);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_tooltip_style_set(Elm_Object_Item *item,
|
|
|
|
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
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_style_set(item, style);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_style_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const char *style)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-01-19 21:18:31 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
eina_stringshare_replace(&it->tooltip.style, style);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (VIEW(it)) elm_wdg_item_tooltip_style_set(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS), 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
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2012-01-19 21:18:31 -08:00
|
|
|
elm_genlist_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
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_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
|
|
|
}
|
|
|
|
|
2015-05-14 06:21:05 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_style_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2015-05-14 06:21:05 -07:00
|
|
|
{
|
|
|
|
return it->tooltip.style;
|
|
|
|
}
|
|
|
|
|
2011-07-26 02:38:23 -07:00
|
|
|
EAPI Eina_Bool
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_tooltip_window_mode_set(Elm_Object_Item *item,
|
|
|
|
Eina_Bool disable)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_tooltip_window_mode_set(item, disable);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_window_mode_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
Eina_Bool disable)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
it->tooltip.free_size = disable;
|
2014-09-27 22:15:28 -07:00
|
|
|
if (VIEW(it))
|
2015-02-23 09:12:35 -08:00
|
|
|
{
|
|
|
|
Eina_Bool ret;
|
2016-08-15 06:44:41 -07:00
|
|
|
ret = elm_wdg_item_tooltip_window_mode_set(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS), disable);
|
2015-02-23 09:12:35 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2012-01-19 21:18:31 -08:00
|
|
|
|
2011-07-27 19:22:37 -07:00
|
|
|
return EINA_TRUE;
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_tooltip_window_mode_get(const Elm_Object_Item *eo_it)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_tooltip_window_mode_get(eo_it);
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
2015-05-20 18:22:23 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_elm_widget_item_tooltip_window_mode_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2015-05-20 18:22:23 -07:00
|
|
|
{
|
|
|
|
return it->tooltip.free_size;
|
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_cursor_set(Elm_Object_Item *item,
|
|
|
|
const char *cursor)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_set(item, cursor);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_cursor_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const char *cursor)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
eina_stringshare_replace(&it->mouse_cursor, cursor);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (VIEW(it)) elm_wdg_item_cursor_set(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS), cursor);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2010-11-04 17:46:54 -07:00
|
|
|
EAPI const char *
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_cursor_get(const Elm_Object_Item *eo_it)
|
2010-11-04 17:46:54 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_get(eo_it);
|
2010-11-04 17:46:54 -07:00
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_item_cursor_unset(Elm_Object_Item *item)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_unset(item);
|
2014-09-27 22:15:28 -07:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_elm_widget_item_cursor_unset(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-01-19 21:18:31 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!it->mouse_cursor) return;
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
if (VIEW(it)) elm_wdg_item_cursor_unset(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS));
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2013-09-05 21:00:42 -07:00
|
|
|
ELM_SAFE_FREE(it->mouse_cursor, eina_stringshare_del);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2010-09-25 15:01:19 -07:00
|
|
|
EAPI void
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_cursor_style_set(Elm_Object_Item *eo_it,
|
2012-07-16 14:56:30 -07:00
|
|
|
const char *style)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_style_set(eo_it, style);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_cursor_style_get(const Elm_Object_Item *eo_it)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_style_get(eo_it);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
2010-09-25 15:03:37 -07:00
|
|
|
EAPI void
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *eo_it,
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool engine_only)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_engine_only_set(eo_it, engine_only);
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2014-09-27 22:15:28 -07:00
|
|
|
elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *eo_it)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_engine_only_get(eo_it);
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_index_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
2016-03-10 22:29:03 -08:00
|
|
|
int cnt = 1;
|
2015-01-05 03:43:58 -08:00
|
|
|
Elm_Gen_Item *tmp;
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, -1);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
EINA_INLIST_FOREACH(it->item->wsd->items, tmp)
|
2015-01-05 03:43:58 -08:00
|
|
|
{
|
|
|
|
if (tmp == it) break;
|
|
|
|
cnt++;
|
|
|
|
}
|
|
|
|
return cnt;
|
2011-12-26 06:30:21 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_mode_set(Eo *obj, Elm_Genlist_Data *sd, Elm_List_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->mode == mode) return;
|
|
|
|
sd->mode = mode;
|
2015-03-03 02:58:40 -08:00
|
|
|
|
|
|
|
if (sd->mode == ELM_LIST_LIMIT)
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_TRUE;
|
|
|
|
sd->scr_minh = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (sd->mode == ELM_LIST_EXPAND)
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_TRUE;
|
|
|
|
sd->scr_minh = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->scr_minw = EINA_FALSE;
|
|
|
|
sd->scr_minh = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
2011-08-04 18:21:56 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_List_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_mode_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->mode;
|
2010-04-06 07:01:04 -07:00
|
|
|
}
|
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_genlist_bounce_set(Evas_Object *obj,
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool h_bounce,
|
|
|
|
Eina_Bool v_bounce)
|
2009-12-11 00:12:58 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, h_bounce, v_bounce);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_elm_interface_scrollable_bounce_allow_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Bool h_bounce, Eina_Bool v_bounce)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->h_bounce = !!h_bounce;
|
|
|
|
sd->v_bounce = !!v_bounce;
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set
|
2016-08-15 06:44:41 -07:00
|
|
|
(efl_super(obj, MY_CLASS), sd->h_bounce, sd->v_bounce);
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
2010-01-23 01:07:20 -08:00
|
|
|
|
2010-04-06 07:01:04 -07:00
|
|
|
EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_genlist_bounce_get(const Evas_Object *obj,
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_Bool *h_bounce,
|
|
|
|
Eina_Bool *v_bounce)
|
2010-04-06 07:01:04 -07:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_get
|
|
|
|
(obj, h_bounce, v_bounce);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_elm_interface_scrollable_bounce_allow_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (h_bounce) *h_bounce = sd->h_bounce;
|
|
|
|
if (v_bounce) *v_bounce = sd->v_bounce;
|
2010-04-06 07:01:04 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_homogeneous_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool homogeneous)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->homogeneous = !!homogeneous;
|
2010-01-23 01:07:20 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_homogeneous_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2010-01-23 01:07:20 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->homogeneous;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_block_count_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, int count)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-29 21:57:29 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(count < 1);
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->max_items_per_block = count;
|
|
|
|
sd->item_cache_max = sd->max_items_per_block * 2;
|
2012-10-22 07:34:43 -07:00
|
|
|
_item_cache_clean(sd);
|
2010-01-23 01:07:20 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_block_count_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2010-07-27 16:36:27 -07:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->max_items_per_block;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2015-09-23 04:50:05 -07:00
|
|
|
static void
|
|
|
|
_filter_item_internal(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2016-04-26 14:34:14 -07:00
|
|
|
if (sd->filter_data)
|
2015-09-23 04:50:05 -07:00
|
|
|
{
|
2016-04-26 14:34:14 -07:00
|
|
|
if ((it->parent && !_item_filtered_get(it->parent)) ||
|
|
|
|
(it->itc->func.filter_get &&
|
|
|
|
!it->itc->func.filter_get(
|
|
|
|
(void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)),
|
|
|
|
WIDGET(it), sd->filter_data)))
|
2015-09-23 04:50:05 -07:00
|
|
|
{
|
|
|
|
it->hide = EINA_TRUE;
|
2017-11-17 00:15:21 -08:00
|
|
|
if (it->item->block)
|
|
|
|
it->item->block->changed = EINA_TRUE;
|
2015-09-23 04:50:05 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->filtered_count++;
|
|
|
|
}
|
|
|
|
it->filtered = EINA_TRUE;
|
|
|
|
sd->processed_count++;
|
|
|
|
}
|
|
|
|
|
2017-10-24 00:53:18 -07:00
|
|
|
// Returns true if the item is not filtered out, but remains visible.
|
2015-09-23 04:50:05 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_filtered_get(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
if (!it) return EINA_FALSE;
|
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
if (!it->filtered)
|
|
|
|
{
|
|
|
|
l = eina_list_data_find_list(sd->filter_queue, it);
|
|
|
|
if (l)
|
2016-07-28 19:21:27 -07:00
|
|
|
sd->filter_queue = eina_list_remove_list(sd->filter_queue, l);
|
2018-06-22 06:38:03 -07:00
|
|
|
if (it->item->queued)
|
|
|
|
l = eina_list_data_find_list(sd->queue, it);
|
|
|
|
else
|
|
|
|
l = NULL;
|
2015-09-23 04:50:05 -07:00
|
|
|
if (l)
|
|
|
|
{
|
|
|
|
sd->queue = eina_list_remove_list(sd->queue, l);
|
|
|
|
it->item->queued = EINA_FALSE;
|
|
|
|
_item_process(sd, it);
|
2017-02-21 22:34:34 -08:00
|
|
|
_item_process_post(sd, it);
|
2015-09-23 04:50:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
_filter_item_internal(it);
|
2017-11-17 00:15:21 -08:00
|
|
|
if (it->item->block)
|
|
|
|
it->item->block->changed = EINA_TRUE;
|
2015-09-23 04:50:05 -07:00
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
|
|
|
}
|
|
|
|
if (!it->hide) return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_filter_queue_process(Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
int n;
|
2016-07-28 19:57:10 -07:00
|
|
|
Elm_Gen_Item *it;
|
2015-09-23 04:50:05 -07:00
|
|
|
double t0;
|
|
|
|
|
2016-07-28 19:21:27 -07:00
|
|
|
t0 = ecore_time_get();
|
|
|
|
for (n = 0; ((sd->filter_queue) && (sd->processed_count < ITEM_QUEUE_MAX)); n++)
|
2015-09-23 04:50:05 -07:00
|
|
|
{
|
2016-07-28 19:57:10 -07:00
|
|
|
it = eina_list_data_get(sd->filter_queue);
|
2017-04-18 00:58:04 -07:00
|
|
|
if (!it) break;
|
2015-09-23 04:50:05 -07:00
|
|
|
//FIXME: This is added as a fail safe code for items not yet processed.
|
2017-04-18 00:58:04 -07:00
|
|
|
if (it->item->queued)
|
2015-09-23 04:50:05 -07:00
|
|
|
{
|
|
|
|
sd->filter_queue = eina_list_remove_list
|
|
|
|
(sd->filter_queue, sd->filter_queue);
|
|
|
|
sd->filter_queue = eina_list_append(sd->filter_queue, it);
|
|
|
|
it = eina_list_data_get(sd->filter_queue);
|
|
|
|
}
|
|
|
|
sd->filter_queue = eina_list_remove_list(sd->filter_queue, sd->filter_queue);
|
|
|
|
_filter_item_internal(it);
|
|
|
|
it->item->block->changed = EINA_TRUE;
|
2016-07-28 19:21:27 -07:00
|
|
|
if ((ecore_time_get() - t0) > (ecore_animator_frametime_get()))
|
2015-09-23 04:50:05 -07:00
|
|
|
{
|
|
|
|
//At least 1 item is filtered by this time, so return n+1 for first loop
|
|
|
|
n++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_filter_process(void *data,
|
|
|
|
Eina_Bool *wakeup)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Data *sd = data;
|
|
|
|
|
|
|
|
if (_filter_queue_process(sd) > 0) *wakeup = EINA_TRUE;
|
|
|
|
if (!sd->filter_queue) return ECORE_CALLBACK_CANCEL;
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_filter_enterer(void *data)
|
|
|
|
{
|
|
|
|
Eina_Bool wakeup = EINA_FALSE;
|
|
|
|
ELM_GENLIST_DATA_GET(data, sd);
|
|
|
|
Eina_Bool ok = _filter_process(sd, &wakeup);
|
|
|
|
if (wakeup)
|
|
|
|
{
|
|
|
|
// wake up mainloop
|
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
|
|
|
sd->calc_job = ecore_job_add(_calc_job, data);
|
|
|
|
}
|
|
|
|
if (ok == ECORE_CALLBACK_CANCEL)
|
|
|
|
{
|
2015-11-10 22:30:58 -08:00
|
|
|
sd->queue_filter_enterer = NULL;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(sd->obj, ELM_GENLIST_EVENT_FILTER_DONE, NULL);
|
2015-09-23 04:50:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN void
|
|
|
|
_elm_genlist_filter_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, void *filter_data)
|
|
|
|
{
|
|
|
|
Item_Block *itb;
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
if (sd->filter_queue)
|
|
|
|
ELM_SAFE_FREE(sd->queue_filter_enterer, ecore_idle_enterer_del);
|
|
|
|
ELM_SAFE_FREE(sd->filter_queue, eina_list_free);
|
|
|
|
ELM_SAFE_FREE(sd->filtered_list, eina_list_free);
|
|
|
|
sd->filtered_count = 0;
|
|
|
|
sd->processed_count = 0;
|
|
|
|
sd->filter = EINA_TRUE;
|
|
|
|
sd->filter_data = filter_data;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->blocks, itb)
|
|
|
|
{
|
|
|
|
if (itb->realized)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
|
|
|
{
|
|
|
|
it->filtered = EINA_FALSE;
|
|
|
|
it->hide = EINA_FALSE;
|
|
|
|
if (it->realized)
|
|
|
|
_filter_item_internal(it);
|
|
|
|
else
|
|
|
|
sd->filter_queue = eina_list_append(sd->filter_queue, it);
|
|
|
|
}
|
|
|
|
itb->changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(itb->items, l, it)
|
|
|
|
{
|
|
|
|
it->filtered = EINA_FALSE;
|
|
|
|
it->hide = EINA_FALSE;
|
|
|
|
sd->filter_queue = eina_list_append(sd->filter_queue, it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_calc_job(sd->obj);
|
|
|
|
|
|
|
|
sd->queue_filter_enterer = ecore_idle_enterer_add(_item_filter_enterer,
|
|
|
|
sd->obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_filter_iterator_next(Elm_Genlist_Filter *iter, void **data)
|
|
|
|
{
|
|
|
|
if (!iter->current) return EINA_FALSE;
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
while (iter->current)
|
|
|
|
{
|
2015-09-24 00:42:37 -07:00
|
|
|
item = ELM_GENLIST_FILTER_ITERATOR_ITEM_GET(iter->current, Elm_Gen_Item);
|
2015-09-23 04:50:05 -07:00
|
|
|
iter->current = iter->current->next;
|
|
|
|
if (_item_filtered_get(item))
|
|
|
|
{
|
|
|
|
if (data)
|
|
|
|
*data = EO_OBJ(item);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-09-24 00:42:37 -07:00
|
|
|
_filter_iterator_free(Elm_Genlist_Filter *iter)
|
2015-09-23 04:50:05 -07:00
|
|
|
{
|
2015-09-24 00:42:37 -07:00
|
|
|
free(iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_filter_iterator_get_container(Elm_Genlist_Filter *iter)
|
|
|
|
{
|
2015-11-10 22:30:58 -08:00
|
|
|
if (!iter) return NULL;
|
|
|
|
return iter->obj;
|
2015-09-23 04:50:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Iterator *
|
|
|
|
_elm_genlist_filter_iterator_new(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
Elm_Genlist_Filter *iter;
|
|
|
|
iter = calloc(1, sizeof (Elm_Genlist_Filter));
|
|
|
|
if (!iter) return NULL;
|
|
|
|
|
|
|
|
iter->head = sd->items;
|
|
|
|
iter->current = sd->items;
|
2015-11-10 22:30:58 -08:00
|
|
|
iter->obj = sd->obj;
|
2015-09-23 04:50:05 -07:00
|
|
|
|
|
|
|
iter->iterator.version = EINA_ITERATOR_VERSION;
|
|
|
|
iter->iterator.next = FUNC_ITERATOR_NEXT(_filter_iterator_next);
|
2015-09-24 00:42:37 -07:00
|
|
|
iter->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(
|
|
|
|
_filter_iterator_get_container);
|
2015-09-23 04:50:05 -07:00
|
|
|
iter->iterator.free = FUNC_ITERATOR_FREE(_filter_iterator_free);
|
|
|
|
|
|
|
|
EINA_MAGIC_SET(&iter->iterator, EINA_MAGIC_ITERATOR);
|
|
|
|
|
|
|
|
return &iter->iterator;
|
|
|
|
}
|
|
|
|
|
2016-03-04 15:41:02 -08:00
|
|
|
EOLIAN static unsigned int
|
|
|
|
_elm_genlist_filtered_items_count(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
|
|
|
{
|
|
|
|
return sd->filtered_count;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_longpress_timeout_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, double timeout)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->longpress_timeout = timeout;
|
2010-07-27 16:36:27 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static double
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_longpress_timeout_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->longpress_timeout;
|
2010-07-27 16:36:27 -07:00
|
|
|
}
|
2010-11-22 07:24:58 -08:00
|
|
|
|
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_scroller_policy_set(Evas_Object *obj,
|
2010-12-07 11:18:14 -08:00
|
|
|
Elm_Scroller_Policy policy_h,
|
|
|
|
Elm_Scroller_Policy policy_v)
|
2010-11-22 07:24:58 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ELM_GENLIST_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, policy_h, policy_v);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_elm_interface_scrollable_policy_set(Eo *obj, Elm_Genlist_Data *sd EINA_UNUSED, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2010-11-22 07:24:58 -08:00
|
|
|
if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
|
|
|
|
(policy_v >= ELM_SCROLLER_POLICY_LAST))
|
|
|
|
return;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_interface_scrollable_policy_set(efl_super(obj, MY_CLASS), policy_h, policy_v);
|
2010-11-22 07:24:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-16 14:56:30 -07:00
|
|
|
elm_genlist_scroller_policy_get(const Evas_Object *obj,
|
2010-12-07 11:18:14 -08:00
|
|
|
Elm_Scroller_Policy *policy_h,
|
|
|
|
Elm_Scroller_Policy *policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
ELM_GENLIST_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_get(obj, policy_h, policy_v);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_elm_interface_scrollable_policy_get(const Eo *obj, Elm_Genlist_Data *sd EINA_UNUSED, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
|
2010-11-22 07:24:58 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Scroller_Policy s_policy_h, s_policy_v;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_get
|
2016-08-15 06:44:41 -07:00
|
|
|
(efl_super(obj, MY_CLASS), &s_policy_h, &s_policy_v);
|
2010-12-07 11:18:14 -08:00
|
|
|
if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
|
|
|
|
if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
|
2010-11-22 07:24:58 -08:00
|
|
|
}
|
2011-03-22 00:54:24 -07:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-02-04 10:14:19 -08:00
|
|
|
_elm_genlist_realized_items_update(Eo *obj, Elm_Genlist_Data *_pd)
|
2011-04-06 21:35:08 -07:00
|
|
|
{
|
2013-03-13 04:25:12 -07:00
|
|
|
Eina_List *list;
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *it;
|
2011-04-06 21:35:08 -07:00
|
|
|
|
|
|
|
list = elm_genlist_realized_items_get(obj);
|
2013-03-13 04:25:12 -07:00
|
|
|
EINA_LIST_FREE(list, it)
|
2016-02-04 10:14:19 -08:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(it, it2);
|
|
|
|
if (!it2->item->block) continue;
|
|
|
|
_mark_item_update(it2);
|
|
|
|
}
|
|
|
|
ecore_job_del(_pd->update_job);
|
|
|
|
_pd->update_job = ecore_job_add(_update_job, obj);
|
2011-04-06 21:35:08 -07:00
|
|
|
}
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_decorate_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
const char *decorate_it_type,
|
|
|
|
Eina_Bool decorate_it_set)
|
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
Elm_Genlist_Data *sd;
|
2012-07-16 14:56:30 -07:00
|
|
|
Eina_List *l;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it2 = NULL;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2017-02-22 22:52:31 -08:00
|
|
|
sd = it->item->wsd;
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2012-04-03 02:56:53 -07:00
|
|
|
if (!decorate_it_type) return;
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it)) return;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->decorate_all_mode) return;
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if ((sd->mode_item == it) &&
|
|
|
|
(!strcmp(decorate_it_type, sd->decorate_it_type)) &&
|
2012-04-03 02:56:53 -07:00
|
|
|
(decorate_it_set))
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
|
|
|
if (!it->itc->decorate_item_style) return;
|
|
|
|
it->decorate_it_set = decorate_it_set;
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->multi)
|
2011-04-21 04:47:36 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FOREACH(sd->selected, l, eo_it2)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it2, it2);
|
|
|
|
if (it2->realized)
|
|
|
|
elm_genlist_item_selected_set(eo_it2, EINA_FALSE);
|
|
|
|
}
|
2011-04-21 04:47:36 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Gen_Item *it2 = NULL;
|
|
|
|
eo_it2 = elm_genlist_selected_item_get(sd->obj);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (eo_it2) it2 = efl_data_scope_get(eo_it2, ELM_GENLIST_ITEM_CLASS);
|
2014-09-27 22:15:28 -07:00
|
|
|
if (it2 && it2->realized)
|
|
|
|
elm_genlist_item_selected_set(eo_it2, EINA_FALSE);
|
2011-04-21 04:47:36 -07:00
|
|
|
}
|
|
|
|
|
2017-03-13 04:46:56 -07:00
|
|
|
if (!eina_streq(sd->decorate_it_type, decorate_it_type) ||
|
|
|
|
decorate_it_set || (it == sd->mode_item))
|
2012-07-16 14:56:30 -07:00
|
|
|
_decorate_item_unset(sd);
|
2011-04-21 04:47:36 -07:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
eina_stringshare_replace(&sd->decorate_it_type, decorate_it_type);
|
|
|
|
if (decorate_it_set) _decorate_item_set(it);
|
2011-04-21 04:47:36 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_decorate_mode_get(const Eo *eo_i EINA_UNUSED, Elm_Gen_Item *i)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(i, NULL);
|
2017-02-22 22:52:31 -08:00
|
|
|
return i->item->wsd->decorate_it_type;
|
2011-04-21 04:47:36 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_decorated_item_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-08-19 00:52:24 -07:00
|
|
|
return EO_OBJ(sd->mode_item);
|
2012-02-22 23:39:10 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_decorate_mode_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->decorate_all_mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_decorate_mode_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Bool decorated)
|
2012-02-22 23:39:10 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2013-03-13 04:25:12 -07:00
|
|
|
Eina_List *list;
|
2012-02-22 23:39:10 -08:00
|
|
|
|
2012-03-07 08:56:21 -08:00
|
|
|
decorated = !!decorated;
|
2012-07-16 14:56:30 -07:00
|
|
|
if (sd->decorate_all_mode == decorated) return;
|
2015-01-05 03:21:26 -08:00
|
|
|
// decorate_all_mode should be set first
|
|
|
|
// because content_get func. will be called after this
|
|
|
|
// and user can check whether decorate_all_mode_ is enabled.
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->decorate_all_mode = decorated;
|
2012-02-22 23:39:10 -08:00
|
|
|
|
2016-01-28 17:07:34 -08:00
|
|
|
_elm_genlist_tree_effect_stop(sd);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE;
|
2012-06-21 03:56:15 -07:00
|
|
|
|
2012-02-22 23:39:10 -08:00
|
|
|
list = elm_genlist_realized_items_get(obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!sd->decorate_all_mode)
|
2012-01-14 14:28:45 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FREE(list, eo_it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->type != ELM_GENLIST_ITEM_GROUP)
|
|
|
|
_decorate_all_item_unrealize(it);
|
|
|
|
}
|
2012-10-22 07:34:43 -07:00
|
|
|
_item_cache_zero(sd);
|
2012-01-14 14:28:45 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// unset decorated item
|
2016-03-21 00:01:15 -07:00
|
|
|
Elm_Object_Item *deco_eo_it = elm_genlist_decorated_item_get(obj);
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(deco_eo_it, deco_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (deco_it)
|
|
|
|
{
|
|
|
|
elm_genlist_item_decorate_mode_set
|
2016-03-21 00:01:15 -07:00
|
|
|
(deco_eo_it, elm_genlist_item_decorate_mode_get
|
|
|
|
(deco_eo_it), EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
_decorate_item_finished_signal_cb(deco_it, obj, NULL, NULL);
|
|
|
|
}
|
2012-01-26 02:01:48 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FREE(list, eo_it)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->item->type != ELM_GENLIST_ITEM_GROUP)
|
|
|
|
{
|
|
|
|
if (it->itc->decorate_all_item_style)
|
|
|
|
_decorate_all_item_realize(it, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-13 04:25:12 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2011-11-30 09:31:01 -08:00
|
|
|
}
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_reorder_mode_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool reorder_mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-03-14 03:13:06 -07:00
|
|
|
Eina_List *realized;
|
2014-09-27 22:15:28 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2013-03-14 03:13:06 -07:00
|
|
|
if (sd->reorder_mode == !!reorder_mode) return;
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
if (sd->pin_item) elm_genlist_item_pin_set(EO_OBJ(sd->pin_item), EINA_FALSE);
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->reorder_mode = !!reorder_mode;
|
2013-03-14 03:13:06 -07:00
|
|
|
realized = elm_genlist_realized_items_get(obj);
|
2014-09-27 22:15:28 -07:00
|
|
|
EINA_LIST_FREE(realized, eo_it)
|
2013-03-14 03:13:06 -07:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2014-12-31 01:59:28 -08:00
|
|
|
if (sd->reorder_mode)
|
2014-12-31 02:10:40 -08:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm");
|
|
|
|
if (it->deco_all_view)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(it->deco_all_view,
|
|
|
|
SIGNAL_REORDER_MODE_SET, "elm");
|
|
|
|
}
|
|
|
|
}
|
2014-12-31 01:59:28 -08:00
|
|
|
else
|
2014-12-31 02:10:40 -08:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_UNSET, "elm");
|
|
|
|
if (it->deco_all_view)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(it->deco_all_view,
|
|
|
|
SIGNAL_REORDER_MODE_UNSET, "elm");
|
|
|
|
}
|
|
|
|
}
|
2014-12-31 01:59:28 -08:00
|
|
|
}
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_reorder_mode_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->reorder_mode;
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Elm_Genlist_Item_Type
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_type_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, ELM_GENLIST_ITEM_MAX);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2017-02-22 22:52:31 -08:00
|
|
|
return it->item->type;
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_pin_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, Eina_Bool pin)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
ELM_GENLIST_DATA_GET(WIDGET(it), sd);
|
|
|
|
if (sd->reorder_mode) return;
|
|
|
|
if (it->item->type & ELM_GENLIST_ITEM_GROUP) return;
|
|
|
|
|
|
|
|
if (pin ^ (sd->pin_item == it))
|
|
|
|
{
|
|
|
|
if (sd->pin_item)
|
|
|
|
{
|
|
|
|
if (sd->pin_item->item->block)
|
|
|
|
sd->pin_item->item->block->realized = EINA_TRUE;
|
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
|
|
|
}
|
|
|
|
if (pin)
|
|
|
|
sd->pin_item = it;
|
|
|
|
else
|
|
|
|
sd->pin_item = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_pin_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
ELM_GENLIST_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
if (sd->pin_item == it)
|
|
|
|
return EINA_TRUE;
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
EAPI Elm_Genlist_Item_Class *
|
|
|
|
elm_genlist_item_class_new(void)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2015-01-04 22:55:39 -08:00
|
|
|
Elm_Genlist_Item_Class *itc = ELM_NEW(Elm_Genlist_Item_Class);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(itc, NULL);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
itc->version = CLASS_ALLOCATED;
|
|
|
|
itc->refcount = 1;
|
|
|
|
itc->delete_me = EINA_FALSE;
|
|
|
|
|
|
|
|
return itc;
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
EAPI void
|
|
|
|
elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
|
|
|
if (itc->refcount > 0) elm_genlist_item_class_unref(itc);
|
|
|
|
else
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
itc->version = 0;
|
|
|
|
free(itc);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
EAPI void
|
|
|
|
elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
itc->refcount++;
|
|
|
|
if (itc->refcount == 0) itc->refcount--;
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
|
|
|
|
{
|
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
if (itc->refcount > 0) itc->refcount--;
|
|
|
|
if (itc->delete_me && (!itc->refcount))
|
|
|
|
elm_genlist_item_class_free(itc);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-16 14:56:30 -07:00
|
|
|
_flip_job(void *data)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2015-01-08 06:23:44 -08:00
|
|
|
_item_unselect(it);
|
2012-07-16 14:56:30 -07:00
|
|
|
_elm_genlist_item_unrealize(it, EINA_FALSE);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->flipped = EINA_TRUE;
|
|
|
|
it->item->nocache = EINA_TRUE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_flip_set(Eo *eo_it, Elm_Gen_Item *it, Eina_Bool flip)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
flip = !!flip;
|
|
|
|
if (it->flipped == flip) return;
|
|
|
|
|
|
|
|
if (flip)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
ecore_job_add(_flip_job, it);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
else
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2014-12-29 18:16:56 -08:00
|
|
|
edje_object_signal_emit(VIEW(it), SIGNAL_FLIP_DISABLED, "elm");
|
2017-02-22 22:52:31 -08:00
|
|
|
if (it->item->wsd->decorate_all_mode)
|
2014-12-29 18:16:56 -08:00
|
|
|
edje_object_signal_emit(it->deco_all_view, SIGNAL_FLIP_DISABLED,
|
|
|
|
"elm");
|
2014-12-29 05:27:28 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
it->flipped = flip;
|
2017-02-22 22:52:31 -08:00
|
|
|
_item_cache_zero(it->item->wsd);
|
2014-08-19 00:52:24 -07:00
|
|
|
elm_genlist_item_update(eo_it);
|
2012-07-16 14:56:30 -07:00
|
|
|
it->item->nocache = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_flip_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
return it->flipped;
|
|
|
|
}
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_select_mode_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Elm_Object_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2015-01-04 22:42:22 -08:00
|
|
|
if ((mode >= ELM_OBJECT_SELECT_MODE_MAX) || (sd->select_mode == mode))
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2015-01-04 22:42:22 -08:00
|
|
|
sd->select_mode = mode;
|
|
|
|
|
|
|
|
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
|
|
|
|
{
|
|
|
|
Eina_List *l, *ll;
|
2015-03-11 23:42:30 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, ll, eo_it)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
|
2015-01-04 22:42:22 -08:00
|
|
|
_item_unselect(it);
|
2015-03-11 23:42:30 -07:00
|
|
|
}
|
2015-01-04 22:42:22 -08:00
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_select_mode_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-07-16 14:56:30 -07:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->select_mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_highlight_mode_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool highlight)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->highlight = !!highlight;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_highlight_mode_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->highlight;
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_item_select_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
Elm_Object_Select_Mode mode)
|
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
2013-05-02 11:13:36 -07:00
|
|
|
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
2015-01-04 22:03:37 -08:00
|
|
|
if ((mode >= ELM_OBJECT_SELECT_MODE_MAX) || (it->select_mode == mode))
|
2012-07-16 14:56:30 -07:00
|
|
|
return;
|
2015-01-04 22:03:37 -08:00
|
|
|
|
|
|
|
it->select_mode = mode;
|
2012-07-16 14:56:30 -07:00
|
|
|
|
2015-01-04 22:37:41 -08:00
|
|
|
if ((it->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
|
|
|
|
_item_unselect(it);
|
|
|
|
|
2012-07-16 14:56:30 -07:00
|
|
|
if (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
|
|
|
{
|
|
|
|
it->item->mincalcd = EINA_FALSE;
|
|
|
|
it->item->updateme = EINA_TRUE;
|
|
|
|
if (it->item->block) it->item->block->updateme = EINA_TRUE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->update_job);
|
2013-05-02 11:13:36 -07:00
|
|
|
sd->update_job = ecore_job_add(_update_job, sd->obj);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
// reset homogeneous item size
|
2013-05-02 11:13:36 -07:00
|
|
|
if (sd->homogeneous)
|
2012-03-07 04:15:36 -08:00
|
|
|
{
|
2015-12-01 23:23:39 -08:00
|
|
|
Item_Size *size =
|
|
|
|
eina_hash_find(sd->size_caches, &(it->itc));
|
|
|
|
if (size)
|
|
|
|
eina_hash_del_by_key(sd->size_caches, it->itc);
|
2012-03-07 04:15:36 -08:00
|
|
|
}
|
|
|
|
}
|
2012-07-16 14:56:30 -07:00
|
|
|
}
|
2012-03-07 04:15:36 -08:00
|
|
|
|
2014-09-27 22:15:28 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_item_select_mode_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:28 -07:00
|
|
|
{
|
|
|
|
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX);
|
2012-07-16 14:56:30 -07:00
|
|
|
|
|
|
|
return it->select_mode;
|
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_genlist_item_efl_access_object_state_set_get(const Eo *eo_it, Elm_Gen_Item *it EINA_UNUSED)
|
2014-10-02 09:37:53 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2014-10-02 09:37:53 -07:00
|
|
|
Eina_Bool sel;
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS));
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
sel = elm_obj_genlist_item_selected_get(eo_it);
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_SELECTABLE);
|
2014-10-02 09:37:53 -07:00
|
|
|
|
|
|
|
if (sel)
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_SELECTED);
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2015-07-01 01:42:45 -07:00
|
|
|
if (elm_genlist_item_type_get(eo_it) == ELM_GENLIST_ITEM_TREE)
|
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_EXPANDABLE);
|
2015-07-01 01:42:45 -07:00
|
|
|
if (elm_genlist_item_expanded_get(eo_it))
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_EXPANDED);
|
2015-07-01 01:42:45 -07:00
|
|
|
}
|
|
|
|
|
2014-10-02 09:37:53 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
EOLIAN const char*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_genlist_item_efl_access_object_i18n_name_get(const Eo *eo_it, Elm_Gen_Item *it)
|
2014-10-02 09:37:53 -07:00
|
|
|
{
|
2016-11-09 17:58:41 -08:00
|
|
|
const char *ret;
|
2014-10-02 09:37:53 -07:00
|
|
|
Eina_Strbuf *buf;
|
2016-11-09 17:58:41 -08:00
|
|
|
char *accessible_name;
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_i18n_name_get(efl_super(eo_it, ELM_GENLIST_ITEM_CLASS));
|
2015-12-17 00:36:02 -08:00
|
|
|
if (ret) return ret;
|
|
|
|
|
2014-10-02 09:37:53 -07:00
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
if (it->itc->func.text_get)
|
|
|
|
{
|
|
|
|
Eina_List *texts;
|
|
|
|
const char *key;
|
|
|
|
|
|
|
|
texts =
|
|
|
|
elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "texts"));
|
|
|
|
|
|
|
|
EINA_LIST_FREE(texts, key)
|
|
|
|
{
|
2015-04-22 00:06:14 -07:00
|
|
|
char *str_markup = it->itc->func.text_get
|
2014-10-02 09:37:53 -07:00
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
2015-04-22 00:06:14 -07:00
|
|
|
char *str_utf8 = _elm_util_mkup_to_text(str_markup);
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2015-04-22 00:06:14 -07:00
|
|
|
free(str_markup);
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2015-04-22 00:06:14 -07:00
|
|
|
if (str_utf8)
|
2014-10-02 09:37:53 -07:00
|
|
|
{
|
|
|
|
if (eina_strbuf_length_get(buf) > 0) eina_strbuf_append(buf, ", ");
|
2015-04-22 00:06:14 -07:00
|
|
|
eina_strbuf_append(buf, str_utf8);
|
|
|
|
free(str_utf8);
|
2014-10-02 09:37:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
accessible_name = eina_strbuf_string_steal(buf);
|
2014-10-02 09:37:53 -07:00
|
|
|
eina_strbuf_free(buf);
|
2016-11-09 17:58:41 -08:00
|
|
|
|
|
|
|
eina_stringshare_del(it->base->accessible_name);
|
|
|
|
it->base->accessible_name = eina_stringshare_add(accessible_name);
|
|
|
|
free(accessible_name);
|
|
|
|
return it->base->accessible_name;
|
2014-10-02 09:37:53 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_tree_effect_enabled_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enabled)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-16 14:56:30 -07:00
|
|
|
sd->tree_effect_enabled = !!enabled;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_tree_effect_enabled_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->tree_effect_enabled;
|
2013-02-20 02:00:49 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_genlist_focus_on_selection_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enabled)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
|
|
|
sd->focus_on_selection_enabled = !!enabled;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_focus_on_selection_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2013-02-20 02:00:49 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->focus_on_selection_enabled;
|
2013-02-20 02:00:49 -08:00
|
|
|
}
|
|
|
|
|
2012-11-14 07:46:14 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_genlist_nth_item_get(const Evas_Object *obj, unsigned int nth)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = NULL;
|
|
|
|
Eina_Accessor *a;
|
|
|
|
void *data;
|
|
|
|
|
|
|
|
ELM_GENLIST_CHECK(obj) NULL;
|
|
|
|
ELM_GENLIST_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
|
|
|
a = eina_inlist_accessor_new(sd->items);
|
|
|
|
if (!a) return NULL;
|
|
|
|
if (eina_accessor_data_get(a, nth, &data))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
|
|
|
eina_accessor_free(a);
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-14 07:46:14 -08:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_efl_ui_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Genlist_Data *sd)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2014-06-10 03:29:47 -07:00
|
|
|
Evas_Coord ox, oy, oh, ow, item_x = 0, item_y = 0, item_w = 0, item_h = 0;
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect r = {};
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2014-06-10 03:29:47 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2014-05-06 22:13:19 -07:00
|
|
|
if (sd->focused_item)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2014-09-27 22:15:28 -07:00
|
|
|
ELM_GENLIST_ITEM_DATA_GET(sd->focused_item, focus_it);
|
|
|
|
evas_object_geometry_get(VIEW(focus_it), &item_x, &item_y, &item_w, &item_h);
|
|
|
|
elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), &item_x, &item_y, &item_w, &item_h);
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
2016-02-17 17:02:14 -08:00
|
|
|
else
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h);
|
|
|
|
return r;
|
2016-02-17 17:02:14 -08:00
|
|
|
}
|
2014-03-08 08:04:34 -08:00
|
|
|
|
2017-08-28 23:59:40 -07:00
|
|
|
r.x = item_x;
|
|
|
|
r.y = item_y;
|
|
|
|
r.w = item_w;
|
|
|
|
r.h = item_h;
|
2014-06-10 03:29:47 -07:00
|
|
|
|
2014-03-08 08:04:34 -08:00
|
|
|
if (item_y < oy)
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.y = oy;
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
2014-07-03 00:39:41 -07:00
|
|
|
if (item_y > (oy + oh - item_h))
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.y = oy + oh - item_h;
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
2014-06-10 03:29:47 -07:00
|
|
|
|
|
|
|
if ((item_x + item_w) > (ox + ow))
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.w = ow;
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
2014-07-03 00:39:41 -07:00
|
|
|
if (item_x < ox)
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.x = ox;
|
2014-07-03 00:39:41 -07:00
|
|
|
}
|
2017-08-28 23:59:40 -07:00
|
|
|
|
|
|
|
return r;
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
|
2014-05-26 23:53:11 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_genlist_search_by_text_item_get(Eo *obj EINA_UNUSED,
|
|
|
|
Elm_Genlist_Data *sd,
|
2014-07-23 20:41:33 -07:00
|
|
|
Elm_Object_Item *item_to_search_from,
|
|
|
|
const char *part_name,
|
|
|
|
const char *pattern,
|
|
|
|
Elm_Glob_Match_Flags flags)
|
2014-05-26 23:53:11 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = NULL;
|
2014-07-23 20:41:33 -07:00
|
|
|
char *str = NULL;
|
|
|
|
Eina_Inlist *start = NULL;
|
|
|
|
int fnflags = 0;
|
2014-05-26 23:53:11 -07:00
|
|
|
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!pattern) return NULL;
|
2014-05-26 23:53:11 -07:00
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
2014-07-23 20:41:33 -07:00
|
|
|
if (flags & ELM_GLOB_MATCH_NO_ESCAPE) fnflags |= FNM_NOESCAPE;
|
|
|
|
if (flags & ELM_GLOB_MATCH_PATH) fnflags |= FNM_PATHNAME;
|
|
|
|
if (flags & ELM_GLOB_MATCH_PERIOD) fnflags |= FNM_PERIOD;
|
|
|
|
#ifdef FNM_CASEFOLD
|
|
|
|
if (flags & ELM_GLOB_MATCH_NOCASE) fnflags |= FNM_CASEFOLD;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
start = (item_to_search_from) ?
|
2016-08-15 06:44:41 -07:00
|
|
|
EINA_INLIST_GET((Elm_Gen_Item *)efl_data_scope_get(item_to_search_from, ELM_GENLIST_ITEM_CLASS)) :
|
2014-07-23 20:41:33 -07:00
|
|
|
sd->items;
|
|
|
|
EINA_INLIST_FOREACH(start, it)
|
2014-05-26 23:53:11 -07:00
|
|
|
{
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!it->itc->func.text_get) continue;
|
2014-09-14 04:51:26 -07:00
|
|
|
str = it->itc->func.text_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), part_name);
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!str) continue;
|
|
|
|
if (!fnmatch(pattern, str, fnflags))
|
2014-05-26 23:53:11 -07:00
|
|
|
{
|
2014-07-23 20:41:33 -07:00
|
|
|
free(str);
|
2014-09-27 22:15:28 -07:00
|
|
|
return EO_OBJ(it);
|
2014-05-26 23:53:11 -07:00
|
|
|
}
|
2014-07-23 20:41:33 -07:00
|
|
|
free(str);
|
2014-05-26 23:53:11 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_efl_ui_widget_focused_item_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2014-03-08 08:04:34 -08:00
|
|
|
{
|
2014-04-01 03:55:08 -07:00
|
|
|
return sd->focused_item;
|
2014-03-08 08:04:34 -08:00
|
|
|
}
|
|
|
|
|
2014-04-23 22:12:52 -07:00
|
|
|
EOLIAN static void
|
2017-08-30 00:15:34 -07:00
|
|
|
_elm_genlist_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, Eina_Bool enable)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
|
|
|
sd->item_loop_enable = !!enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_elm_interface_scrollable_item_loop_enabled_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
|
2014-04-23 22:12:52 -07:00
|
|
|
{
|
|
|
|
return sd->item_loop_enable;
|
|
|
|
}
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_genlist_class_constructor(Efl_Class *klass)
|
2014-04-01 03:55:08 -07:00
|
|
|
{
|
2013-02-07 04:24:59 -08:00
|
|
|
if (_elm_config->access_mode)
|
|
|
|
_elm_genlist_smart_focus_next_enable = EINA_TRUE;
|
2013-02-09 23:52:31 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-11-15 18:55:06 -08:00
|
|
|
EOLIAN const Efl_Access_Action_Data *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd EINA_UNUSED)
|
2014-07-25 01:33:19 -07:00
|
|
|
{
|
2017-11-15 18:55:06 -08:00
|
|
|
static Efl_Access_Action_Data atspi_actions[] = {
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "move,prior", "move", "prior", _key_action_move},
|
|
|
|
{ "move,next", "move", "next", _key_action_move},
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "move,up", "move", "up", _key_action_move},
|
|
|
|
{ "move,up,multi", "move", "up_multi", _key_action_move},
|
|
|
|
{ "move,down", "move", "down", _key_action_move},
|
|
|
|
{ "move,down,multi", "move", "down_multi", _key_action_move},
|
|
|
|
{ "move,first", "move", "first", _key_action_move},
|
|
|
|
{ "move,last", "move", "last", _key_action_move},
|
|
|
|
{ "select", "select", NULL, _key_action_select},
|
2015-02-12 00:31:00 -08:00
|
|
|
{ "select,multi", "select", "multi", _key_action_select},
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "escape", "escape", NULL, _key_action_escape},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2014-09-30 04:10:22 -07:00
|
|
|
EOLIAN Eina_List*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_genlist_efl_access_object_access_children_get(const Eo *obj, Elm_Genlist_Data *sd)
|
2014-09-30 04:10:22 -07:00
|
|
|
{
|
2015-12-01 07:55:12 -08:00
|
|
|
Eina_List *ret = NULL, *ret2 = NULL;
|
2014-09-30 04:10:22 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2014-10-02 09:37:53 -07:00
|
|
|
ret = eina_list_append(ret, EO_OBJ(it));
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret2 = efl_access_object_access_children_get(efl_super(obj, ELM_GENLIST_CLASS));
|
2015-12-01 07:55:12 -08:00
|
|
|
|
|
|
|
return eina_list_merge(ret, ret2);
|
2014-10-02 09:37:53 -07:00
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_genlist_efl_access_object_state_set_get(const Eo *obj, Elm_Genlist_Data *sd EINA_UNUSED)
|
2014-10-02 09:37:53 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(obj, ELM_GENLIST_CLASS));
|
2014-10-02 09:37:53 -07:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_MANAGES_DESCENDANTS);
|
2014-09-30 04:10:22 -07:00
|
|
|
|
2017-11-12 19:08:57 -08:00
|
|
|
if (elm_genlist_multi_select_get(obj))
|
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_MULTISELECTABLE);
|
|
|
|
|
2017-11-21 21:17:41 -08:00
|
|
|
if (elm_genlist_reorder_mode_get(obj))
|
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_ANIMATED);
|
|
|
|
|
2014-09-30 04:10:22 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-05-26 06:34:52 -07:00
|
|
|
EOLIAN int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_efl_access_selection_selected_children_count_get(const Eo *objm EINA_UNUSED, Elm_Genlist_Data *pd)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
return eina_list_count(pd->selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eo*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_genlist_efl_access_selection_selected_child_get(const Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_idx)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
return eina_list_nth(pd->selected, child_idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_genlist_efl_access_selection_child_select(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(EO_OBJ(item), EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_genlist_efl_access_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
Eo *item;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(pd->selected, l, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(item, EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_genlist_efl_access_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
return elm_genlist_item_selected_get(EO_OBJ(item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_genlist_efl_access_selection_all_children_select(Eo *obj, Elm_Genlist_Data *pd)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
|
|
|
|
if (!elm_genlist_multi_select_get(obj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
elm_genlist_item_selected_set(EO_OBJ(item), EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_genlist_efl_access_selection_access_selection_clear(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
return _all_items_deselect(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_genlist_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
|
2015-05-26 06:34:52 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_genlist_item_selected_set(EO_OBJ(item), EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2017-11-11 09:26:53 -08:00
|
|
|
EOLIAN static Efl_Object*
|
2018-01-04 11:41:49 -08:00
|
|
|
_elm_genlist_efl_object_provider_find(const Eo *obj, Elm_Genlist_Data *pd, const Efl_Object *klass)
|
2017-11-11 09:26:53 -08:00
|
|
|
{
|
|
|
|
if (klass == EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE)
|
|
|
|
return pd->provider;
|
|
|
|
return efl_provider_find(efl_super(obj, ELM_GENLIST_CLASS), klass);
|
|
|
|
}
|
|
|
|
|
2018-01-24 14:41:20 -08:00
|
|
|
EOLIAN static void
|
2018-04-06 03:48:41 -07:00
|
|
|
_elm_genlist_item_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Gen_Item *pd)
|
2017-11-11 09:26:53 -08:00
|
|
|
{
|
|
|
|
Eina_List *n;
|
2018-01-07 20:55:35 -08:00
|
|
|
Efl_Ui_Widget *wid;
|
2017-11-11 09:26:53 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(pd->contents, n, wid)
|
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
if (efl_isa(wid, EFL_UI_WIDGET_CLASS))
|
2017-11-11 09:26:53 -08:00
|
|
|
_elm_widget_full_eval(wid);
|
|
|
|
}
|
|
|
|
|
2018-04-06 03:48:41 -07:00
|
|
|
efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, ELM_GENLIST_ITEM_CLASS));
|
2017-11-11 09:26:53 -08:00
|
|
|
}
|
|
|
|
|
2018-04-06 03:48:41 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_genlist_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Genlist_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED)
|
2017-11-11 09:26:53 -08:00
|
|
|
{
|
|
|
|
return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj);
|
|
|
|
}
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
/* Standard widget overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_genlist, Elm_Genlist_Data)
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_GENLIST_EXTRA_OPS \
|
2017-08-07 00:13:38 -07:00
|
|
|
ELM_LAYOUT_SIZING_EVAL_OPS(elm_genlist), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_genlist)
|
|
|
|
|
|
|
|
#define ELM_GENLIST_PAN_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_DEL_OPS(elm_genlist_pan)
|
|
|
|
|
2014-04-01 03:55:08 -07:00
|
|
|
#include "elm_genlist.eo.c"
|
2017-05-18 01:52:17 -07:00
|
|
|
#include "elm_genlist_pan.eo.c"
|
2014-09-27 22:15:28 -07:00
|
|
|
#include "elm_genlist_item.eo.c"
|