2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
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:37 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2017-10-15 06:35:42 -07:00
|
|
|
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
#include <Elementary.h>
|
2010-09-27 11:18:37 -07:00
|
|
|
#include <Elementary_Cursor.h>
|
2010-06-03 05:53:14 -07:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:07:07 -07:00
|
|
|
#include "elm_widget_gengrid.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_interface_scrollable.h"
|
2019-03-07 07:54:43 -08:00
|
|
|
#include "elm_pan_eo.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_focus_parent_provider_gen_eo.h"
|
2017-10-20 08:21:19 -07:00
|
|
|
#include "efl_ui_focus_composition_adapter.eo.h"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_gengrid_item_eo.h"
|
|
|
|
#include "elm_gengrid_pan_eo.h"
|
|
|
|
#include "elm_gengrid_eo.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_PAN_CLASS ELM_GENGRID_PAN_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 06:29:38 -08:00
|
|
|
#define MY_PAN_CLASS_NAME "Elm_Gengrid_Pan"
|
|
|
|
#define MY_PAN_CLASS_NAME_LEGACY "elm_gengrid_pan"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_GENGRID_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Gengrid"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_gengrid"
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-03-05 21:02:36 -08:00
|
|
|
// internally allocated
|
2012-07-10 14:40:38 -07:00
|
|
|
#define CLASS_ALLOCATED 0x3a70f00f
|
2012-03-05 21:02:36 -08:00
|
|
|
|
2011-07-25 12:51:57 -07:00
|
|
|
/* --
|
2010-06-03 05:53:14 -07:00
|
|
|
* TODO:
|
elementry / entry, menu, notify, list, gengrid, actionslider, image, icon, anchorview, fileselector_button, calendar, photocam, anchorblock,
button, map, colorselector, hover, photo, diskselector, index, bubble, pager, hoversel, check, scrolled_entry, clock, flipselector
updated signal callback list in the doxygen.
should update genlist, progressbar ...
SVN revision: 58335
2011-04-04 09:34:18 -07:00
|
|
|
* Handle non-homogeneous objects too.
|
2010-06-03 05:53:14 -07:00
|
|
|
*/
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
#define PRELOAD 1
|
2011-06-14 01:36:03 -07:00
|
|
|
#define REORDER_EFFECT_TIME 0.5
|
2010-06-03 05:53:14 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
#define CACHE_MAX 40
|
|
|
|
|
2013-10-18 08:06:25 -07:00
|
|
|
#define ELM_PRIV_GENGRID_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_ACTIVATED, "activated", "") \
|
|
|
|
cmd(SIG_CLICKED_DOUBLE, "clicked,double", "") \
|
2014-12-29 02:38:17 -08:00
|
|
|
cmd(SIG_CLICKED_RIGHT, "clicked,right", "") \
|
2013-10-18 08:06:25 -07:00
|
|
|
cmd(SIG_LONGPRESSED, "longpressed", "") \
|
|
|
|
cmd(SIG_SELECTED, "selected", "") \
|
|
|
|
cmd(SIG_UNSELECTED, "unselected", "") \
|
|
|
|
cmd(SIG_REALIZED, "realized", "") \
|
|
|
|
cmd(SIG_UNREALIZED, "unrealized", "") \
|
|
|
|
cmd(SIG_CHANGED, "changed", "") \
|
|
|
|
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_SCROLL, "scroll", "") \
|
|
|
|
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_SCROLL_PAGE_CHANGE, "scroll,page,changed", "") \
|
|
|
|
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_MOVED, "moved", "") \
|
|
|
|
cmd(SIG_INDEX_UPDATE, "index,update", "") \
|
|
|
|
cmd(SIG_HIGHLIGHTED, "highlighted", "") \
|
|
|
|
cmd(SIG_UNHIGHLIGHTED, "unhighlighted", "") \
|
2014-03-21 01:00:46 -07:00
|
|
|
cmd(SIG_ITEM_FOCUSED, "item,focused", "") \
|
|
|
|
cmd(SIG_ITEM_UNFOCUSED, "item,unfocused", "") \
|
2013-10-18 08:06:25 -07:00
|
|
|
cmd(SIG_PRESSED, "pressed", "") \
|
2014-04-23 05:13:57 -07:00
|
|
|
cmd(SIG_RELEASED, "released", "") \
|
|
|
|
cmd(SIG_ITEM_REORDER_START, "item,reorder,anim,start", "") \
|
|
|
|
cmd(SIG_ITEM_REORDER_STOP, "item,reorder,anim,stop", "")
|
2013-10-18 08:06:25 -07:00
|
|
|
|
|
|
|
ELM_PRIV_GENGRID_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
2013-02-11 23:29:16 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-10-18 08:06:25 -07:00
|
|
|
ELM_PRIV_GENGRID_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-02-11 23:29:16 -08:00
|
|
|
|
2011-07-26 00:00:19 -07:00
|
|
|
{NULL, NULL}
|
2011-04-21 17:57:15 -07:00
|
|
|
};
|
2013-10-18 08:06:25 -07:00
|
|
|
#undef ELM_PRIV_GENGRID_SIGNALS
|
2011-04-21 17:57:15 -07:00
|
|
|
|
2014-04-16 01:19:23 -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-04-23 05:13:57 -07:00
|
|
|
static void _item_position_update(Eina_Inlist *list, int idx);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
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);
|
2016-10-04 23:36:04 -07:00
|
|
|
static void _calc_job(void *data);
|
2018-11-13 08:36:31 -08:00
|
|
|
static void _elm_gengrid_item_focused(Elm_Object_Item *eo_it);
|
2014-04-16 01:19:23 -07:00
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"select", _key_action_select},
|
|
|
|
{"escape", _key_action_escape},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2018-11-13 08:36:31 -08:00
|
|
|
static void
|
|
|
|
_flush_focus_on_realization(Eo *widget, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET_OR_RETURN(widget, sd);
|
|
|
|
|
|
|
|
if (sd->focus_on_realization == it)
|
|
|
|
{
|
|
|
|
_elm_gengrid_item_focused(EO_OBJ(it));
|
|
|
|
efl_ui_focus_manager_focus_set(WIDGET(it), EO_OBJ(it));
|
|
|
|
sd->focus_on_realization = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
|
|
|
//-- item cache handle routine --//
|
|
|
|
// push item cache into caches
|
|
|
|
static Eina_Bool
|
|
|
|
_item_cache_push(Elm_Gengrid_Data *sd, Item_Cache *itc)
|
|
|
|
{
|
|
|
|
if (!itc || (sd->item_cache_max <= 0))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
sd->item_cache_count++;
|
|
|
|
sd->item_cache =
|
|
|
|
eina_inlist_prepend(sd->item_cache, EINA_INLIST_GET(itc));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// pop item cache from caches
|
|
|
|
static Item_Cache *
|
|
|
|
_item_cache_pop(Elm_Gengrid_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
// free one item cache from caches
|
|
|
|
static void
|
|
|
|
_item_cache_free(Item_Cache *itc)
|
|
|
|
{
|
2017-06-23 14:43:57 -07:00
|
|
|
Evas_Object *c;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (!itc) return;
|
|
|
|
|
|
|
|
evas_object_del(itc->spacer);
|
2018-06-20 22:09:06 -07:00
|
|
|
efl_wref_del(itc->base_view, &itc->base_view);
|
|
|
|
efl_del(itc->base_view);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
eina_stringshare_del(itc->item_style);
|
2017-06-23 14:43:57 -07:00
|
|
|
EINA_LIST_FREE(itc->contents, c)
|
|
|
|
evas_object_del(c);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
ELM_SAFE_FREE(itc ,free);
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean up item cache by removing overflowed caches
|
|
|
|
static void
|
|
|
|
_item_cache_clean(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
// empty all item caches
|
|
|
|
static void
|
|
|
|
_item_cache_zero(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
static Eina_Bool
|
2017-06-23 14:43:57 -07:00
|
|
|
_item_cache_add(Elm_Gen_Item *it, Eina_List *contents)
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
{
|
|
|
|
if (it->item->nocache_once || it->item->nocache) return EINA_FALSE;
|
|
|
|
|
|
|
|
Item_Cache *itc = NULL;
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Evas_Object *obj = sd->obj;
|
2019-02-27 11:00:39 -08:00
|
|
|
Evas_Object *win = elm_widget_top_get(obj);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
|
|
|
if (sd->item_cache_max > 0)
|
|
|
|
itc = ELM_NEW(Item_Cache);
|
|
|
|
if (!_item_cache_push(sd, itc))
|
|
|
|
{
|
|
|
|
if (itc) ELM_SAFE_FREE(itc, free);
|
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
itc->spacer = it->spacer;
|
2018-06-20 22:09:06 -07:00
|
|
|
efl_wref_add(VIEW(it), &itc->base_view);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
itc->item_style = eina_stringshare_add(it->itc->item_style);
|
2017-06-23 14:43:57 -07:00
|
|
|
itc->contents = contents;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
|
|
|
if (!it->group)
|
|
|
|
{
|
|
|
|
if (it->selected)
|
|
|
|
edje_object_signal_emit(itc->base_view, "elm,state,unselected", "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
edje_object_signal_emit(itc->base_view, "elm,state,enabled", "elm");
|
2016-01-31 18:27:56 -08:00
|
|
|
if ((EO_OBJ(it) == sd->focused_item) &&
|
2019-02-27 11:00:39 -08:00
|
|
|
(elm_win_focus_highlight_enabled_get(win) || _elm_config->win_auto_focus_enable))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
edje_object_signal_emit(itc->base_view, "elm,state,unfocused", "elm");
|
|
|
|
|
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
// FIXME: other callbacks?
|
|
|
|
_item_mouse_callbacks_del(it, itc->base_view);
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_mirrored_set(VIEW(it),
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_get(WIDGET(it)));
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
edje_object_scale_set(VIEW(it),
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_scale_get(WIDGET(it))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
* elm_config_scale_get());
|
|
|
|
|
|
|
|
evas_object_hide(itc->base_view);
|
|
|
|
evas_object_move(itc->base_view, -9999, -9999);
|
|
|
|
it->spacer = NULL;
|
2018-06-20 22:09:06 -07:00
|
|
|
efl_wref_del(it->base->view, &it->base->view);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
VIEW(it) = NULL;
|
|
|
|
|
|
|
|
_item_cache_clean(sd);
|
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// find an item from item cache and remove it from the cache
|
|
|
|
static Eina_Bool
|
|
|
|
_item_cache_find(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
if (it->item->nocache_once || it->item->nocache) return EINA_FALSE;
|
|
|
|
|
|
|
|
Item_Cache *itc = NULL;
|
|
|
|
Eina_Inlist *l;
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH_SAFE(sd->item_cache, l, itc)
|
|
|
|
{
|
|
|
|
if (((!it->itc->item_style) && (!itc->item_style)) ||
|
|
|
|
(it->itc->item_style && itc->item_style &&
|
|
|
|
(!strcmp(it->itc->item_style, itc->item_style))))
|
|
|
|
{
|
|
|
|
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);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
itc->spacer = NULL;
|
2018-06-20 22:09:06 -07:00
|
|
|
efl_wref_del(itc->base_view, &itc->base_view);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
itc->base_view = NULL;
|
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
itc->contents = eina_list_free(itc->contents);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_cache_free(itc);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2016-10-04 23:36:04 -07:00
|
|
|
//Calculate sum of widths or heights of all items in a row or column
|
|
|
|
static int
|
|
|
|
_get_item_span(Elm_Gengrid_Data *sd, int idx)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
int sum = 0;
|
|
|
|
idx++;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->position == idx)
|
|
|
|
{
|
|
|
|
sum += ((sd->horizontal) ? it->item->w : it->item->h);
|
|
|
|
idx += sd->nmax;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_setup_custom_size_mode(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
unsigned int *tmp;
|
|
|
|
int alloc_size = sd->nmax * sizeof(unsigned int);
|
|
|
|
if (sd->nmax <= sd->custom_alloc_size) return EINA_TRUE;
|
|
|
|
|
|
|
|
tmp = realloc(sd->custom_size_sum, alloc_size);
|
|
|
|
if (!tmp) return EINA_FALSE;
|
|
|
|
sd->custom_size_sum = tmp;
|
|
|
|
|
|
|
|
tmp = realloc(sd->custom_tot_sum, alloc_size);
|
|
|
|
if (!tmp) return EINA_FALSE;
|
|
|
|
sd->custom_tot_sum = tmp;
|
|
|
|
|
|
|
|
sd->custom_alloc_size = sd->nmax;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_cleanup_custom_size_mode(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(sd->custom_size_sum, free);
|
|
|
|
ELM_SAFE_FREE(sd->custom_tot_sum, free);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_custom_size_mode_calc(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
unsigned int i, max;
|
|
|
|
if (!sd->custom_tot_sum) return;
|
|
|
|
|
|
|
|
max = sd->custom_tot_sum[0] = _get_item_span(sd, 0);
|
|
|
|
for (i = 1; i < sd->custom_alloc_size; ++i)
|
|
|
|
{
|
|
|
|
sd->custom_tot_sum[i] = _get_item_span(sd, i);
|
|
|
|
max = (max < sd->custom_tot_sum[i]) ? sd->custom_tot_sum[i] : max;
|
|
|
|
}
|
|
|
|
sd->custom_tot_max = max;
|
|
|
|
}
|
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_is_no_select(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_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;
|
|
|
|
}
|
|
|
|
|
2016-10-04 23:36:04 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_custom_size_get(const Eo *eo_it EINA_UNUSED,
|
2016-10-04 23:36:04 -07:00
|
|
|
Elm_Gen_Item *it,
|
|
|
|
Evas_Coord *w,
|
|
|
|
Evas_Coord *h)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
if (w) *w = GG_IT(it)->w;
|
|
|
|
if (h) *h = GG_IT(it)->h;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_custom_size_set(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Gen_Item *it,
|
|
|
|
Evas_Coord w,
|
|
|
|
Evas_Coord h)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
if (!sd->custom_size_mode) sd->custom_size_mode = !sd->custom_size_mode;
|
|
|
|
if ((GG_IT(it)->w == w) && (GG_IT(it)->h == h)) return;
|
|
|
|
GG_IT(it)->h = h;
|
|
|
|
GG_IT(it)->w = w;
|
|
|
|
|
|
|
|
ecore_job_del(sd->calc_job);
|
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
|
|
|
}
|
|
|
|
|
2014-07-22 19:35:20 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_gengrid_search_by_text_item_get(Eo *obj EINA_UNUSED,
|
|
|
|
Elm_Gengrid_Data *sd,
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item_to_search_from,
|
2014-07-23 20:41:33 -07:00
|
|
|
const char *part_name,
|
|
|
|
const char *pattern,
|
|
|
|
Elm_Glob_Match_Flags flags)
|
2014-07-22 19:35:20 -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-07-22 19:35:20 -07:00
|
|
|
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!pattern) return NULL;
|
2014-07-22 19:35:20 -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
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item_to_search_from, item_to_search_from);
|
2014-07-23 20:41:33 -07:00
|
|
|
start = (item_to_search_from) ?
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_INLIST_GET(item_to_search_from) :
|
2014-07-23 20:41:33 -07:00
|
|
|
sd->items;
|
2014-07-22 19:35:20 -07:00
|
|
|
EINA_INLIST_FOREACH(start, it)
|
|
|
|
{
|
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)),
|
2017-01-26 00:54:30 -08:00
|
|
|
WIDGET(it), part_name ? part_name : "elm.text");
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!str) continue;
|
|
|
|
if (!fnmatch(pattern, str, fnflags))
|
|
|
|
{
|
|
|
|
free(str);
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2014-07-23 20:41:33 -07:00
|
|
|
}
|
|
|
|
free(str);
|
2014-07-22 19:35:20 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
static void
|
|
|
|
_item_show_region(void *data)
|
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Data *sd = data;
|
2016-10-04 23:36:04 -07:00
|
|
|
Evas_Coord cvw, cvh, it_xpos = 0, it_ypos = 0, col = 0, row = 0, minx = 0, miny = 0;
|
2014-01-20 23:54:59 -08:00
|
|
|
Evas_Coord vw = 0, vh = 0;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2016-10-04 23:36:04 -07:00
|
|
|
Eina_Bool was_resized = EINA_FALSE;
|
2013-01-03 04:03:55 -08:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
|
|
|
|
if ((cvw != 0) && (cvh != 0))
|
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
int x = 0;
|
2013-01-03 04:03:55 -08:00
|
|
|
if (sd->show_region)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_it = sd->show_it;
|
2013-01-03 04:03:55 -08:00
|
|
|
else if (sd->bring_in)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_it = sd->bring_in_it;
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_it) return;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_pan_pos_min_get(sd->pan_obj, &minx, &miny);
|
2013-01-03 04:03:55 -08:00
|
|
|
if (sd->horizontal && (sd->item_height > 0))
|
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
|
|
|
was_resized = sd->custom_size_mode && (it->y < (Evas_Coord)sd->custom_alloc_size);
|
|
|
|
if (was_resized)
|
|
|
|
{
|
|
|
|
it_xpos = GG_IT(it)->sw
|
|
|
|
+ ((sd->custom_tot_max - sd->custom_tot_sum[it->y]) * sd->align_x)
|
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_width)
|
|
|
|
+ minx;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
col = sd->item_count / row;
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(sd->obj))
|
2016-10-04 23:36:04 -07:00
|
|
|
{
|
|
|
|
if (sd->item_count % row == 0)
|
|
|
|
x = col - 1 - it->x;
|
|
|
|
else
|
|
|
|
x = col - it->x;
|
|
|
|
}
|
|
|
|
else x = it->x;
|
|
|
|
if (x >= 1)
|
|
|
|
{
|
|
|
|
it_xpos = ((x - GG_IT(it)->prev_group) * sd->item_width)
|
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_width)
|
|
|
|
+ minx;
|
|
|
|
}
|
|
|
|
else it_xpos = minx;
|
|
|
|
/**
|
|
|
|
* If custom size cannot be used for a row
|
|
|
|
* account for offset due to rows which are
|
|
|
|
* using custom sizes already.
|
|
|
|
*/
|
|
|
|
if (sd->custom_alloc_size > 0)
|
|
|
|
{
|
|
|
|
if (sd->item_count % row)
|
|
|
|
col++;
|
|
|
|
it_xpos += (sd->custom_tot_max
|
|
|
|
- ((col - GG_IT(it)->prev_group) * sd->item_width)
|
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_width)) * sd->align_x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
miny = miny + ((cvh - (sd->item_height * row))
|
|
|
|
* sd->align_y);
|
2016-01-17 06:11:29 -08:00
|
|
|
it_ypos = it->y * sd->item_height + miny;
|
2013-01-03 04:03:55 -08:00
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
|
|
|
was_resized = it->x < (Evas_Coord)sd->custom_alloc_size;
|
|
|
|
if (was_resized)
|
|
|
|
{
|
|
|
|
it_ypos = GG_IT(it)->sh
|
|
|
|
+ ((sd->custom_tot_max - sd->custom_tot_sum[it->x]) * sd->align_y)
|
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_height)
|
|
|
|
+ miny;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->y >= 1)
|
|
|
|
{
|
|
|
|
it_ypos = ((it->y - GG_IT(it)->prev_group) * sd->item_height)
|
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_height)
|
|
|
|
+ miny;
|
|
|
|
}
|
|
|
|
else it_ypos = miny;
|
|
|
|
/**
|
|
|
|
* If custom size cannot be used for a column
|
|
|
|
* account for offset due to columns which are
|
|
|
|
* using custom sizes already.
|
|
|
|
*/
|
|
|
|
if (sd->custom_alloc_size > 0)
|
|
|
|
{
|
|
|
|
row = sd->item_count / col;
|
|
|
|
if (sd->item_count % col)
|
|
|
|
row++;
|
|
|
|
it_ypos += (sd->custom_tot_max
|
|
|
|
- ((row - GG_IT(it)->prev_group) * sd->item_height)
|
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_height)) * sd->align_y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
minx = minx + ((cvw - (sd->item_width * col))
|
|
|
|
* sd->align_x);
|
2016-01-17 06:11:29 -08:00
|
|
|
it_xpos = it->x * sd->item_width + minx;
|
2013-01-03 04:03:55 -08:00
|
|
|
}
|
|
|
|
|
2014-01-20 23:54:59 -08:00
|
|
|
switch (sd->scroll_to_type)
|
|
|
|
{
|
|
|
|
case ELM_GENGRID_ITEM_SCROLLTO_TOP:
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(it), NULL, NULL, &vw, &vh);
|
2014-01-20 23:54:59 -08:00
|
|
|
break;
|
|
|
|
case ELM_GENGRID_ITEM_SCROLLTO_MIDDLE:
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(it), NULL, NULL, &vw, &vh);
|
2014-01-20 23:54:59 -08:00
|
|
|
it_xpos = it_xpos - ((vw - sd->item_width) / 2);
|
|
|
|
it_ypos = it_ypos - ((vh - sd->item_height) / 2);
|
|
|
|
break;
|
2016-01-04 14:06:21 -08:00
|
|
|
case ELM_GENGRID_ITEM_SCROLLTO_BOTTOM:
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(it), NULL, NULL, &vw, &vh);
|
2016-01-04 14:06:21 -08:00
|
|
|
it_xpos = it_xpos - vw + sd->item_width;
|
|
|
|
it_ypos = it_ypos - vh + sd->item_height;
|
|
|
|
break;
|
2014-01-20 23:54:59 -08:00
|
|
|
default:
|
2016-10-04 23:36:04 -07:00
|
|
|
vw = (sd->horizontal && was_resized) ? GG_IT(it)->w : sd->item_width;
|
|
|
|
vh = (!sd->horizontal && was_resized) ? GG_IT(it)->h : sd->item_height;
|
2014-01-20 23:54:59 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
if (sd->show_region)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show(WIDGET(it), it_xpos, it_ypos, vw, vh);
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->show_region = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->bring_in)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_region_bring_in(WIDGET(it), it_xpos, it_ypos, vw, vh);
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->bring_in = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_calc_job(void *data)
|
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENGRID_DATA_GET(data, sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh;
|
|
|
|
Elm_Gen_Item *it, *group_item = NULL;
|
|
|
|
int count_group = 0;
|
|
|
|
long count = 0;
|
2010-10-01 12:03:17 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->items_lost = 0;
|
2010-10-01 12:03:17 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((cvw != 0) || (cvh != 0))
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->horizontal) && (sd->item_height > 0))
|
|
|
|
nmax = cvh / sd->item_height;
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
nmax = cvw / sd->item_width;
|
|
|
|
|
|
|
|
if (nmax < 1)
|
|
|
|
nmax = 1;
|
|
|
|
|
2016-10-04 23:36:04 -07:00
|
|
|
sd->nmax = nmax;
|
|
|
|
if (sd->custom_size_mode)
|
|
|
|
{
|
|
|
|
if (!_setup_custom_size_mode(sd))
|
|
|
|
ERR("Failed to allocate memory for custom item size "
|
|
|
|
"calculations!: gengrid=%p", sd->obj);
|
|
|
|
_custom_size_mode_calc(sd);
|
|
|
|
}
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (GG_IT(it)->prev_group != count_group)
|
|
|
|
GG_IT(it)->prev_group = count_group;
|
|
|
|
if (it->group)
|
|
|
|
{
|
|
|
|
count = count % nmax;
|
|
|
|
if (count)
|
|
|
|
sd->items_lost += nmax - count;
|
|
|
|
count_group++;
|
|
|
|
if (count) count = 0;
|
|
|
|
group_item = it;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->parent != group_item)
|
|
|
|
it->parent = group_item;
|
|
|
|
count++;
|
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
count = sd->item_count + sd->items_lost - count_group;
|
|
|
|
if (sd->horizontal)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
minh = nmax * sd->item_height;
|
2016-10-04 23:36:04 -07:00
|
|
|
if (sd->custom_size_mode && (sd->custom_alloc_size > 0))
|
|
|
|
minw = sd->custom_tot_max +
|
|
|
|
(count_group * sd->group_item_width);
|
|
|
|
else
|
|
|
|
minw = (ceil(count / (float)nmax) * sd->item_width) +
|
|
|
|
(count_group * sd->group_item_width);
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
else
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
minw = nmax * sd->item_width;
|
2016-10-04 23:36:04 -07:00
|
|
|
if (sd->custom_size_mode && (sd->custom_alloc_size > 0))
|
|
|
|
minh = sd->custom_tot_max +
|
|
|
|
(count_group * sd->group_item_height);
|
|
|
|
else
|
|
|
|
minh = (ceil(count / (float)nmax) * sd->item_height) +
|
|
|
|
(count_group * sd->group_item_height);
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if ((minw != sd->minw) || (minh != sd->minh))
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->minh = minh;
|
|
|
|
sd->minw = minw;
|
2017-01-03 21:46:46 -08:00
|
|
|
elm_layout_sizing_eval(sd->obj);
|
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);
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
sd->nmax = nmax;
|
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->calc_job = NULL;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_gengrid_pan_efl_object_destructor(Eo *obj, Elm_Gengrid_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 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_gengrid_pan_efl_gfx_entity_position_set(Eo *obj, Elm_Gengrid_Pan_Data *psd, Eina_Position2D pos)
|
2012-07-10 14:40:38 -07: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
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(psd->wsd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
psd->wsd->calc_job = ecore_job_add(_calc_job, psd->wobj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_gengrid_pan_efl_gfx_entity_size_set(Eo *obj, Elm_Gengrid_Pan_Data *psd, Eina_Size2D sz)
|
2012-07-10 14:40:38 -07: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;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_PAN_CLASS), sz);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(psd->wsd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
psd->wsd->calc_job = ecore_job_add(_calc_job, psd->wobj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_unselect(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item_Type *item = GG_IT(it);
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Data *sd = item->wsd;
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-08-21 09:10:07 -07:00
|
|
|
if ((it->generation < sd->generation) || (!it->selected))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (it->selected)
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
it->selected = EINA_FALSE;
|
2014-11-25 04:55:12 -08:00
|
|
|
sd->selected = eina_list_remove(sd->selected, eo_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_it);
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
2019-03-05 14:00:37 -08:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_TYPE_SELECTED, EINA_FALSE);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:26:13 -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:37 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
if (!elm_object_item_disabled_get(EO_OBJ(it)) &&
|
2014-04-01 04:26:13 -07:00
|
|
|
(_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN))
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2014-04-01 04:26:13 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_move_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-07-10 14:40:38 -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_x, it_scrl_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
|
|
|
Evas_Coord minw = 0, minh = 0, x, y, w, h, dx, dy, adx, ady;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-10 14:40:38 -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-10 14:40:38 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if (!sd->on_hold)
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
if (!sd->was_selected)
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -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) &&
|
2015-07-23 22:30:21 -07:00
|
|
|
!sd->reorder_it )
|
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
|
|
|
{
|
2015-07-23 22:30:21 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
if (!sd->was_selected)
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
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_FALSE;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if ((it->dragging) && (it->down))
|
|
|
|
{
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_DRAG, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!it->down) || (sd->longpressed))
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_geometry_get
|
2013-08-27 16:47:16 -07:00
|
|
|
(sd->pan_obj, &ox, &oy, &ow, &oh);
|
|
|
|
|
|
|
|
it_scrl_x = ev->cur.canvas.x - sd->reorder_it->dx;
|
|
|
|
it_scrl_y = ev->cur.canvas.y - sd->reorder_it->dy;
|
|
|
|
|
|
|
|
if (it_scrl_x < ox) sd->reorder_item_x = ox;
|
|
|
|
else if (it_scrl_x + sd->item_width > ox + ow)
|
|
|
|
sd->reorder_item_x = ox + ow - sd->item_width;
|
|
|
|
else sd->reorder_item_x = it_scrl_x;
|
|
|
|
|
|
|
|
if (it_scrl_y < oy) sd->reorder_item_y = oy;
|
|
|
|
else if (it_scrl_y + sd->item_height > oy + oh)
|
|
|
|
sd->reorder_item_y = oy + oh - sd->item_height;
|
|
|
|
else sd->reorder_item_y = it_scrl_y;
|
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
if ((adx > minw) || (ady > minh))
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
const Efl_Event_Description *left_drag, *right_drag;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
if (!efl_ui_mirrored_get(WIDGET(it)))
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2016-06-10 01:42:03 -07:00
|
|
|
left_drag = EFL_UI_EVENT_DRAG_START_LEFT;
|
|
|
|
right_drag = EFL_UI_EVENT_DRAG_START_RIGHT;
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2010-10-01 12:03:17 -07:00
|
|
|
else
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2016-06-10 01:42:03 -07:00
|
|
|
left_drag = EFL_UI_EVENT_DRAG_START_RIGHT;
|
|
|
|
right_drag = EFL_UI_EVENT_DRAG_START_LEFT;
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it->dragging = 1;
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2014-08-21 11:09:10 -07:00
|
|
|
if (!sd->was_selected)
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2012-07-10 14:40:38 -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);
|
2010-11-10 10:04:28 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (dx < 0)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), left_drag, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2010-10-01 12:03:17 -07:00
|
|
|
else
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
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);
|
2010-11-10 10:04:28 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (dx < 0)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), left_drag, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), right_drag, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-27 07:38:54 -07:00
|
|
|
static Eina_Bool
|
2012-07-10 14:40:38 -07:00
|
|
|
_long_press_cb(void *data)
|
2010-10-27 07:38:54 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2010-10-27 07:38:54 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->long_timer = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)) || (it->dragging))
|
2012-07-10 14:40:38 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
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));
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->reorder_mode)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->reorder_it = it;
|
|
|
|
evas_object_raise(VIEW(it));
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(WIDGET(it), EINA_TRUE);
|
|
|
|
elm_interface_scrollable_bounce_allow_get(WIDGET(it), &(sd->old_h_bounce), &(sd->old_v_bounce));
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(WIDGET(it), EINA_FALSE, EINA_FALSE);
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_highlight(Elm_Gen_Item *it)
|
2010-10-10 16:54:11 -07:00
|
|
|
{
|
2013-08-26 03:55:21 -07:00
|
|
|
const char *selectraise = NULL;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2013-08-26 03:55:21 -07:00
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it) ||
|
2017-01-09 20:59:42 -08:00
|
|
|
(elm_wdg_item_disabled_get(EO_OBJ(it))) ||
|
2014-08-21 08:12:40 -07:00
|
|
|
(!sd->highlight) || (it->highlighted) ||
|
2013-08-26 03:55:21 -07:00
|
|
|
(it->generation < sd->generation))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_HIGHLIGHTED, EO_OBJ(it));
|
2013-08-26 03:55:21 -07:00
|
|
|
|
|
|
|
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
|
|
|
if ((selectraise) && (!strcmp(selectraise, "on")))
|
|
|
|
evas_object_stack_above(VIEW(it), sd->stack);
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->highlighted = EINA_TRUE;
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
static void
|
|
|
|
_item_unhighlight(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
|
|
|
|
|
|
|
if (!it->highlighted ||
|
|
|
|
(it->generation < sd->generation))
|
|
|
|
return;
|
|
|
|
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENGRID_EVENT_UNHIGHLIGHTED, eo_it);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
|
|
|
|
evas_object_stack_below(VIEW(it), sd->stack);
|
|
|
|
|
|
|
|
it->highlighted = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info)
|
2010-10-10 16:54:11 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Coord x, y;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2014-12-29 02:38:17 -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-10 14:40:38 -07:00
|
|
|
if (ev->button != 1) return;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->down = 1;
|
2014-03-22 07:51:52 -07:00
|
|
|
sd->mouse_down = EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
it->dragging = 0;
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
it->dx = ev->canvas.x - x;
|
|
|
|
it->dy = ev->canvas.y - y;
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
2015-07-26 21:59:22 -07:00
|
|
|
it->base->still_in = EINA_TRUE;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
if (sd->on_hold) return;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->was_selected = it->selected;
|
2014-03-22 03:10:27 -07:00
|
|
|
it->highlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
2010-10-27 07:38:57 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_CLICKED_DOUBLE, EO_OBJ(it));
|
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENGRID_EVENT_ACTIVATED, EO_OBJ(it));
|
2010-10-27 07:38:57 -07:00
|
|
|
}
|
2013-03-20 09:39:51 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_PRESSED, EO_OBJ(it));
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->realized)
|
|
|
|
it->long_timer = ecore_timer_add
|
|
|
|
(_elm_config->longpress_timeout, _long_press_cb, it);
|
2012-01-30 02:29:51 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
it->long_timer = NULL;
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_text_realize(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *target,
|
|
|
|
Eina_List **source,
|
|
|
|
const char *parts)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
const Eina_List *l;
|
|
|
|
const char *key;
|
|
|
|
char *s;
|
2018-01-11 21:38:23 -08:00
|
|
|
char buf[256];
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
|
|
|
if (!it->itc->func.text_get) return;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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);
|
2018-01-11 21:38:23 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,visible", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(target, key, "");
|
2018-01-11 21:38:23 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hidden", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -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));
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_content_realize(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *target,
|
|
|
|
Eina_List **contents,
|
|
|
|
const char *src,
|
|
|
|
const char *parts)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *content;
|
2017-06-23 14:43:57 -07:00
|
|
|
Eina_List *source;
|
|
|
|
const char *key;
|
2018-01-11 21:38:23 -08:00
|
|
|
char buf[256];
|
2017-10-15 06:35:42 -07:00
|
|
|
ELM_GENGRID_DATA_GET(it->base->widget, sd);
|
2010-10-10 16:54:11 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (!parts)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(*contents, content)
|
|
|
|
evas_object_del(content);
|
|
|
|
}
|
2017-06-23 14:43:57 -07:00
|
|
|
if ((!it->itc->func.content_get) &&
|
|
|
|
((it->itc->version < 4) || (!it->itc->func.reusable_content_get))) return;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
source = elm_widget_stringlist_get(edje_object_data_get(target, src));
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
EINA_LIST_FREE(source, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Evas_Object *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)
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
{
|
|
|
|
if (it->itc->func.content_get)
|
|
|
|
content = it->itc->func.content_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
2018-01-11 21:38:23 -08:00
|
|
|
if (!content)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hidden", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
|
|
|
goto out;
|
|
|
|
}
|
2017-06-23 14:43:57 -07:00
|
|
|
}
|
2017-10-15 06:35:42 -07:00
|
|
|
eina_hash_add(sd->content_item_map, &content, it->base->eo_obj);
|
2017-06-23 14:43:57 -07:00
|
|
|
*contents = eina_list_append(*contents, content);
|
|
|
|
if (!edje_object_part_swallow(target, key, content))
|
|
|
|
{
|
|
|
|
ERR("%s (%p) can not be swallowed into %s",
|
|
|
|
evas_object_type_get(content), content, key);
|
2018-01-11 21:38:23 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hidden", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
2017-06-23 14:43:57 -07:00
|
|
|
evas_object_del(content);
|
|
|
|
goto out;
|
|
|
|
}
|
2018-01-11 21:38:23 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,visible", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
|
|
|
|
2018-06-12 01:56:43 -07:00
|
|
|
if (elm_widget_is(content))
|
|
|
|
{
|
|
|
|
_elm_widget_full_eval(content);
|
|
|
|
}
|
|
|
|
|
2019-03-07 20:18:05 -08:00
|
|
|
elm_widget_sub_object_add(WIDGET(it), content);
|
2017-06-23 14:43:57 -07:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
|
|
|
elm_widget_disabled_set(content, EINA_TRUE);
|
2017-11-10 06:24:19 -08:00
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
out:
|
|
|
|
if (old && content != old)
|
|
|
|
{
|
|
|
|
*contents = eina_list_remove(*contents, old);
|
|
|
|
evas_object_del(old);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_state_realize(Elm_Gen_Item *it, Evas_Object *target, const char *parts)
|
|
|
|
{
|
|
|
|
Eina_List *src;
|
|
|
|
const char *key;
|
|
|
|
char buf[4096];
|
|
|
|
|
|
|
|
if (!it->itc->func.state_get) return;
|
|
|
|
|
|
|
|
src = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
|
|
|
|
EINA_LIST_FREE(src, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD)) continue;
|
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
edje_object_message_signal_process(target);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_view_inflate(Evas_Object *view, Elm_Gen_Item *it, Eina_List **sources,
|
|
|
|
Eina_List **contents)
|
|
|
|
{
|
|
|
|
if (!view) return;
|
|
|
|
if (sources) _item_text_realize(it, view, sources, NULL);
|
|
|
|
if (contents) _item_content_realize(it, view, contents, "contents", NULL);
|
|
|
|
_item_state_realize(it, view, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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];
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
snprintf(buf, sizeof(buf), "item/%s", style ? style : "default");
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error th_ret =
|
2017-06-01 18:32:04 -07:00
|
|
|
elm_widget_theme_object_set(WIDGET(it), view, "gengrid", buf,
|
|
|
|
elm_widget_style_get(WIDGET(it)));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (th_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
{
|
|
|
|
ERR("%s is not a valid gengrid item style. "
|
|
|
|
"Automatically falls back into default style.",
|
|
|
|
style);
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(WIDGET(it), view, "gengrid", "item/default", "default");
|
|
|
|
}
|
|
|
|
|
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)) *
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
elm_config_scale_get());
|
|
|
|
evas_object_stack_below(view, sd->stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)));
|
|
|
|
evas_object_smart_member_add(view, GG_IT(it)->wsd->pan_obj);
|
|
|
|
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)) *
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
elm_config_scale_get());
|
|
|
|
|
|
|
|
_view_style_update(it, view, style);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_view_clear(Evas_Object *view, Eina_List **texts, Eina_List **contents)
|
|
|
|
{
|
|
|
|
const char *part;
|
|
|
|
Evas_Object *c;
|
|
|
|
const Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(*texts, l, part)
|
|
|
|
edje_object_part_text_set(view, part, NULL);
|
|
|
|
ELM_SAFE_FREE(*texts, elm_widget_stringlist_free);
|
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
if (!contents) return;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
EINA_LIST_FREE(*contents, c)
|
|
|
|
evas_object_del(c);
|
|
|
|
}
|
|
|
|
|
2016-02-15 22:28:45 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, Eina_List **l)
|
|
|
|
{
|
|
|
|
Evas_Object *content;
|
|
|
|
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
2017-10-15 06:35:42 -07:00
|
|
|
ELM_GENGRID_DATA_GET(it->base->widget, sd);
|
2016-02-15 22:28:45 -08:00
|
|
|
|
|
|
|
EINA_LIST_FREE (it->contents, content)
|
|
|
|
{
|
2019-03-07 20:18:05 -08:00
|
|
|
_elm_widget_sub_object_redirect_to_top(WIDGET(it), content);
|
2016-02-15 22:28:45 -08:00
|
|
|
// edje can be reused by item caching,
|
|
|
|
// content should be un-swallowed from edje
|
|
|
|
edje_object_part_unswallow(VIEW(it), content);
|
|
|
|
evas_object_hide(content);
|
|
|
|
if (l) *l = eina_list_append(*l, content);
|
2017-10-15 06:35:42 -07:00
|
|
|
|
|
|
|
eina_hash_del_by_key(sd->content_item_map, &content);
|
2016-02-15 22:28:45 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
static void
|
|
|
|
_elm_gengrid_item_unrealize(Elm_Gen_Item *it,
|
|
|
|
Eina_Bool calc)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!it->realized) return;
|
|
|
|
if (GG_IT(it)->wsd->reorder_it == it) return;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2012-07-10 14:40:38 -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_GENGRID_EVENT_UNREALIZED, EO_OBJ(it));
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
_view_clear(VIEW(it), &(it->texts), NULL);
|
2010-10-05 12:09:58 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
ELM_SAFE_FREE(it->states, elm_widget_stringlist_free);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_track_cancel(EO_OBJ(it));
|
2013-09-13 00:20:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->unrealize_cb(it);
|
2010-10-27 07:38:57 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->realized = EINA_FALSE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
2013-09-12 22:19:41 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -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-10 14:40:38 -07:00
|
|
|
void *event_info)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
|
|
|
Eina_Bool dragged = EINA_FALSE;
|
|
|
|
Elm_Gen_Item *it = data;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-12-29 02:38:17 -08:00
|
|
|
Evas_Coord x, y, dx, dy;
|
|
|
|
|
|
|
|
if ((ev->button == 3) && (!it->dragging))
|
|
|
|
{
|
|
|
|
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-29 02:38:17 -08:00
|
|
|
return;
|
|
|
|
}
|
2010-10-27 07:38:57 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->button != 1) return;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->down = EINA_FALSE;
|
2014-03-22 07:51:52 -07:00
|
|
|
sd->mouse_down = EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2010-10-05 12:09:58 -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_GENGRID_EVENT_RELEASED, eo_it);
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->dragging)
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
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_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
dragged = EINA_TRUE;
|
2010-10-01 12:03:17 -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
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->reorder_mode) &&
|
|
|
|
(sd->reorder_it))
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-02-24 20:13:21 -08:00
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_MOVED, EO_OBJ(sd->reorder_it));
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->reorder_it = NULL;
|
|
|
|
sd->move_effect_enabled = EINA_FALSE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->calc_job =
|
2013-04-24 04:41:37 -07:00
|
|
|
ecore_job_add(_calc_job, sd->obj);
|
2010-10-01 12:03:17 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(WIDGET(it), EINA_FALSE);
|
|
|
|
elm_interface_scrollable_bounce_allow_set(WIDGET(it), sd->old_h_bounce, sd->old_v_bounce);
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
|
|
|
|
}
|
|
|
|
if (sd->longpressed)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
if (!sd->was_selected)
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->was_selected = EINA_FALSE;
|
|
|
|
return;
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (dragged)
|
|
|
|
{
|
|
|
|
if (it->want_unrealize)
|
|
|
|
_elm_gengrid_item_unrealize(it, EINA_FALSE);
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it)) return;
|
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
|
|
|
|
2015-07-23 22:30:21 -07:00
|
|
|
if (sd->on_hold || !it->base->still_in)
|
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->longpressed = EINA_FALSE;
|
|
|
|
sd->on_hold = EINA_FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2016-01-24 07:11:13 -08:00
|
|
|
if ((ev->flags == EVAS_BUTTON_NONE) && (sd->focused_item != eo_it))
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2016-05-29 22:39:36 -07:00
|
|
|
else if (ev->flags == EVAS_BUTTON_NONE)
|
|
|
|
{
|
|
|
|
switch (_elm_config->focus_autoscroll_mode)
|
|
|
|
{
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
|
|
|
|
elm_gengrid_item_show
|
|
|
|
(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
|
|
|
break;
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
|
|
|
|
elm_gengrid_item_bring_in
|
|
|
|
(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
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-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
2014-03-22 03:10:27 -07:00
|
|
|
it->highlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
2014-09-27 22:15:37 -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_GENGRID_ITEM_CLASS);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb(sel);
|
2014-09-27 22:15:37 -07:00
|
|
|
it->unsel_cb(sel);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item2;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
if (item2 != it)
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(item2);
|
|
|
|
it->unsel_cb(item2);
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-03-22 03:10:27 -07:00
|
|
|
it->highlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
2010-09-09 18:40:50 -07:00
|
|
|
}
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_callbacks_add(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in_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_MOUSE_DOWN, _item_mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_mouse_callbacks_del(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in_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_MOUSE_DOWN, _item_mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-09 18:40:50 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_index_update(Elm_Gen_Item *it)
|
2010-09-09 18:40:50 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->position_update)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_INDEX_UPDATE, EO_OBJ(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
it->position_update = EINA_FALSE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2017-06-23 14:43:57 -07:00
|
|
|
static Eina_List *
|
|
|
|
_content_cache_add(Elm_Gen_Item *it, Eina_List **cache)
|
|
|
|
{
|
|
|
|
Evas_Object *content = NULL;
|
2017-10-15 06:35:42 -07:00
|
|
|
ELM_GENGRID_DATA_GET(it->base->widget, sd);
|
2017-06-23 14:43:57 -07:00
|
|
|
EINA_LIST_FREE(it->contents, content)
|
|
|
|
{
|
|
|
|
*cache = eina_list_append(*cache, content);
|
2017-10-15 06:35:42 -07:00
|
|
|
eina_hash_del_by_key(sd->content_item_map, &content);
|
2017-06-23 14:43:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return *cache;
|
|
|
|
}
|
|
|
|
|
2010-09-09 15:01:30 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_unrealize_cb(Elm_Gen_Item *it)
|
2010-09-09 15:01:30 -07:00
|
|
|
{
|
2017-06-23 14:43:57 -07:00
|
|
|
Eina_List *cache = NULL;
|
|
|
|
Evas_Object *c;
|
|
|
|
if (!_item_cache_add(it, _content_cache_add(it, &cache)))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(VIEW(it), evas_object_del);
|
|
|
|
ELM_SAFE_FREE(it->spacer, evas_object_del);
|
2017-06-23 14:43:57 -07:00
|
|
|
EINA_LIST_FREE(cache, c)
|
|
|
|
evas_object_del(c);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
}
|
2010-09-09 15:01:30 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
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);
|
2012-08-18 06:52:03 -07:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:37 -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_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
evas_object_geometry_get(it->base->view, &x, &y, &w, &h);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2014-09-27 22:15:37 -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:37 -07:00
|
|
|
elm_gengrid_item_bring_in(EO_OBJ(it),
|
2012-08-18 06:52:03 -07:00
|
|
|
ELM_GENGRID_ITEM_SCROLLTO_IN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_widget_item_register(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Access_Info *ai;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_access_widget_item_register(it->base);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2014-09-27 22:15:37 -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);
|
|
|
|
}
|
|
|
|
|
2015-06-25 07:38:28 -07:00
|
|
|
static void
|
2015-09-23 00:15:56 -07:00
|
|
|
_elm_gengrid_item_focus_update(Elm_Gen_Item *it)
|
2015-06-25 07:38:28 -07:00
|
|
|
{
|
|
|
|
const char *focus_raise;
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
2019-02-27 11:00:39 -08:00
|
|
|
Evas_Object *win = elm_widget_top_get(obj);
|
2015-06-25 07:38:28 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
2019-02-27 11:00:39 -08:00
|
|
|
if (elm_win_focus_highlight_enabled_get(win) || _elm_config->win_auto_focus_enable)
|
2015-06-25 07:38:28 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,focused", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
focus_raise = edje_object_data_get(VIEW(it), "focusraise");
|
|
|
|
if ((focus_raise) && (!strcmp(focus_raise, "on")))
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it1;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
EINA_LIST_FOREACH(sd->group_items, l, it1)
|
|
|
|
{
|
|
|
|
if (GG_IT(it1)->group_realized)
|
|
|
|
evas_object_raise(VIEW(it1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-03 18:24:08 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_realize(Elm_Gen_Item *it)
|
2011-10-03 18:24:08 -07:00
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2011-10-03 18:24:08 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((it->realized) ||
|
2013-08-27 16:47:16 -07:00
|
|
|
(it->generation < sd->generation))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2011-10-03 18:24:08 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (!_item_cache_find(it))
|
2014-01-08 02:07:07 -08:00
|
|
|
{
|
2018-05-07 15:16:29 -07:00
|
|
|
VIEW_SET(it, _view_create(it, it->itc->item_style));
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (it->item->nocache_once)
|
|
|
|
it->item->nocache_once = EINA_FALSE;
|
2014-01-08 02:07:07 -08:00
|
|
|
}
|
2013-08-26 03:55:21 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (it->spacer && edje_object_part_exists(VIEW(it), "elm.swallow.pad"))
|
2013-09-05 21:08:21 -07:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1);
|
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2013-01-10 04:00:05 -08:00
|
|
|
/* access */
|
|
|
|
if (_elm_config->access_mode) _access_widget_item_register(it);
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
/* infate texts, contents and states of view object */
|
|
|
|
_view_inflate(VIEW(it), it, &it->texts, &it->contents);
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!sd->group_item_width)
|
|
|
|
&& (!sd->group_item_height))
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), &sd->group_item_width,
|
|
|
|
&sd->group_item_height,
|
|
|
|
sd->group_item_width,
|
|
|
|
sd->group_item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!sd->item_width)
|
|
|
|
&& (!sd->item_height))
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), &sd->item_width,
|
|
|
|
&sd->item_height,
|
|
|
|
sd->item_width,
|
|
|
|
sd->item_height);
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_coords_finger_size_adjust
|
2013-08-27 16:47:16 -07:00
|
|
|
(1, &sd->item_width, 1,
|
|
|
|
&sd->item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_mouse_callbacks_add(it, VIEW(it));
|
2012-03-07 05:58:30 -08:00
|
|
|
_elm_gengrid_item_index_update(it);
|
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
if (it->selected)
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it))
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2013-09-09 02:53:47 -07:00
|
|
|
edje_object_message_signal_process(VIEW(it));
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_show(VIEW(it));
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
if (it->tooltip.content_cb)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set(eo_it, it->tooltip.content_cb, it->tooltip.data, NULL);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
if (it->mouse_cursor)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_set(eo_it, it->mouse_cursor);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2015-04-14 03:20:16 -07:00
|
|
|
if (it->cursor_engine_only)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_engine_only_set(eo_it, it->cursor_engine_only);
|
2015-04-14 03:20:16 -07:00
|
|
|
|
2015-03-11 03:59:58 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
|
|
|
{
|
2015-09-23 00:15:56 -07:00
|
|
|
_elm_gengrid_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));
|
|
|
|
}
|
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
it->realized = EINA_TRUE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2011-06-14 01:36:03 -07:00
|
|
|
static Eina_Bool
|
2012-03-30 05:31:01 -07:00
|
|
|
_reorder_item_move_animator_cb(void *data)
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
2011-06-14 01:36:03 -07:00
|
|
|
Evas_Coord dx, dy;
|
2012-07-10 14:40:38 -07:00
|
|
|
double tt, t;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2011-06-14 01:36:03 -07:00
|
|
|
|
2012-02-21 15:59:25 -08:00
|
|
|
tt = REORDER_EFFECT_TIME;
|
2012-07-10 14:40:38 -07:00
|
|
|
t = ((0.0 > (t = ecore_loop_time_get() -
|
|
|
|
GG_IT(it)->moving_effect_start_time)) ? 0.0 : t);
|
|
|
|
dx = ((GG_IT(it)->tx - GG_IT(it)->ox) / 10)
|
|
|
|
* elm_config_scale_get();
|
|
|
|
dy = ((GG_IT(it)->ty - GG_IT(it)->oy) / 10)
|
|
|
|
* elm_config_scale_get();
|
2011-06-14 01:36:03 -07:00
|
|
|
|
2012-02-21 15:59:25 -08:00
|
|
|
if (t <= tt)
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
GG_IT(it)->rx += (1 * sin((t / tt) * (M_PI / 2)) * dx);
|
|
|
|
GG_IT(it)->ry += (1 * sin((t / tt) * (M_PI / 2)) * dy);
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
GG_IT(it)->rx += dx;
|
|
|
|
GG_IT(it)->ry += dy;
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
|
2015-01-08 02:36:19 -08:00
|
|
|
if (((dx > 0) && (GG_IT(it)->rx >= GG_IT(it)->tx)) ||
|
|
|
|
((dx <= 0) && (GG_IT(it)->rx <= GG_IT(it)->tx))
|
|
|
|
|| ((dy > 0) && (GG_IT(it)->ry >= GG_IT(it)->ty)) ||
|
|
|
|
((dy <= 0) && (GG_IT(it)->ry <= GG_IT(it)->ty)))
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_move(VIEW(it), GG_IT(it)->tx, GG_IT(it)->ty);
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw, vh;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get
|
2013-08-27 16:47:16 -07:00
|
|
|
(sd->pan_obj, NULL, NULL, &vw, &vh);
|
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_resize
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), sd->group_item_width, vh);
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_resize
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), vw, sd->group_item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_resize(VIEW(it), sd->item_width, sd->item_height);
|
2012-07-10 14:40:38 -07:00
|
|
|
GG_IT(it)->moving = EINA_FALSE;
|
|
|
|
GG_IT(it)->item_reorder_move_animator = NULL;
|
|
|
|
|
2011-06-14 01:36:03 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_move(VIEW(it), GG_IT(it)->rx, GG_IT(it)->ry);
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw, vh;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
|
|
|
|
if (sd->horizontal)
|
|
|
|
evas_object_resize(VIEW(it), sd->group_item_width, vh);
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_resize(VIEW(it), vw, sd->group_item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_resize(VIEW(it), sd->item_width, sd->item_height);
|
2011-06-14 01:36:03 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2011-09-09 05:43:34 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_place(Elm_Gen_Item *it,
|
|
|
|
Evas_Coord cx,
|
|
|
|
Evas_Coord cy)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2017-01-24 20:11:08 -08:00
|
|
|
Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh, iw, ih;
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh;
|
|
|
|
Eina_Bool reorder_item_move_forward = EINA_FALSE;
|
2016-10-04 23:36:04 -07:00
|
|
|
Eina_Bool was_realized, can_resize;
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item_Type *item;
|
|
|
|
long items_count;
|
2014-05-14 20:13:23 -07:00
|
|
|
int item_pos;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
item = GG_IT(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, wsd);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it->x = cx;
|
|
|
|
it->y = cy;
|
|
|
|
evas_object_geometry_get(wsd->pan_obj, &ox, &oy, &vw, &vh);
|
|
|
|
|
|
|
|
/* Preload rows/columns at each side of the Gengrid */
|
|
|
|
cvx = ox - PRELOAD * wsd->item_width;
|
|
|
|
cvy = oy - PRELOAD * wsd->item_height;
|
|
|
|
cvw = vw + 2 * PRELOAD * wsd->item_width;
|
|
|
|
cvh = vh + 2 * PRELOAD * wsd->item_height;
|
|
|
|
|
|
|
|
items_count = wsd->item_count -
|
|
|
|
eina_list_count(wsd->group_items) + wsd->items_lost;
|
|
|
|
if (wsd->horizontal)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2010-11-10 15:59:59 -08:00
|
|
|
int columns, items_visible = 0, items_row;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->item_height > 0)
|
|
|
|
items_visible = vh / wsd->item_height;
|
2010-10-08 18:42:32 -07:00
|
|
|
if (items_visible < 1)
|
2010-12-10 05:01:43 -08:00
|
|
|
items_visible = 1;
|
2010-10-08 18:42:32 -07:00
|
|
|
|
2011-09-09 05:43:34 -07:00
|
|
|
columns = items_count / items_visible;
|
|
|
|
if (items_count % items_visible)
|
2010-12-10 05:01:43 -08:00
|
|
|
columns++;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2016-10-04 23:36:04 -07:00
|
|
|
/* If custom sizes cannot be applied to items
|
|
|
|
* of a row use default item size. */
|
|
|
|
can_resize = (wsd->custom_size_mode && (cy < (Evas_Coord)wsd->custom_alloc_size));
|
|
|
|
if (can_resize)
|
|
|
|
tcw = wsd->custom_tot_sum[cy];
|
|
|
|
else
|
|
|
|
tcw = (wsd->item_width * columns) + (wsd->group_item_width *
|
|
|
|
eina_list_count(wsd->group_items));
|
2012-07-10 14:40:38 -07:00
|
|
|
alignw = (vw - tcw) * wsd->align_x;
|
2010-11-23 12:30:48 -08:00
|
|
|
|
2010-10-10 18:55:07 -07:00
|
|
|
items_row = items_visible;
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((unsigned int)items_row > wsd->item_count)
|
|
|
|
items_row = wsd->item_count;
|
|
|
|
if (wsd->filled && (unsigned int)wsd->nmax
|
|
|
|
> (unsigned int)wsd->item_count)
|
|
|
|
tch = wsd->nmax * wsd->item_height;
|
|
|
|
else
|
|
|
|
tch = items_row * wsd->item_height;
|
|
|
|
alignh = (vh - tch) * wsd->align_y;
|
2014-05-14 20:13:23 -07:00
|
|
|
item_pos = items_row * cx + cy + 1;
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
if (item_pos != it->position && !it->position_update)
|
2014-05-14 20:13:23 -07:00
|
|
|
{
|
|
|
|
it->position = item_pos;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2010-10-10 18:55:07 -07:00
|
|
|
else
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-02-21 15:59:25 -08:00
|
|
|
unsigned int rows, items_visible = 0, items_col;
|
2010-10-08 18:42:32 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->item_width > 0)
|
|
|
|
items_visible = vw / wsd->item_width;
|
2010-10-08 18:42:32 -07:00
|
|
|
if (items_visible < 1)
|
2010-12-10 05:01:43 -08:00
|
|
|
items_visible = 1;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2011-09-09 05:43:34 -07:00
|
|
|
rows = items_count / items_visible;
|
|
|
|
if (items_count % items_visible)
|
2010-12-10 05:01:43 -08:00
|
|
|
rows++;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2016-10-04 23:36:04 -07:00
|
|
|
/* If custom sizes cannot be applied to items
|
|
|
|
* of a column use to default item size. */
|
|
|
|
can_resize = (wsd->custom_size_mode && (cx < (Evas_Coord)wsd->custom_alloc_size));
|
|
|
|
if (can_resize)
|
|
|
|
tch = wsd->custom_tot_sum[cx];
|
|
|
|
else
|
|
|
|
tch = (wsd->item_height * rows) + (wsd->group_item_height *
|
|
|
|
eina_list_count(wsd->group_items));
|
2012-07-10 14:40:38 -07:00
|
|
|
alignh = (vh - tch) * wsd->align_y;
|
2010-11-23 12:30:48 -08:00
|
|
|
|
2010-10-10 18:55:07 -07:00
|
|
|
items_col = items_visible;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (items_col > wsd->item_count)
|
|
|
|
items_col = wsd->item_count;
|
|
|
|
if (wsd->filled && (unsigned int)wsd->nmax
|
|
|
|
> (unsigned int)wsd->item_count)
|
|
|
|
tcw = wsd->nmax * wsd->item_width;
|
|
|
|
else
|
|
|
|
tcw = items_col * wsd->item_width;
|
|
|
|
alignw = (vw - tcw) * wsd->align_x;
|
2014-05-14 20:13:23 -07:00
|
|
|
item_pos = cx + items_col * cy + 1;
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
if (item_pos != it->position && !it->position_update)
|
2014-05-14 20:13:23 -07:00
|
|
|
{
|
|
|
|
it->position = item_pos;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2010-10-10 18:55:07 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
x = (((cx - item->prev_group) * wsd->item_width)
|
|
|
|
+ (item->prev_group * wsd->group_item_width)) -
|
|
|
|
wsd->pan_x + ox + alignw;
|
2011-11-30 03:03:22 -08:00
|
|
|
y = oy;
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = wsd->group_item_width;
|
2011-09-09 05:43:34 -07:00
|
|
|
ih = vh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-30 03:03:22 -08:00
|
|
|
x = ox;
|
2012-07-10 14:40:38 -07:00
|
|
|
y = (((cy - item->prev_group) * wsd->item_height)
|
|
|
|
+ (item->prev_group * wsd->group_item_height))
|
|
|
|
- wsd->pan_y + oy + alignh;
|
2011-09-09 05:43:34 -07:00
|
|
|
iw = vw;
|
2012-07-10 14:40:38 -07:00
|
|
|
ih = wsd->group_item_height;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
item->gx = x;
|
|
|
|
item->gy = y;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
if (can_resize)
|
|
|
|
{
|
|
|
|
if (cx == 0) wsd->custom_size_sum[cy] = 0;
|
|
|
|
x = ((item->prev_group * wsd->item_width)
|
|
|
|
+ (item->prev_group * wsd->group_item_width)) -
|
|
|
|
wsd->pan_x + ox + alignw + wsd->custom_size_sum[cy];
|
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(WIDGET(it)))
|
2016-10-04 23:36:04 -07:00
|
|
|
it->item->sw = wsd->custom_tot_sum[cy] - wsd->custom_size_sum[cy] - it->item->w;
|
|
|
|
else
|
|
|
|
it->item->sw = wsd->custom_size_sum[cy];
|
|
|
|
|
|
|
|
wsd->custom_size_sum[cy] += it->item->w;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = (((cx - item->prev_group) * wsd->item_width)
|
|
|
|
+ (item->prev_group * wsd->group_item_width)) -
|
|
|
|
wsd->pan_x + ox + alignw;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
y = (cy * wsd->item_height) - wsd->pan_y + oy + alignh;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
if (can_resize)
|
|
|
|
{
|
|
|
|
if (cy == 0) wsd->custom_size_sum[cx] = 0;
|
|
|
|
y = ((item->prev_group * wsd->item_height)
|
|
|
|
+ (item->prev_group * wsd->group_item_height)) -
|
|
|
|
wsd->pan_y + oy + alignh + wsd->custom_size_sum[cx];
|
|
|
|
|
|
|
|
it->item->sh = wsd->custom_size_sum[cx];
|
|
|
|
wsd->custom_size_sum[cx] += it->item->h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
y = (((cy - item->prev_group)
|
|
|
|
* wsd->item_height) + (item->prev_group *
|
|
|
|
wsd->group_item_height)) -
|
|
|
|
wsd->pan_y + oy + alignh;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
x = (cx * wsd->item_width) - wsd->pan_x + ox + alignw;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(WIDGET(it))) /* Switch items side
|
2012-07-10 14:40:38 -07:00
|
|
|
* and componsate for
|
|
|
|
* pan_x when in RTL
|
|
|
|
* mode */
|
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
if (wsd->horizontal && can_resize)
|
2017-01-24 20:11:08 -08:00
|
|
|
x = vw - x - it->item->w - wsd->pan_x - wsd->pan_x + ox + ox;
|
2016-10-04 23:36:04 -07:00
|
|
|
else
|
2017-01-24 20:11:08 -08:00
|
|
|
x = vw - x - wsd->item_width - wsd->pan_x - wsd->pan_x + ox + ox;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2016-10-04 23:36:04 -07:00
|
|
|
iw = (wsd->horizontal && can_resize) ? it->item->w : wsd->item_width;
|
|
|
|
ih = (!wsd->horizontal && can_resize) ? it->item->h : wsd->item_height;
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
was_realized = it->realized;
|
2011-09-09 05:43:34 -07:00
|
|
|
if (ELM_RECTS_INTERSECT(x, y, iw, ih, cvx, cvy, cvw, cvh))
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2011-10-20 14:41:24 -07:00
|
|
|
_item_realize(it);
|
2010-12-10 05:01:43 -08:00
|
|
|
if (!was_realized)
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
{
|
|
|
|
_elm_gengrid_item_index_update(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_GENGRID_EVENT_REALIZED, EO_OBJ(it));
|
2018-11-13 08:36:31 -08:00
|
|
|
_flush_focus_on_realization(WIDGET(it), it);
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
}
|
2011-10-20 15:23:48 -07:00
|
|
|
if (it->parent)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gx < ox)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
if (wsd->custom_size_mode)
|
|
|
|
it->parent->item->gx = x + it->item->w -
|
|
|
|
wsd->group_item_width;
|
|
|
|
else
|
|
|
|
it->parent->item->gx = x + wsd->item_width -
|
|
|
|
wsd->group_item_width;
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gx > ox)
|
|
|
|
it->parent->item->gx = ox;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2011-11-30 03:03:22 -08:00
|
|
|
it->parent->item->group_realized = EINA_TRUE;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gy < oy)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2016-10-04 23:36:04 -07:00
|
|
|
if (wsd->custom_size_mode)
|
|
|
|
it->parent->item->gy = y + it->item->h -
|
|
|
|
wsd->group_item_height;
|
|
|
|
else
|
|
|
|
it->parent->item->gy = y + wsd->item_height -
|
|
|
|
wsd->group_item_height;
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gy > oy)
|
|
|
|
it->parent->item->gy = oy;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
it->parent->item->group_realized = EINA_TRUE;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->reorder_mode)
|
2011-06-02 00:09:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->reorder_it)
|
2011-06-02 00:09:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (item->moving) return;
|
2011-10-03 17:59:18 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!wsd->move_effect_enabled)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
item->ox = x;
|
|
|
|
item->oy = y;
|
2011-10-03 17:59:18 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->reorder_it == it)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2018-11-21 08:05:41 -08:00
|
|
|
evas_object_geometry_set(VIEW(it), wsd->reorder_item_x,
|
|
|
|
wsd->reorder_item_y, iw, ih);
|
2011-10-03 17:59:18 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord nx, ny, nw, nh;
|
|
|
|
|
|
|
|
if (wsd->move_effect_enabled)
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((item->ox != x) || (item->oy != y))
|
|
|
|
if (((wsd->old_pan_x == wsd->pan_x)
|
|
|
|
&& (wsd->old_pan_y == wsd->pan_y))
|
|
|
|
|| ((wsd->old_pan_x != wsd->pan_x) &&
|
|
|
|
!(item->ox - wsd->pan_x
|
|
|
|
+ wsd->old_pan_x == x)) ||
|
|
|
|
((wsd->old_pan_y != wsd->pan_y) &&
|
|
|
|
!(item->oy - wsd->pan_y +
|
|
|
|
wsd->old_pan_y == y)))
|
|
|
|
{
|
|
|
|
item->tx = x;
|
|
|
|
item->ty = y;
|
|
|
|
item->rx = item->ox;
|
|
|
|
item->ry = item->oy;
|
|
|
|
item->moving = EINA_TRUE;
|
|
|
|
item->moving_effect_start_time =
|
|
|
|
ecore_loop_time_get();
|
|
|
|
item->item_reorder_move_animator =
|
2018-09-18 07:42:58 -07:00
|
|
|
ecore_evas_animator_add
|
|
|
|
(it->item->wsd->obj, _reorder_item_move_animator_cb, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
}
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
|
2011-10-03 17:59:18 -07:00
|
|
|
/* need fix here */
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
nx = x + (wsd->group_item_width / 2);
|
2011-10-03 17:59:18 -07:00
|
|
|
ny = y;
|
|
|
|
nw = 1;
|
|
|
|
nh = vh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nx = x;
|
2012-07-10 14:40:38 -07:00
|
|
|
ny = y + (wsd->group_item_height / 2);
|
2011-10-03 17:59:18 -07:00
|
|
|
nw = vw;
|
|
|
|
nh = 1;
|
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
nx = x + (wsd->item_width / 2);
|
|
|
|
ny = y + (wsd->item_height / 2);
|
2011-10-03 17:59:18 -07:00
|
|
|
nw = 1;
|
2011-09-09 05:43:34 -07:00
|
|
|
nh = 1;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ELM_RECTS_INTERSECT
|
|
|
|
(wsd->reorder_item_x, wsd->reorder_item_y,
|
|
|
|
wsd->item_width, wsd->item_height,
|
|
|
|
nx, ny, nw, nh))
|
2011-06-02 00:09:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((wsd->nmax * wsd->reorder_it->x +
|
|
|
|
wsd->reorder_it->y) >
|
|
|
|
(wsd->nmax * it->x + it->y))
|
2011-10-03 17:59:18 -07:00
|
|
|
reorder_item_move_forward = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((wsd->nmax * wsd->reorder_it->y +
|
|
|
|
wsd->reorder_it->x) >
|
|
|
|
(wsd->nmax * it->y + it->x))
|
2011-10-03 17:59:18 -07:00
|
|
|
reorder_item_move_forward = EINA_TRUE;
|
|
|
|
}
|
2011-06-02 00:09:17 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->items = eina_inlist_remove
|
|
|
|
(wsd->items,
|
|
|
|
EINA_INLIST_GET(wsd->reorder_it));
|
2011-10-03 17:59:18 -07:00
|
|
|
if (reorder_item_move_forward)
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->items = eina_inlist_prepend_relative
|
|
|
|
(wsd->items,
|
|
|
|
EINA_INLIST_GET(wsd->reorder_it),
|
|
|
|
EINA_INLIST_GET(it));
|
2011-10-03 17:59:18 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->items = eina_inlist_append_relative
|
|
|
|
(wsd->items,
|
|
|
|
EINA_INLIST_GET(wsd->reorder_it),
|
|
|
|
EINA_INLIST_GET(it));
|
|
|
|
|
|
|
|
wsd->reorder_item_changed = EINA_TRUE;
|
|
|
|
wsd->move_effect_enabled = EINA_TRUE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(wsd->calc_job);
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->calc_job =
|
2013-04-24 04:41:37 -07:00
|
|
|
ecore_job_add(_calc_job, wsd->obj);
|
2011-10-03 17:59:18 -07:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
else if (item->item_reorder_move_animator)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(item->item_reorder_move_animator,
|
2013-05-23 08:58:38 -07:00
|
|
|
ecore_animator_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
item->moving = EINA_FALSE;
|
2011-10-03 17:59:18 -07:00
|
|
|
}
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2018-11-21 08:05:41 -08:00
|
|
|
evas_object_geometry_set(VIEW(it), x, y, iw, ih);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
item->group_realized = EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
else
|
2010-11-03 11:30:48 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_unrealize(it, EINA_FALSE);
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
item->group_realized = EINA_FALSE;
|
2010-11-03 11:30:48 -07:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2012-03-07 05:58:30 -08:00
|
|
|
static void
|
2014-04-01 04:50:40 -07:00
|
|
|
_group_item_place(Elm_Gengrid_Pan_Data *psd)
|
2012-03-07 05:58:30 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord iw, ih, vw, vh;
|
|
|
|
Eina_Bool was_realized;
|
2012-03-07 05:58:30 -08:00
|
|
|
Elm_Gen_Item *it;
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_List *l;
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_geometry_get(psd->wsd->pan_obj, NULL, NULL, &vw, &vh);
|
|
|
|
if (psd->wsd->horizontal)
|
2012-03-07 05:58:30 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = psd->wsd->group_item_width;
|
|
|
|
ih = vh;
|
2012-03-07 05:58:30 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = vw;
|
|
|
|
ih = psd->wsd->group_item_height;
|
|
|
|
}
|
2015-06-25 07:38:28 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(psd->wsd->group_items, l, it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
was_realized = it->realized;
|
|
|
|
if (GG_IT(it)->group_realized)
|
|
|
|
{
|
|
|
|
_item_realize(it);
|
|
|
|
if (!was_realized)
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
{
|
|
|
|
_elm_gengrid_item_index_update(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_GENGRID_EVENT_REALIZED, EO_OBJ(it));
|
2018-11-13 08:36:31 -08:00
|
|
|
_flush_focus_on_realization(WIDGET(it), it);
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
}
|
2018-11-21 08:05:41 -08:00
|
|
|
evas_object_geometry_set(VIEW(it), GG_IT(it)->gx, GG_IT(it)->gy,
|
|
|
|
iw, ih);
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_gengrid_item_unrealize(it, EINA_FALSE);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_gengrid_pan_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord cx = 0, cy = 0;
|
|
|
|
Elm_Gen_Item *it;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Data *sd = psd->wsd;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
if (!sd->nmax) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->reorder_item_changed = EINA_FALSE;
|
2010-10-08 18:42:32 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (cy)
|
|
|
|
{
|
|
|
|
cx++;
|
|
|
|
cy = 0;
|
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (cx)
|
|
|
|
{
|
|
|
|
cx = 0;
|
|
|
|
cy++;
|
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
}
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_place(it, cx, cy);
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->reorder_item_changed) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->group)
|
2011-03-03 05:01:39 -08:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
cx++;
|
|
|
|
cy = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cx = 0;
|
|
|
|
cy++;
|
|
|
|
}
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
cy = (cy + 1) % sd->nmax;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!cy) cx++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
cx = (cx + 1) % sd->nmax;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!cx) cy++;
|
|
|
|
}
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
_group_item_place(psd);
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (!sd->reorder_item_changed)
|
2011-03-03 05:01:39 -08:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->old_pan_x = sd->pan_x;
|
|
|
|
sd->old_pan_y = sd->pan_y;
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->move_effect_enabled = EINA_FALSE;
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
2018-09-18 17:21:31 -07:00
|
|
|
if (sd->show_region || sd->bring_in)
|
|
|
|
_item_show_region(sd);
|
2013-01-03 04:03:55 -08: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);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (sd->focused_item)
|
|
|
|
_elm_widget_focus_highlight_start(psd->wobj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_elm_pan_pos_set(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord x, Evas_Coord y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((x == psd->wsd->pan_x) && (y == psd->wsd->pan_y)) return;
|
|
|
|
psd->wsd->pan_x = x;
|
|
|
|
psd->wsd->pan_y = y;
|
|
|
|
evas_object_smart_changed(obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_pan_elm_pan_pos_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (x) *x = psd->wsd->pan_x;
|
|
|
|
if (y) *y = psd->wsd->pan_y;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_pan_elm_pan_content_size_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd, Evas_Coord *w, Evas_Coord *h)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (w) *w = psd->wsd->minw;
|
|
|
|
if (h) *h = psd->wsd->minh;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_pan_elm_pan_pos_max_get(const Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ow, oh;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
|
|
|
|
if (x)
|
2012-07-10 14:40:38 -07:00
|
|
|
*x = (ow < psd->wsd->minw) ? psd->wsd->minw - ow : 0;
|
2010-06-03 05:53:14 -07:00
|
|
|
if (y)
|
2012-07-10 14:40:38 -07:00
|
|
|
*y = (oh < psd->wsd->minh) ? psd->wsd->minh - oh : 0;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_pan_elm_pan_pos_min_get(const Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-11-23 12:30:48 -08:00
|
|
|
{
|
2012-02-01 04:29:14 -08:00
|
|
|
Evas_Coord mx = 0, my = 0;
|
2017-06-13 03:41:15 -07:00
|
|
|
Eina_Bool mirrored = efl_ui_mirrored_get(psd->wsd->obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_pan_pos_max_get(obj, &mx, &my);
|
2010-11-23 12:30:48 -08:00
|
|
|
if (x)
|
2015-05-28 07:07:27 -07:00
|
|
|
*x = -mx * (mirrored ? 1 - psd->wsd->align_x : psd->wsd->align_x);
|
2010-11-23 12:30:48 -08:00
|
|
|
if (y)
|
2012-07-10 14:40:38 -07:00
|
|
|
*y = -my * psd->wsd->align_y;
|
2010-11-23 12:30:48 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_gengrid_pan_class_constructor(Efl_Class *klass)
|
2014-04-01 04:50:40 -07:00
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_PAN_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_gengrid_pan_eo.c"
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_focused(Elm_Object_Item *eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-03-21 01:00:46 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-03-23 07:29:16 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (it->generation < sd->generation)
|
|
|
|
return;
|
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it == sd->focused_item) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
(elm_wdg_item_disabled_get(eo_it)))
|
2014-03-21 01:00:46 -07:00
|
|
|
return;
|
|
|
|
|
2014-05-11 06:42:45 -07:00
|
|
|
switch (_elm_config->focus_autoscroll_mode)
|
|
|
|
{
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
|
|
|
|
elm_gengrid_item_show
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
|
|
|
|
elm_gengrid_item_bring_in
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->focused_item = eo_it;
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2015-09-23 00:06:15 -07:00
|
|
|
/* If item is not realized state, widget couldn't get focus_highlight data. */
|
|
|
|
if (it->realized)
|
|
|
|
{
|
2015-09-23 00:15:56 -07:00
|
|
|
_elm_gengrid_item_focus_update(it);
|
2015-09-23 00:06:15 -07:00
|
|
|
_elm_widget_item_highlight_in_theme(obj, eo_it);
|
|
|
|
_elm_widget_highlight_in_theme_update(obj);
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
|
|
|
}
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_ITEM_FOCUSED, eo_it);
|
2014-10-03 07:14:37 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2019-03-05 14:00:37 -08:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_unfocused(Elm_Object_Item *eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 07:29:16 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2019-02-27 11:00:39 -08:00
|
|
|
Evas_Object *win = elm_widget_top_get(obj);
|
2014-03-23 07:29:16 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (it->generation < sd->generation)
|
|
|
|
return;
|
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it))
|
2014-03-21 01:00:46 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
if ((!sd->focused_item) ||
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it != sd->focused_item))
|
2014-03-21 01:00:46 -07:00
|
|
|
return;
|
|
|
|
|
2019-02-27 11:00:39 -08:00
|
|
|
if (elm_win_focus_highlight_enabled_get(win) || _elm_config->win_auto_focus_enable)
|
2014-03-23 07:29:16 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2014-03-23 07:29:16 -07:00
|
|
|
edje_object_signal_emit
|
2014-09-27 22:15:37 -07:00
|
|
|
(VIEW(focus_it), "elm,state,unfocused", "elm");
|
2014-03-23 07:29:16 -07:00
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
sd->focused_item = NULL;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_ITEM_UNFOCUSED, eo_it);
|
2014-10-03 07:14:37 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2019-03-05 14:00:37 -08:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_FALSE);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_left(Elm_Gengrid_Data *sd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!sd->selected) return EINA_FALSE;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = elm_gengrid_item_prev_get(sd->last_selected_item);
|
|
|
|
if (!eo_prev) return EINA_TRUE;
|
2011-06-02 00:09:17 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (elm_gengrid_item_selected_get(eo_prev))
|
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
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->last_selected_item = eo_prev;
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_show
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_prev, EINA_TRUE);
|
|
|
|
elm_gengrid_item_show(eo_prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_right(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_next;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = elm_gengrid_item_next_get(sd->last_selected_item);
|
|
|
|
if (!eo_next) return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (elm_gengrid_item_selected_get(eo_next))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
elm_gengrid_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->last_selected_item = eo_next;
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_show
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_next, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_next, EINA_TRUE);
|
|
|
|
elm_gengrid_item_show(eo_next, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_up(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
Eina_Bool r = EINA_TRUE;
|
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; (r) && (i < sd->nmax); i++)
|
|
|
|
r &= _item_multi_select_left(sd);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_down(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
Eina_Bool r = EINA_TRUE;
|
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; (r) && (i < sd->nmax); i++)
|
|
|
|
r &= _item_multi_select_right(sd);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_all_items_deselect(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
while (sd->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_it = sd->selected->data;
|
|
|
|
elm_gengrid_item_selected_set(eo_it, EINA_FALSE);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-04-03 02:31:47 -07:00
|
|
|
static Eina_Bool
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_edge_check(Elm_Object_Item *eo_it,
|
2014-04-03 02:31:47 -07:00
|
|
|
Elm_Focus_Direction dir)
|
|
|
|
{
|
2017-03-26 08:14:09 -07:00
|
|
|
if (!eo_it) return EINA_FALSE;
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-04-03 05:06:36 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
2014-04-03 02:31:47 -07:00
|
|
|
ELM_GENGRID_DATA_GET(WIDGET(it), sd);
|
|
|
|
Evas_Coord ix = 0, iy = 0; //item's geometry
|
|
|
|
Evas_Coord cx = 0, cy = 0; //prev or next item's geometry
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item = NULL;
|
|
|
|
Elm_Gen_Item *tmp = it;
|
2017-06-13 03:41:15 -07:00
|
|
|
Eina_Bool mirrored = efl_ui_mirrored_get(WIDGET(it));
|
2014-04-03 02:31:47 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, NULL, NULL);
|
|
|
|
|
|
|
|
if (((sd->horizontal) && (dir == ELM_FOCUS_UP)) ||
|
|
|
|
((!sd->horizontal) && (dir == ELM_FOCUS_LEFT)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_prev_get(EO_OBJ(it));
|
|
|
|
while (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->reorder_mode || !elm_object_item_disabled_get(eo_item)) break;
|
|
|
|
eo_item = elm_gengrid_item_prev_get(eo_item);
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-04-03 02:31:47 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, NULL, NULL);
|
2014-12-16 02:28:50 -08:00
|
|
|
if ((sd->horizontal) && (ix == cx) && (iy > cy))
|
2014-04-03 02:31:47 -07:00
|
|
|
return EINA_FALSE;
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!sd->horizontal) && (iy == cy))
|
2015-08-26 02:04:58 -07:00
|
|
|
{
|
|
|
|
if ((!mirrored && (ix > cx)) || (mirrored && (ix < cx)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if ((dir == ELM_FOCUS_UP) || (!eo_item && sd->reorder_mode))
|
2014-06-06 22:54:28 -07:00
|
|
|
return EINA_TRUE;
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
|
|
|
else if (((sd->horizontal) && (dir == ELM_FOCUS_DOWN)) ||
|
|
|
|
((!sd->horizontal) && (dir == ELM_FOCUS_RIGHT)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(EO_OBJ(it));
|
|
|
|
while (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->reorder_mode || !elm_object_item_disabled_get(eo_item)) break;
|
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-04-03 02:31:47 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, NULL, NULL);
|
2014-12-16 02:28:50 -08:00
|
|
|
if ((sd->horizontal) && (ix == cx) && (iy < cy))
|
2014-04-03 02:31:47 -07:00
|
|
|
return EINA_FALSE;
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!sd->horizontal) && (iy == cy))
|
2015-08-26 02:04:58 -07:00
|
|
|
{
|
|
|
|
if ((!mirrored && (ix < cx)) || (mirrored && (ix > cx)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if ((dir == ELM_FOCUS_DOWN) || (!eo_item && sd->reorder_mode))
|
2014-06-06 22:54:28 -07:00
|
|
|
return EINA_TRUE;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
else if (((!sd->horizontal) && (dir == ELM_FOCUS_UP)) ||
|
|
|
|
((sd->horizontal) && (dir == ELM_FOCUS_LEFT)))
|
|
|
|
{
|
|
|
|
Evas_Coord col, row, cvw, cvh;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
if (sd->horizontal && sd->item_height > 0)
|
|
|
|
{
|
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
2017-02-21 01:32:30 -08:00
|
|
|
col = (tmp->position - 1) / row;
|
|
|
|
if (col == 0)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
2017-02-21 01:32:30 -08:00
|
|
|
row = (tmp->position - 1) / col;
|
|
|
|
if (row == 0)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (((!sd->horizontal) && (dir == ELM_FOCUS_DOWN)) ||
|
|
|
|
((sd->horizontal) && (dir == ELM_FOCUS_RIGHT)))
|
|
|
|
{
|
|
|
|
Evas_Coord col = 0, row = 0, cvw, cvh;
|
|
|
|
int x = 0;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
if (sd->horizontal && sd->item_height > 0)
|
|
|
|
{
|
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
|
|
|
col = sd->item_count / row;
|
|
|
|
x = sd->item_count % row;
|
|
|
|
if (x == 0)
|
|
|
|
{
|
|
|
|
if ((tmp->position <= (row * col)) &&
|
2014-06-06 22:54:28 -07:00
|
|
|
(tmp->position > (row * (col - 1))))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((tmp->position <= ((col * row) + x)) &&
|
2014-06-06 22:57:44 -07:00
|
|
|
(tmp->position > ((col - 1) * row) + x))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
|
|
|
row = sd->item_count / col;
|
|
|
|
x = sd->item_count % col;
|
|
|
|
if (x == 0)
|
|
|
|
{
|
|
|
|
if ((tmp->position <= (col * row)) &&
|
2014-06-06 22:54:28 -07:00
|
|
|
(tmp->position > (col * (row - 1))))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((tmp->position <= ((col * row) + x)) &&
|
2014-06-06 22:54:28 -07:00
|
|
|
(tmp->position > (((col * (row - 1)) + x))))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
static Elm_Object_Item *
|
|
|
|
get_up_item(Elm_Gengrid_Data *sd, Elm_Object_Item *eo_it)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev = NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = elm_gengrid_item_prev_get(eo_it);
|
|
|
|
if (!eo_prev)
|
|
|
|
return NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
for (i = 1; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_tmp = elm_gengrid_item_prev_get(eo_prev);
|
|
|
|
if (!eo_tmp) return eo_prev;
|
|
|
|
eo_prev = eo_tmp;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return eo_prev;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
static Elm_Object_Item *
|
|
|
|
get_down_item(Elm_Gengrid_Data *sd, Elm_Object_Item *eo_it)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_next = NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = elm_gengrid_item_next_get(eo_it);
|
|
|
|
if (!eo_next)
|
|
|
|
return NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
for (i = 1; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_tmp = elm_gengrid_item_next_get(eo_next);
|
|
|
|
if (!eo_tmp) return eo_next;
|
|
|
|
eo_next = eo_tmp;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return eo_next;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
typedef struct _Item_Info
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Evas_Coord x, y;
|
|
|
|
} Item_Info;
|
|
|
|
|
|
|
|
typedef struct _Reorder_Normal_Data
|
|
|
|
{
|
|
|
|
Item_Info *items;
|
|
|
|
Elm_Gen_Item *corner_item;
|
|
|
|
int no;
|
|
|
|
} Reorder_Normal_Data;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_free_reorder_normal_data(Reorder_Normal_Data *rnd)
|
|
|
|
{
|
|
|
|
free(rnd->items);
|
|
|
|
free(rnd);
|
|
|
|
}
|
|
|
|
|
2014-04-23 05:13:57 -07:00
|
|
|
static void
|
|
|
|
_anim_end(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
Eina_Inlist *tmp = NULL;
|
|
|
|
Elm_Gen_Item *it1_prev = NULL, *it2_prev = NULL;
|
|
|
|
it1_prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(sd->reorder.it1)->prev);
|
|
|
|
it2_prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(sd->reorder.it2)->prev);
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
if ((sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL) &&
|
|
|
|
((!sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_UP) || (sd->reorder.dir == ELM_FOCUS_DOWN))) ||
|
|
|
|
(sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_LEFT) || (sd->reorder.dir == ELM_FOCUS_RIGHT)))))
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
if ((sd->reorder.dir == ELM_FOCUS_UP) ||
|
|
|
|
(sd->reorder.dir == ELM_FOCUS_LEFT))
|
|
|
|
{
|
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
}
|
|
|
|
else if ((sd->reorder.dir == ELM_FOCUS_DOWN) ||
|
|
|
|
(sd->reorder.dir == ELM_FOCUS_RIGHT))
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((sd->reorder.type == ELM_GENGRID_REORDER_TYPE_SWAP) &&
|
|
|
|
((!sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_UP) || (sd->reorder.dir == ELM_FOCUS_DOWN))) ||
|
|
|
|
(sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_LEFT) || (sd->reorder.dir == ELM_FOCUS_RIGHT)))))
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if (it1_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
|
|
|
|
tmp);
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else if ((!sd->horizontal && (sd->reorder.dir == ELM_FOCUS_LEFT)) ||
|
|
|
|
(sd->horizontal && (sd->reorder.dir == ELM_FOCUS_UP)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!(sd->reorder.it2 == it1_prev))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
2017-07-05 03:48:52 -07:00
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
if (it1_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
2017-07-05 03:48:52 -07:00
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_prepend_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
else if ((!sd->horizontal && (sd->reorder.dir == ELM_FOCUS_RIGHT)) ||
|
|
|
|
(sd->horizontal && (sd->reorder.dir == ELM_FOCUS_DOWN)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!(sd->reorder.it1 == it2_prev))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
2017-07-05 03:48:52 -07:00
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
if (it1_prev)
|
2017-07-05 03:48:52 -07:00
|
|
|
{
|
2014-06-09 22:55:56 -07:00
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
2017-07-05 03:48:52 -07:00
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
2017-02-21 01:32:30 -08:00
|
|
|
_item_position_update(sd->items, 1);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
ecore_job_del(sd->calc_job);
|
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_move_cb(void *data, double pos)
|
|
|
|
{
|
|
|
|
Elm_Gengrid_Data *sd = data;
|
|
|
|
double frame = pos;
|
2014-04-26 08:37:23 -07:00
|
|
|
Evas_Coord xx1, yy1, xx2, yy2;
|
2014-04-23 05:13:57 -07:00
|
|
|
double dx, dy;
|
|
|
|
|
2014-04-23 05:21:07 -07:00
|
|
|
switch (sd->reorder.tween_mode)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
case ECORE_POS_MAP_LINEAR:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 0, 0);
|
|
|
|
break;
|
|
|
|
case ECORE_POS_MAP_ACCELERATE:
|
|
|
|
case ECORE_POS_MAP_DECELERATE:
|
|
|
|
case ECORE_POS_MAP_SINUSOIDAL:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 1.0, 0);
|
|
|
|
break;
|
|
|
|
case ECORE_POS_MAP_DIVISOR_INTERP:
|
|
|
|
case ECORE_POS_MAP_BOUNCE:
|
|
|
|
case ECORE_POS_MAP_SPRING:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 1.0, 1.0);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
dx = sd->reorder.x2 - sd->reorder.x1;
|
|
|
|
dy = sd->reorder.y2 - sd->reorder.y1;
|
2014-07-08 23:09:43 -07:00
|
|
|
xx1 = sd->reorder.x1 + (dx * frame);
|
|
|
|
yy1 = sd->reorder.y1 + (dy * frame);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
Reorder_Normal_Data *rnd = sd->reorder.data;
|
|
|
|
|
|
|
|
for (;i < rnd->no; i++)
|
|
|
|
{
|
|
|
|
dx = rnd->items[i + 1].x - rnd->items[i].x;
|
|
|
|
dy = rnd->items[i + 1].y - rnd->items[i].y;
|
|
|
|
xx2 = rnd->items[i].x + (frame * dx);
|
|
|
|
yy2 = rnd->items[i].y + (frame * dy);
|
|
|
|
evas_object_move(VIEW(rnd->items[i].it), xx2, yy2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_SWAP)
|
|
|
|
{
|
|
|
|
xx2 = sd->reorder.x2 - (dx * frame);
|
|
|
|
yy2 = sd->reorder.y2 - (dy * frame);
|
|
|
|
evas_object_move(VIEW(sd->reorder.it2), xx2, yy2);
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2014-04-26 08:37:23 -07:00
|
|
|
evas_object_move(VIEW(sd->reorder.it1), xx1, yy1);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2017-03-09 22:29:52 -08:00
|
|
|
if (EINA_DBL_EQ(pos, 1.0))
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
_anim_end(sd);
|
2014-07-08 23:09:43 -07:00
|
|
|
if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL)
|
|
|
|
_free_reorder_normal_data(sd->reorder.data);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_show(EO_OBJ(sd->reorder.it1),
|
2014-04-23 05:13:57 -07:00
|
|
|
ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->obj, ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_STOP, EO_OBJ(sd->reorder.it1));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-02-24 20:13:21 -08:00
|
|
|
(sd->obj, ELM_GENGRID_EVENT_MOVED, EO_OBJ(sd->reorder.it1));
|
2014-04-23 05:13:57 -07:00
|
|
|
sd->reorder.running = EINA_FALSE;
|
|
|
|
}
|
|
|
|
_elm_widget_focus_highlight_start(sd->obj);
|
2014-04-03 02:31:47 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
static void
|
|
|
|
_store_nearby_items(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
Reorder_Normal_Data *rnd = sd->reorder.data;
|
|
|
|
Eina_Inlist *itr;
|
|
|
|
Evas_Coord x, y, cvw, cvh, col = 0, row = 0;
|
|
|
|
int i = 0;
|
|
|
|
int corner_item_pos = 0;
|
|
|
|
Eina_Inlist *it1_list, *it2_list;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
|
|
|
|
rnd->no = abs(sd->reorder.it2->position - sd->reorder.it1->position);
|
|
|
|
rnd->items = malloc(sizeof(Item_Info) * (rnd->no + 1));
|
2015-07-15 11:13:50 -07:00
|
|
|
rnd->corner_item = NULL;
|
2014-07-08 23:09:43 -07:00
|
|
|
|
|
|
|
if (sd->horizontal && sd->item_height > 0)
|
|
|
|
{
|
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
|
|
|
if (sd->reorder.dir == ELM_FOCUS_RIGHT)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / row;
|
|
|
|
corner_item_pos = corner_item_pos * row;
|
|
|
|
corner_item_pos = sd->reorder.it2->position - corner_item_pos;
|
|
|
|
}
|
|
|
|
else if (sd->reorder.dir == ELM_FOCUS_LEFT)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / row;
|
|
|
|
corner_item_pos = (corner_item_pos + 1) * row;
|
|
|
|
corner_item_pos = corner_item_pos - sd->reorder.it2->position;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
|
|
|
if (sd->reorder.dir == ELM_FOCUS_DOWN)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / col;
|
|
|
|
corner_item_pos = corner_item_pos * col;
|
|
|
|
corner_item_pos = sd->reorder.it2->position - corner_item_pos;
|
|
|
|
}
|
|
|
|
else if (sd->reorder.dir == ELM_FOCUS_UP)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / col;
|
|
|
|
corner_item_pos = (corner_item_pos + 1) * col;
|
|
|
|
corner_item_pos = corner_item_pos - sd->reorder.it2->position;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
it1_list = eina_inlist_find(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
it2_list = eina_inlist_find(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if ((sd->reorder.it1->position) < (sd->reorder.it2)->position)
|
|
|
|
{
|
|
|
|
for (itr = it2_list; itr != it1_list; itr = itr->prev)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *cur = EINA_INLIST_CONTAINER_GET(itr, Elm_Gen_Item);
|
|
|
|
evas_object_geometry_get(VIEW(cur), &x, &y, NULL, NULL);
|
|
|
|
rnd->items[i].it = cur;
|
|
|
|
rnd->items[i].x = x;
|
|
|
|
rnd->items[i].y = y;
|
|
|
|
if (i == (corner_item_pos - 1))
|
|
|
|
rnd->corner_item = cur;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
rnd->items[i].it = sd->reorder.it1;
|
|
|
|
rnd->items[i].x = sd->reorder.x1;
|
|
|
|
rnd->items[i].y = sd->reorder.y1;
|
|
|
|
}
|
|
|
|
else if (sd->reorder.it1->position > sd->reorder.it2->position)
|
|
|
|
{
|
|
|
|
for (itr = it2_list; itr != it1_list; itr = itr->next)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *cur = EINA_INLIST_CONTAINER_GET(itr, Elm_Gen_Item);
|
|
|
|
evas_object_geometry_get(VIEW(cur), &x, &y, NULL, NULL);
|
|
|
|
rnd->items[i].it = cur;
|
|
|
|
rnd->items[i].x = x;
|
|
|
|
rnd->items[i].y = y;
|
|
|
|
if (i == (corner_item_pos - 1))
|
|
|
|
rnd->corner_item = cur;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
rnd->items[i].it = sd->reorder.it1;
|
|
|
|
rnd->items[i].x = sd->reorder.x1;
|
|
|
|
rnd->items[i].y = sd->reorder.y1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-23 05:13:57 -07:00
|
|
|
static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(Elm_Object_Item *eo_it1, Elm_Object_Item *eo_it2, Elm_Focus_Direction dir)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it1, it1);
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it2, it2);
|
2014-04-23 05:13:57 -07:00
|
|
|
ELM_GENGRID_DATA_GET(WIDGET(it1), sd);
|
2014-04-26 08:37:23 -07:00
|
|
|
Evas_Coord xx1, yy1, xx2, yy2;
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
sd->reorder.running = EINA_TRUE;
|
|
|
|
sd->reorder.dir = dir;
|
|
|
|
sd->reorder.it1 = it1;
|
|
|
|
sd->reorder.it2 = it2;
|
|
|
|
|
2014-04-26 08:37:23 -07:00
|
|
|
evas_object_geometry_get(VIEW(it1), &xx1, &yy1, NULL, NULL);
|
|
|
|
evas_object_geometry_get(VIEW(it2), &xx2, &yy2, NULL, NULL);
|
|
|
|
sd->reorder.x1 = xx1;
|
|
|
|
sd->reorder.y1 = yy1;
|
|
|
|
sd->reorder.x2 = xx2;
|
|
|
|
sd->reorder.y2 = yy2;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL)
|
|
|
|
{
|
|
|
|
Reorder_Normal_Data *rnd = malloc(sizeof(Reorder_Normal_Data));
|
|
|
|
sd->reorder.data = rnd;
|
|
|
|
_store_nearby_items(sd);
|
|
|
|
if (rnd->corner_item)
|
|
|
|
evas_object_raise(VIEW(rnd->corner_item));
|
|
|
|
}
|
|
|
|
evas_object_raise(VIEW(it1));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(sd->obj, ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_START, EO_OBJ(sd->reorder.it1));
|
2017-03-26 07:46:13 -07:00
|
|
|
elm_gengrid_item_bring_in(eo_it2, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2014-04-23 05:13:57 -07:00
|
|
|
//TODO: Add elm config for time
|
2018-09-18 07:42:58 -07:00
|
|
|
ecore_evas_animator_timeline_add(sd->obj, 0.3, _item_move_cb, sd);
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_horizontal_loop(Evas_Object *obj, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item = sd->focused_item;
|
2014-06-09 22:55:56 -07:00
|
|
|
unsigned int counter, i;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-06-09 22:55:56 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_UP)
|
|
|
|
{
|
|
|
|
counter = 0;
|
2014-09-27 22:15:37 -07:00
|
|
|
while (!_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_prev_get(eo_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
item = efl_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
counter++;
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_first_item_get(obj);
|
2014-06-09 22:55:56 -07:00
|
|
|
for (i = 0; i < counter; i++)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < sd->nmax; i++)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
item = efl_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_RIGHT)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
while (!_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_gengrid_item_next_get(eo_item))
|
2014-06-09 22:55:56 -07:00
|
|
|
break;
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
item = efl_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dir == ELM_FOCUS_LEFT)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
while (!_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_gengrid_item_prev_get(EO_OBJ(item)))
|
2014-06-09 22:55:56 -07:00
|
|
|
break;
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_prev_get(eo_item);
|
2016-08-15 06:44:41 -07:00
|
|
|
item = efl_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_item) return EINA_FALSE;
|
|
|
|
if (sd->reorder_mode && !(sd->focused_item == eo_item))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(sd->focused_item, eo_item, ELM_FOCUS_RIGHT);
|
2014-06-09 22:55:56 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-13 22:50:30 -07:00
|
|
|
if (_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_object_item_focus_set(eo_item, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_gengrid_item_selected_set(eo_item, EINA_TRUE);
|
2014-06-09 22:55:56 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-08-08 00:23:10 -07:00
|
|
|
return EINA_FALSE;
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
|
2017-06-28 06:10:14 -07:00
|
|
|
/*
|
|
|
|
* transform the focus direction so it can be used for deciding in which direction to go on the internal data structure
|
|
|
|
* This is respecting the horizontal
|
|
|
|
*/
|
|
|
|
|
|
|
|
static Elm_Focus_Direction
|
|
|
|
_direction_transform_horizontal(Elm_Gengrid_Data *sd, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
if (!sd->horizontal) return dir;
|
|
|
|
|
|
|
|
switch(dir){
|
|
|
|
case ELM_FOCUS_DOWN: return ELM_FOCUS_RIGHT;
|
|
|
|
case ELM_FOCUS_UP: return ELM_FOCUS_LEFT;
|
|
|
|
case ELM_FOCUS_RIGHT: return ELM_FOCUS_DOWN;
|
|
|
|
case ELM_FOCUS_LEFT: return ELM_FOCUS_UP;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
ERR("unhandled transform case");
|
|
|
|
return dir;
|
|
|
|
}
|
2017-06-29 04:13:40 -07:00
|
|
|
static Elm_Focus_Direction
|
|
|
|
_direction_mirror(Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
switch(dir){
|
|
|
|
case ELM_FOCUS_DOWN: return ELM_FOCUS_UP;
|
|
|
|
case ELM_FOCUS_UP: return ELM_FOCUS_DOWN;
|
|
|
|
case ELM_FOCUS_RIGHT: return ELM_FOCUS_LEFT;
|
|
|
|
case ELM_FOCUS_LEFT: return ELM_FOCUS_RIGHT;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
ERR("unhandled transform case");
|
|
|
|
return dir;
|
|
|
|
}
|
2017-06-28 06:10:14 -07:00
|
|
|
static Elm_Object_Item*
|
|
|
|
_get_neighbor(Elm_Gengrid_Data *sd, Elm_Object_Item *item, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
Elm_Focus_Direction access_dir = _direction_transform_horizontal(sd, dir);
|
|
|
|
|
|
|
|
switch(access_dir){
|
|
|
|
case ELM_FOCUS_DOWN: return get_down_item(sd, item);
|
|
|
|
case ELM_FOCUS_UP: return get_up_item(sd, item);
|
|
|
|
case ELM_FOCUS_RIGHT: return elm_gengrid_item_next_get(item);
|
|
|
|
case ELM_FOCUS_LEFT: return elm_gengrid_item_prev_get(item);
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_reorder_helper(Elm_Gengrid_Data *sd, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *neighbor;
|
|
|
|
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, dir))
|
|
|
|
{
|
|
|
|
if ((dir == ELM_FOCUS_LEFT || dir == ELM_FOCUS_RIGHT) && sd->item_loop_enable)
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
neighbor = _get_neighbor(sd, sd->focused_item, dir);
|
|
|
|
|
|
|
|
if (!neighbor) return EINA_FALSE;
|
|
|
|
|
|
|
|
_swap_items(sd->focused_item, neighbor, dir);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-29 06:37:34 -07:00
|
|
|
static Elm_Object_Item*
|
|
|
|
_pick_item(Elm_Gengrid_Data *sd, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *next;
|
|
|
|
|
|
|
|
if (dir == ELM_FOCUS_RIGHT || dir == ELM_FOCUS_DOWN)
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
else
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
|
|
|
|
while (((next) && (next->generation < sd->generation))
|
|
|
|
|| elm_object_item_disabled_get(EO_OBJ(next)))
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_RIGHT || dir == ELM_FOCUS_DOWN)
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
|
|
|
else
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->prev);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EO_OBJ(next);
|
|
|
|
}
|
|
|
|
|
2017-06-29 04:13:40 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_focus(Elm_Gengrid_Data *sd, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *candidate;
|
|
|
|
|
|
|
|
if (!sd->focused_item)
|
|
|
|
{
|
2017-06-29 06:37:34 -07:00
|
|
|
candidate = _pick_item(sd, dir);
|
2017-06-29 04:13:40 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
candidate = sd->focused_item;
|
|
|
|
do {
|
|
|
|
candidate = _get_neighbor(sd, candidate, dir);
|
|
|
|
if (!candidate) return EINA_FALSE;
|
|
|
|
if (candidate == sd->focused_item) return EINA_FALSE;
|
|
|
|
|
|
|
|
} while(elm_object_item_disabled_get(candidate));
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_object_item_focus_set(candidate, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-29 06:37:34 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_selection_single_move(Evas_Object *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *candidate;
|
|
|
|
|
|
|
|
if (!sd->selected)
|
|
|
|
candidate = _pick_item(sd, dir);
|
|
|
|
else
|
|
|
|
candidate = sd->last_selected_item;
|
|
|
|
|
|
|
|
if (!candidate) return EINA_FALSE;
|
|
|
|
|
|
|
|
candidate = _get_neighbor(sd, candidate, dir);
|
|
|
|
|
|
|
|
_all_items_deselect(sd);
|
|
|
|
elm_gengrid_item_selected_set(candidate, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-29 04:13:40 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_focus_move(Evas_Object *obj, Elm_Gengrid_Data *sd, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
Elm_Focus_Direction access_dir = _direction_transform_horizontal(sd, dir);
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, dir))
|
|
|
|
{
|
|
|
|
if (sd->item_loop_enable && (access_dir == ELM_FOCUS_RIGHT || access_dir == ELM_FOCUS_LEFT))
|
|
|
|
{
|
|
|
|
if (_item_horizontal_loop(obj, _direction_mirror(access_dir)))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2017-06-29 06:37:34 -07:00
|
|
|
_selection_single_move(obj, sd, access_dir);
|
2017-06-29 04:13:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return _item_focus(sd, dir);
|
|
|
|
}
|
|
|
|
|
2017-06-29 09:29:24 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_get_direction(const char *str, Elm_Focus_Direction *dir)
|
|
|
|
{
|
|
|
|
if (!strcmp(str, "left")) *dir = ELM_FOCUS_LEFT;
|
|
|
|
else if (!strcmp(str, "right")) *dir = ELM_FOCUS_RIGHT;
|
|
|
|
else if (!strcmp(str, "up")) *dir = ELM_FOCUS_UP;
|
|
|
|
else if (!strcmp(str, "down")) *dir = ELM_FOCUS_DOWN;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-06-29 09:41:06 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_get_multi_direction(const char *str, Elm_Focus_Direction *dir)
|
|
|
|
{
|
|
|
|
if (!strcmp(str, "left_multi")) *dir = ELM_FOCUS_LEFT;
|
|
|
|
else if (!strcmp(str, "right_multi")) *dir = ELM_FOCUS_RIGHT;
|
|
|
|
else if (!strcmp(str, "up_multi")) *dir = ELM_FOCUS_UP;
|
|
|
|
else if (!strcmp(str, "down_multi")) *dir = ELM_FOCUS_DOWN;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_multi_select(Elm_Gengrid_Data *sd, Elm_Focus_Direction direction)
|
|
|
|
{
|
|
|
|
if (direction == ELM_FOCUS_UP) return _item_multi_select_up(sd);
|
|
|
|
else if (direction == ELM_FOCUS_DOWN) return _item_multi_select_down(sd);
|
|
|
|
else if (direction == ELM_FOCUS_RIGHT) return _item_multi_select_right(sd);
|
|
|
|
else if (direction == ELM_FOCUS_LEFT) return _item_multi_select_left(sd);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-16 01:19:23 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-16 01:19:23 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-07-10 14:40:38 -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;
|
2017-06-13 03:41:15 -07:00
|
|
|
Eina_Bool mirrored = efl_ui_mirrored_get(obj);
|
2017-06-29 09:29:24 -07:00
|
|
|
Elm_Focus_Direction direction;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
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-10 14:40:38 -07:00
|
|
|
|
2014-04-26 11:17:01 -07:00
|
|
|
if (sd->reorder_mode && sd->reorder.running) return EINA_TRUE;
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2017-06-29 09:29:24 -07:00
|
|
|
|
|
|
|
if (_get_direction(dir, &direction))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2017-06-29 09:29:24 -07:00
|
|
|
if (mirrored)
|
|
|
|
{
|
|
|
|
if (direction == ELM_FOCUS_RIGHT || direction == ELM_FOCUS_LEFT)
|
|
|
|
direction = _direction_mirror(direction);
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
if (sd->reorder_mode)
|
|
|
|
{
|
2017-06-29 09:29:24 -07:00
|
|
|
return _reorder_helper(sd, direction);
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
2015-09-15 03:41:51 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Evas_Object *next = NULL;
|
|
|
|
next = elm_object_item_focus_next_object_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_LEFT);
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(next, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2017-06-29 09:29:24 -07:00
|
|
|
return _focus_move(obj, sd, direction);
|
|
|
|
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
2017-06-29 09:41:06 -07:00
|
|
|
else if (_get_multi_direction(dir, &direction))
|
2014-04-16 01:19:23 -07:00
|
|
|
{
|
2017-06-29 09:41:06 -07:00
|
|
|
if (mirrored)
|
2014-04-16 01:19:23 -07:00
|
|
|
{
|
2017-06-29 09:41:06 -07:00
|
|
|
if (direction == ELM_FOCUS_RIGHT || direction == ELM_FOCUS_LEFT)
|
|
|
|
direction = _direction_mirror(direction);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2017-06-29 09:41:06 -07:00
|
|
|
if (direction == ELM_FOCUS_LEFT || direction == ELM_FOCUS_RIGHT)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2017-06-29 09:41:06 -07:00
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, direction))
|
2014-04-16 01:19:23 -07:00
|
|
|
return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2017-06-29 09:41:06 -07:00
|
|
|
if (_item_multi_select(sd, direction)) return EINA_TRUE;
|
|
|
|
else if (_selection_single_move(obj, sd, direction)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "first"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
it = elm_gengrid_first_item_get(obj);
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_gengrid_item_selected_set(it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "last"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
it = elm_gengrid_last_item_get(obj);
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_gengrid_item_selected_set(it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "prior"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
if (page_x < 0)
|
|
|
|
x -= -(page_x * v_w) / 100;
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
x -= page_x;
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (page_y < 0)
|
|
|
|
y -= -(page_y * v_h) / 100;
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
y -= page_y;
|
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
|
|
|
}
|
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "next"))
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
if (page_x < 0)
|
|
|
|
x += -(page_x * v_w) / 100;
|
|
|
|
else
|
|
|
|
x += page_x;
|
|
|
|
}
|
|
|
|
else
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (page_y < 0)
|
|
|
|
y += -(page_y * v_h) / 100;
|
|
|
|
else
|
|
|
|
y += page_y;
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_set(obj, x, y, EINA_TRUE);
|
2014-04-16 01:19:23 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2015-02-12 02:15:57 -08:00
|
|
|
_key_action_select(Evas_Object *obj, const char *params)
|
2014-04-16 01:19:23 -07:00
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!sd->items) return EINA_FALSE;
|
|
|
|
|
2015-02-12 02:15:57 -08:00
|
|
|
Elm_Object_Item *eo_it = elm_object_focused_item_get(obj);
|
2015-08-31 00:21:26 -07:00
|
|
|
if (!eo_it) return EINA_TRUE;
|
2015-02-12 02:15:57 -08:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-04-16 01:19:23 -07:00
|
|
|
|
2015-02-12 02:15:57 -08:00
|
|
|
if (sd->multi &&
|
|
|
|
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
|
|
|
(!strcmp(params, "multi"))))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2015-02-12 02:15:57 -08:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
it->highlight_cb(it);
|
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
|
|
|
else it->unsel_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2015-02-12 02:15:57 -08:00
|
|
|
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_GENGRID_ITEM_CLASS);
|
2015-02-12 02:15:57 -08:00
|
|
|
it->unsel_cb(sel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
|
|
|
Elm_Object_Item *eo_item2;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2);
|
|
|
|
if (item2 != it) it->unsel_cb(item2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
it->highlight_cb(it);
|
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sd->multi)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(WIDGET(it), ELM_GENGRID_EVENT_ACTIVATED, eo_it);
|
2015-02-12 02:15:57 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->items) return EINA_FALSE;
|
2017-08-16 23:08:00 -07:00
|
|
|
if (!_all_items_deselect(sd)) return EINA_FALSE;
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 05:25:40 -07:00
|
|
|
/*
|
|
|
|
* This function searches the nearest visible item based on the given item.
|
|
|
|
* If the given item is in the gengrid viewport, this returns the given item.
|
|
|
|
* Or this searches the realized items and checks the nearest fully visible item
|
|
|
|
* according to the given item's position.
|
|
|
|
*/
|
|
|
|
static Elm_Object_Item *
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vx = 0, vy = 0, vw = 0, vh = 0; // gengrid 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:37 -07:00
|
|
|
Elm_Object_Item *eo_item = NULL;
|
2014-03-23 05:25:40 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-23 10:10:59 -07:00
|
|
|
Eina_Bool search_next = EINA_FALSE;
|
2014-03-23 05:25:40 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 05:25:40 -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:10:59 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_it))
|
|
|
|
return eo_it;
|
2014-03-23 10:10:59 -07:00
|
|
|
else
|
|
|
|
search_next = EINA_TRUE;
|
|
|
|
}
|
2014-03-23 05:25:40 -07:00
|
|
|
|
2014-12-26 01:40:14 -08:00
|
|
|
item_list = elm_gengrid_realized_items_get(obj);
|
|
|
|
|
2014-03-23 10:10:59 -07:00
|
|
|
if ((iy < vy) || search_next)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_LIST_FOREACH(item_list, l, eo_item)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-03-23 05:25:40 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 10:10:59 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:37 -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-23 05:25:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_LIST_REVERSE_FOREACH(item_list, l, eo_item)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-03-23 05:25:40 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 10:10:59 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:37 -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-23 05:25:40 -07:00
|
|
|
}
|
|
|
|
}
|
2014-12-26 03:22:57 -08:00
|
|
|
eina_list_free(item_list);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return eo_it;
|
2014-03-23 05:25:40 -07:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_efl_ui_widget_interest_region_get(const Eo *obj, Elm_Gengrid_Data *sd)
|
2015-08-12 01:25:15 -07:00
|
|
|
{
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect r = {};
|
2017-08-29 19:29:08 -07:00
|
|
|
|
2017-08-28 22:18:50 -07:00
|
|
|
if (!sd->focused_item) goto end;
|
2015-08-12 01:25:15 -07:00
|
|
|
if (elm_object_focus_region_show_mode_get(obj) == ELM_FOCUS_REGION_SHOW_ITEM)
|
|
|
|
{
|
|
|
|
Evas_Coord vx, vy;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2017-08-29 19:29:08 -07:00
|
|
|
evas_object_geometry_get(VIEW(focus_it), &r.x, &r.y, &r.w, &r.h);
|
2015-08-12 01:25:15 -07:00
|
|
|
evas_object_geometry_get(obj, &vx, &vy, NULL, NULL);
|
|
|
|
|
2017-08-29 19:29:08 -07:00
|
|
|
r.x -= vx;
|
|
|
|
r.y -= vy;
|
|
|
|
if (r.w < 1) r.w = 1;
|
|
|
|
if (r.h < 1) r.h = 1;
|
2015-08-12 01:25:15 -07:00
|
|
|
|
2017-08-29 19:29:08 -07:00
|
|
|
return r;
|
2015-08-12 01:25:15 -07:00
|
|
|
}
|
2017-08-28 22:18:50 -07:00
|
|
|
|
|
|
|
end:
|
2017-10-23 22:03:46 -07:00
|
|
|
return efl_ui_widget_interest_region_get(efl_super(obj, MY_CLASS));
|
2015-08-12 01:25:15 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static Eina_Bool _elm_gengrid_smart_focus_next_enable = EINA_FALSE;
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool rtl)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
2018-03-13 09:38:10 -07:00
|
|
|
if (efl_finalized_get(sd->obj))
|
|
|
|
_item_cache_zero(sd);
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_ui_mirrored_set(efl_super(obj, MY_CLASS), rtl);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!sd->items) return;
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
edje_object_mirrored_set(VIEW(it), rtl);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_update(EO_OBJ(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_gengrid_efl_ui_widget_theme_apply(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-07-10 14:40:38 -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;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_position_update(Eina_Inlist *list,
|
|
|
|
int idx)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(list, it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
it->position = idx++;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_del_not_serious(Elm_Gen_Item *it)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2013-08-27 16:47:16 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_pre_notify_del(eo_it);
|
2013-08-27 16:47:16 -07:00
|
|
|
it->generation = sd->generation - 1; /* This means that the item is deleted */
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-02-12 02:42:25 -08:00
|
|
|
if (sd->show_it == eo_it)
|
|
|
|
{
|
|
|
|
sd->show_it = NULL;
|
|
|
|
sd->show_region = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->bring_in_it == eo_it)
|
|
|
|
{
|
|
|
|
sd->bring_in_it = NULL;
|
|
|
|
sd->bring_in = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, eo_it);
|
|
|
|
if (sd->last_selected_item == eo_it)
|
2014-03-08 09:55:35 -08:00
|
|
|
sd->last_selected_item = NULL;
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->focused_item == eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->focused_item = NULL;
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->last_focused_item == eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->last_focused_item = NULL;
|
2012-07-10 14:40:38 -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-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_gengrid_item_del_serious(Elm_Gen_Item *it)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2013-08-27 16:47:16 -07:00
|
|
|
|
2015-05-28 08:58:46 -07:00
|
|
|
sd->item_count--;
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_del_not_serious(it);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->group)
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->group_items = eina_list_remove(sd->group_items, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-08-27 16:47:16 -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-08-27 16:47:16 -07:00
|
|
|
sd->calc_job = ecore_job_add(sd->calc_cb, sd->obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->item, free);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_del(Elm_Gen_Item *it)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2014-08-21 11:09:10 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->realized) _elm_gengrid_item_unrealize(it, EINA_FALSE);
|
|
|
|
_elm_gengrid_item_del_serious(it);
|
|
|
|
elm_gengrid_item_class_unref((Elm_Gengrid_Item_Class *)it->itc);
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2010-06-03 05:53:14 -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-10 14:40:38 -07:00
|
|
|
_scroll_animate_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_ANIM_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
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -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
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_drag_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_drag_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2011-09-27 08:04:57 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_left_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_EDGE_LEFT, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_right_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_EDGE_RIGHT, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_top_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_EDGE_TOP, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_bottom_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_EDGE_BOTTOM, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
2013-05-15 14:56:04 -07:00
|
|
|
static void
|
|
|
|
_scroll_page_change_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2013-05-15 14:56:04 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_GENGRID_EVENT_SCROLL_PAGE_CHANGED, NULL);
|
2013-05-15 14:56:04 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_SCROLL, NULL);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2011-06-25 08:39:05 -07:00
|
|
|
static int
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_compare(const void *data,
|
|
|
|
const void *data1)
|
2011-06-25 08:39:05 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it, *item1;
|
2012-06-14 07:11:04 -07:00
|
|
|
Eina_Compare_Cb cb = NULL;
|
|
|
|
ptrdiff_t d;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2011-10-21 15:55:45 -07:00
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
|
|
|
item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it && GG_IT(it)->wsd->item_compare_cb)
|
|
|
|
cb = GG_IT(it)->wsd->item_compare_cb;
|
|
|
|
else if (item1 && GG_IT(item1)->wsd->item_compare_cb)
|
|
|
|
cb = GG_IT(item1)->wsd->item_compare_cb;
|
2014-09-27 22:15:37 -07:00
|
|
|
if (cb && it && item1) return cb(EO_OBJ(it), EO_OBJ(item1));
|
2012-07-10 14:40:38 -07:00
|
|
|
d = (char *)data - (char *)data1;
|
2012-06-14 07:11:04 -07:00
|
|
|
if (d < 0) return -1;
|
|
|
|
if (!d) return 0;
|
|
|
|
return 1;
|
2011-06-25 08:39:05 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_disable(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2012-01-30 18:40:08 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->generation < GG_IT(it)->wsd->generation) return;
|
2012-01-30 18:40:08 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->realized)
|
2012-01-30 18:40:08 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
|
2012-01-30 18:40:08 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-16 16:56:23 -07:00
|
|
|
EOLIAN static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_elm_widget_item_del_pre(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
_item_del(it);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Evas_Object *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_elm_widget_item_part_content_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char * part)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
return edje_object_part_swallow_get(VIEW(it), part);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_elm_widget_item_part_text_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char * part)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (!it->itc->func.text_get) return NULL;
|
|
|
|
return edje_object_part_text_get(VIEW(it), part);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char *emission, const char *source)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), emission, source);
|
2012-01-30 18:40:08 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_gengrid_item_elm_widget_item_item_focus_set(Eo *eo_it, Elm_Gen_Item *it, Eina_Bool focused)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (focused)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->last_focused_item = eo_it;
|
2017-10-15 06:35:42 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
if (!elm_object_focus_get(obj))
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_it != sd->focused_item)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_unfocused(sd->focused_item);
|
2018-11-13 08:36:31 -08:00
|
|
|
if (it->realized)
|
|
|
|
{
|
|
|
|
_elm_gengrid_item_focused(eo_it);
|
|
|
|
sd->focus_on_realization = NULL;
|
|
|
|
efl_ui_focus_manager_focus_set(obj, eo_it);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->focus_on_realization = it;
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2017-10-15 06:35:42 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
else
|
2015-02-02 22:47:32 -08:00
|
|
|
{
|
2017-12-01 07:54:21 -08:00
|
|
|
if (!elm_object_focus_get(obj))
|
2015-02-02 22:47:32 -08:00
|
|
|
return;
|
|
|
|
_elm_gengrid_item_unfocused(eo_it);
|
|
|
|
}
|
2015-08-12 01:25:15 -07:00
|
|
|
elm_widget_focus_region_show(obj);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_elm_widget_item_item_focus_get(const Eo *eo_it, Elm_Gen_Item *it)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
2014-03-21 01:00:46 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-30 19:03:17 -08:00
|
|
|
static void
|
2014-04-01 04:50:40 -07:00
|
|
|
_internal_elm_gengrid_clear(Evas_Object *obj,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool standby)
|
2012-01-30 19:03:17 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Inlist *next, *l;
|
|
|
|
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-14 11:15:22 -07:00
|
|
|
if (!sd->items) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!standby) sd->generation++;
|
|
|
|
|
2013-09-08 02:50:00 -07:00
|
|
|
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (sd->walking > 0)
|
2012-01-30 19:03:17 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->clear_me = EINA_TRUE;
|
2012-01-30 19:03:17 -08:00
|
|
|
return;
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2012-07-10 14:40:38 -07:00
|
|
|
for (l = sd->items, next = l ? l->next : NULL;
|
|
|
|
l;
|
|
|
|
l = next, next = next ? next->next : NULL)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(l);
|
|
|
|
|
|
|
|
if (it->generation < sd->generation)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *itn = NULL;
|
|
|
|
|
|
|
|
if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next);
|
2018-04-16 16:40:19 -07:00
|
|
|
if (itn) efl_ref(EO_OBJ(itn)); /* prevent early death of subitem */
|
2016-08-26 01:09:38 -07:00
|
|
|
if (VIEW(it))
|
|
|
|
_item_mouse_callbacks_del(it, VIEW(it));
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(EO_OBJ(it));
|
2018-04-16 16:40:19 -07:00
|
|
|
if (itn) efl_unref(EO_OBJ(itn));
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
sd->clear_me = EINA_FALSE;
|
|
|
|
sd->pan_changed = EINA_TRUE;
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
2014-01-21 17:47:33 -08:00
|
|
|
sd->selected = eina_list_free(sd->selected);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->clear_cb) sd->clear_cb(sd);
|
|
|
|
sd->pan_x = 0;
|
|
|
|
sd->pan_y = 0;
|
|
|
|
sd->minw = 0;
|
|
|
|
sd->minh = 0;
|
|
|
|
|
|
|
|
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-10 14:40:38 -07:00
|
|
|
}
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show(obj, 0, 0, 0, 0);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2016-02-19 15:58:30 -08:00
|
|
|
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_select(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-01-30 19:03:17 -08:00
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-08-21 08:12:40 -07:00
|
|
|
(it->generation < sd->generation) ||
|
|
|
|
(it->decorate_it_set))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2014-08-21 08:12:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
it->selected = EINA_TRUE;
|
2014-11-25 04:55:12 -08:00
|
|
|
sd->selected = eina_list_append(sd->selected, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-08-27 05:56:38 -07:00
|
|
|
else if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) &&
|
|
|
|
(it->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
2018-04-16 16:40:19 -07:00
|
|
|
efl_ref(eo_it);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->walking++;
|
2015-11-18 02:39:13 -08:00
|
|
|
|
|
|
|
sd->last_selected_item = eo_it;
|
|
|
|
|
2014-11-25 04:55:12 -08:00
|
|
|
if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it);
|
2013-08-27 16:47:16 -07:00
|
|
|
if (it->generation == sd->generation)
|
2014-03-22 07:51:52 -07:00
|
|
|
{
|
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)
|
2019-03-05 14:00:37 -08:00
|
|
|
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_TYPE_SELECTED, EINA_TRUE);
|
2014-03-22 07:51:52 -07:00
|
|
|
}
|
|
|
|
|
2018-04-16 16:40:19 -07:00
|
|
|
efl_ref(eo_it);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->walking--;
|
|
|
|
if ((sd->clear_me) && (!sd->walking))
|
2014-04-01 04:50:40 -07:00
|
|
|
_internal_elm_gengrid_clear(WIDGET(it), EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
|
|
|
{
|
2018-04-16 16:40:19 -07:00
|
|
|
if (it->generation < sd->generation)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(eo_it);
|
2015-11-18 02:39:13 -08:00
|
|
|
sd->last_selected_item = NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
evas_object_unref(obj);
|
2012-01-30 19:03:17 -08:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_gengrid_item_efl_object_constructor(Eo *eo_it, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
eo_it = efl_constructor(efl_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
|
|
|
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:37 -07:00
|
|
|
}
|
|
|
|
|
2011-10-21 15:55:45 -07:00
|
|
|
static Elm_Gen_Item *
|
2014-04-01 04:50:40 -07:00
|
|
|
_elm_gengrid_item_new(Elm_Gengrid_Data *sd,
|
2012-07-10 14:40:38 -07:00
|
|
|
const Elm_Gen_Item_Class *itc,
|
|
|
|
const void *data,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *func_data)
|
2011-10-21 15:55:45 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!itc) return NULL;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
Eo *eo_it = efl_add(ELM_GENGRID_ITEM_CLASS, sd->obj);
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it->generation = sd->generation;
|
|
|
|
it->itc = itc;
|
|
|
|
elm_gengrid_item_class_ref((Elm_Gengrid_Item_Class *)itc);
|
|
|
|
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(EO_OBJ(it), data);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->parent = NULL;
|
|
|
|
it->func.func = func;
|
|
|
|
it->func.data = func_data;
|
|
|
|
|
|
|
|
it->highlight_cb = (Ecore_Cb)_item_highlight;
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb = (Ecore_Cb)_item_unhighlight;
|
2012-11-16 06:26:04 -08:00
|
|
|
it->sel_cb = (Ecore_Cb)_item_select;
|
2012-07-10 14:40:38 -07:00
|
|
|
it->unsel_cb = (Ecore_Cb)_item_unselect;
|
|
|
|
it->unrealize_cb = (Ecore_Cb)_item_unrealize_cb;
|
2011-10-21 15:55:45 -07:00
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
GG_IT(it) = ELM_NEW(Elm_Gen_Item_Type);
|
|
|
|
GG_IT(it)->wsd = sd;
|
|
|
|
|
2016-10-04 23:36:04 -07:00
|
|
|
/* for non homogenous items */
|
|
|
|
it->item->w = sd->item_width;
|
|
|
|
it->item->h = sd->item_height;
|
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
it->group = it->itc->item_style &&
|
|
|
|
(!strcmp(it->itc->item_style, "group_index"));
|
|
|
|
sd->item_count++;
|
|
|
|
|
2017-10-15 06:35:42 -07:00
|
|
|
efl_ui_focus_composition_dirty(sd->obj);
|
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
return it;
|
2011-10-21 15:55:45 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2017-01-03 00:35:35 -08:00
|
|
|
_elm_gengrid_elm_layout_sizing_eval(Eo *obj, Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2017-01-03 00:35:35 -08:00
|
|
|
Evas_Coord minw = 0, minh = 0, maxw = -1, maxh = -1, vw = 0, vh = 0;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
evas_object_size_hint_min_get(obj, &minw, &minh);
|
|
|
|
evas_object_size_hint_max_get(obj, &maxw, &maxh);
|
|
|
|
edje_object_size_min_calc(wd->resize_obj, &vw, &vh);
|
|
|
|
|
|
|
|
if (sd->scr_minw)
|
|
|
|
{
|
|
|
|
maxw = -1;
|
|
|
|
minw = vw + sd->minw;
|
|
|
|
}
|
|
|
|
if (sd->scr_minh)
|
|
|
|
{
|
|
|
|
maxh = -1;
|
|
|
|
minh = vh + sd->minh;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((maxw > 0) && (minw > maxw))
|
|
|
|
minw = maxw;
|
|
|
|
if ((maxh > 0) && (minh > maxh))
|
|
|
|
minh = maxh;
|
|
|
|
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_content_min_limit_cb(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->scr_minw = !!w;
|
|
|
|
sd->scr_minh = !!h;
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_gengrid_efl_canvas_group_group_add(Eo *obj, Elm_Gengrid_Data *priv)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2012-07-17 09:42:20 -07:00
|
|
|
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Pan_Data *pan_data;
|
2013-10-05 01:14:21 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-07-10 14:40:38 -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
|
|
|
|
2012-07-10 14:40:38 -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-17 09:42:20 -07:00
|
|
|
/* common scroller hit rectangle setup */
|
2012-07-10 14:40:38 -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-17 09:42:20 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
priv->calc_cb = (Ecore_Cb)_calc_job;
|
|
|
|
|
|
|
|
priv->generation = 1;
|
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "gengrid", "base",
|
|
|
|
elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-07-17 09:42:20 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, wd->resize_obj, priv->hit_rect);
|
2012-07-17 09:42:20 -07:00
|
|
|
|
|
|
|
priv->old_h_bounce = bounce;
|
|
|
|
priv->old_v_bounce = bounce;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, bounce, bounce);
|
|
|
|
|
|
|
|
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_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_scroll_cb_set(obj, _scroll_cb);
|
|
|
|
elm_interface_scrollable_page_change_cb_set(obj, _scroll_page_change_cb);
|
2017-01-03 00:35:35 -08:00
|
|
|
elm_interface_scrollable_content_min_limit_cb_set(obj, _content_min_limit_cb);
|
2012-07-17 09:42:20 -07:00
|
|
|
|
|
|
|
priv->align_x = 0.5;
|
|
|
|
priv->align_y = 0.5;
|
|
|
|
priv->highlight = EINA_TRUE;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
priv->item_cache_max = CACHE_MAX;
|
2012-07-17 09:42:20 -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-17 09:42:20 -07:00
|
|
|
pan_data->wsd = priv;
|
|
|
|
|
2013-08-26 03:55:21 -07:00
|
|
|
priv->stack = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(priv->stack, priv->pan_obj);
|
|
|
|
evas_object_raise(priv->stack);
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_extern_pan_set(obj, priv->pan_obj);
|
2016-10-04 23:36:04 -07:00
|
|
|
|
|
|
|
/* for non homogenous mode */
|
|
|
|
priv->custom_size_mode = EINA_FALSE;
|
|
|
|
priv->custom_size_sum = NULL;
|
|
|
|
priv->custom_tot_sum = NULL;
|
|
|
|
priv->custom_alloc_size = 0;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_gengrid_efl_canvas_group_group_del(Eo *obj, Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
elm_gengrid_clear(obj);
|
2013-09-08 02:50:00 -07:00
|
|
|
ELM_SAFE_FREE(sd->pan_obj, evas_object_del);
|
2013-08-26 03:55:21 -07:00
|
|
|
ELM_SAFE_FREE(sd->stack, evas_object_del);
|
2016-10-04 23:36:04 -07:00
|
|
|
_cleanup_custom_size_mode(sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_cache_zero(sd);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_gengrid_efl_gfx_entity_position_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Position2D pos)
|
2012-07-10 14:40:38 -07: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);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_gengrid_efl_gfx_entity_size_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Size2D sz)
|
2012-07-10 14:40:38 -07: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-07-10 14:40:38 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(sd->hit_rect, sz);
|
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_gengrid_efl_canvas_group_group_member_add(Eo *obj, Elm_Gengrid_Data *sd, Evas_Object *member)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static void
|
2014-04-01 04:50:40 -07:00
|
|
|
_access_obj_process(Elm_Gengrid_Data * sd, Eina_Bool is_access)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
2012-10-18 21:06:42 -07:00
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->realized) continue;
|
|
|
|
if (is_access) _access_widget_item_register(it);
|
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_access_widget_item_unregister(it->base);
|
2012-10-18 21:06:42 -07:00
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_gengrid_efl_ui_widget_on_access_update(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool acs)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
_elm_gengrid_smart_focus_next_enable = acs;
|
2012-11-25 22:32:53 -08:00
|
|
|
_access_obj_process(sd, _elm_gengrid_smart_focus_next_enable);
|
2012-07-31 15:07:07 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_gengrid_add(Evas_Object *parent)
|
|
|
|
{
|
2012-07-10 14:40:38 -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-07-10 14:40:38 -07:00
|
|
|
|
2017-11-22 03:18:30 -08:00
|
|
|
EOLIAN static void
|
2018-11-01 18:17:26 -07:00
|
|
|
_elm_gengrid_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction direction, Efl_Ui_Focus_Object *entry)
|
2017-11-22 03:18:30 -08:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_it = NULL;
|
|
|
|
|
2018-11-01 18:17:26 -07:00
|
|
|
if (!pd->items)
|
2017-11-22 03:18:30 -08:00
|
|
|
{
|
2018-11-01 18:17:26 -07:00
|
|
|
efl_ui_focus_manager_setup_on_first_touch(efl_super(obj, MY_CLASS), direction, entry);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pd->last_focused_item)
|
|
|
|
eo_it = pd->last_focused_item;
|
|
|
|
else if (pd->last_selected_item)
|
|
|
|
eo_it = pd->last_selected_item;
|
|
|
|
else if (_elm_config->first_item_focus_on_first_focus_in)
|
2017-11-22 03:18:30 -08:00
|
|
|
{
|
2018-11-01 18:17:26 -07:00
|
|
|
if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
|
|
|
{
|
|
|
|
eo_it = elm_gengrid_first_item_get(obj);
|
|
|
|
}
|
|
|
|
else if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS)
|
|
|
|
{
|
|
|
|
eo_it = elm_gengrid_last_item_get(obj);
|
|
|
|
}
|
2017-11-22 03:18:30 -08:00
|
|
|
}
|
2018-11-01 18:17:26 -07:00
|
|
|
eo_it = _elm_gengrid_nearest_visible_item_get(obj, eo_it);
|
|
|
|
if (eo_it)
|
|
|
|
{
|
|
|
|
if (!_elm_config->item_select_on_focus_disable &&
|
|
|
|
eo_it != pd->last_selected_item)
|
|
|
|
elm_gengrid_item_selected_set(eo_it, EINA_TRUE);
|
|
|
|
else
|
2018-11-13 08:36:31 -08:00
|
|
|
{
|
2018-12-18 04:01:34 -08:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, pd_it);
|
|
|
|
if (pd_it->realized)
|
2018-11-13 08:36:31 -08:00
|
|
|
efl_ui_focus_manager_focus_set(obj, eo_it);
|
|
|
|
}
|
2018-11-01 18:17:26 -07:00
|
|
|
}
|
2017-11-22 03:18:30 -08:00
|
|
|
else
|
2018-11-01 18:17:26 -07:00
|
|
|
{
|
2018-12-11 07:40:40 -08:00
|
|
|
efl_ui_focus_object_focus_set(obj, EINA_TRUE);
|
2018-11-01 18:17:26 -07:00
|
|
|
}
|
|
|
|
}
|
2017-11-22 03:18:30 -08:00
|
|
|
}
|
|
|
|
|
2018-12-12 10:08:44 -08:00
|
|
|
static Efl_Ui_Focus_Object*
|
2018-12-18 04:01:34 -08:00
|
|
|
_select_candidate(Eo *obj, EINA_UNUSED Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction direction)
|
2018-12-12 10:08:44 -08:00
|
|
|
{
|
|
|
|
Elm_Object_Item *first = elm_gengrid_first_item_get(obj);
|
|
|
|
Elm_Object_Item *last = elm_gengrid_last_item_get(obj);
|
|
|
|
|
|
|
|
switch(direction)
|
|
|
|
{
|
|
|
|
case EFL_UI_FOCUS_DIRECTION_DOWN:
|
|
|
|
case EFL_UI_FOCUS_DIRECTION_RIGHT:
|
|
|
|
elm_object_item_focus_set(first, EINA_TRUE);
|
|
|
|
return obj;
|
|
|
|
break;
|
|
|
|
case EFL_UI_FOCUS_DIRECTION_UP:
|
|
|
|
case EFL_UI_FOCUS_DIRECTION_LEFT:
|
|
|
|
elm_object_item_focus_set(last, EINA_TRUE);
|
|
|
|
return obj;
|
|
|
|
break;
|
|
|
|
case EFL_UI_FOCUS_DIRECTION_NEXT:
|
|
|
|
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
|
|
|
|
//do not go further with logical movement
|
|
|
|
return NULL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("Uncaught focus direction");
|
|
|
|
return NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Ui_Focus_Object*
|
|
|
|
_elm_gengrid_efl_ui_focus_manager_move(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction direction)
|
|
|
|
{
|
|
|
|
if (efl_ui_focus_manager_focus_get(obj) == obj)
|
|
|
|
{
|
|
|
|
return _select_candidate(obj, pd, direction);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return efl_ui_focus_manager_move(efl_super(obj, MY_CLASS), direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-11 07:40:40 -08:00
|
|
|
EOLIAN static Efl_Ui_Focus_Object*
|
2018-12-18 04:01:34 -08:00
|
|
|
_elm_gengrid_efl_ui_focus_manager_manager_focus_get(const Eo *obj, EINA_UNUSED Elm_Gengrid_Data *pd)
|
2018-12-11 07:40:40 -08:00
|
|
|
{
|
|
|
|
Eo *focused_obj = efl_ui_focus_manager_focus_get(efl_super(obj, MY_CLASS));
|
|
|
|
Eo *registered_manager = efl_ui_focus_object_focus_manager_get(obj);
|
|
|
|
|
|
|
|
if (!focused_obj && efl_ui_focus_manager_redirect_get(registered_manager))
|
|
|
|
return (Efl_Ui_Focus_Object*) obj;
|
|
|
|
|
|
|
|
return focused_obj;
|
|
|
|
}
|
|
|
|
|
2017-10-19 05:15:08 -07:00
|
|
|
static void
|
|
|
|
_gengrid_element_focused(void *data, const Efl_Event *ev)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(data, pd);
|
2018-01-07 20:55:35 -08:00
|
|
|
Efl_Ui_Widget *focused = efl_ui_focus_manager_focus_get(ev->object);
|
2018-10-01 01:50:12 -07:00
|
|
|
Elm_Widget_Item *item = NULL, *old_item = NULL;
|
2017-11-10 07:05:09 -08:00
|
|
|
|
2018-06-12 01:40:38 -07:00
|
|
|
item = efl_ui_focus_parent_provider_gen_item_fetch(pd->provider, focused);
|
2018-10-01 01:50:12 -07:00
|
|
|
old_item = efl_ui_focus_parent_provider_gen_item_fetch(pd->provider, ev->info);
|
|
|
|
|
|
|
|
if (old_item)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(old_item, ELM_GENGRID_ITEM_CLASS));
|
|
|
|
_elm_gengrid_item_unfocused(old_item);
|
|
|
|
}
|
2018-06-12 01:40:38 -07:00
|
|
|
|
2018-10-01 01:50:12 -07:00
|
|
|
if (item)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(item, ELM_GENGRID_ITEM_CLASS));
|
|
|
|
_elm_gengrid_item_focused(item);
|
|
|
|
pd->last_focused_item = item;
|
|
|
|
}
|
2017-10-20 08:21:19 -07:00
|
|
|
|
2018-06-12 01:40:38 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
2017-10-19 05:15:08 -07:00
|
|
|
{
|
2018-06-12 01:40:38 -07:00
|
|
|
elm_gengrid_item_selected_set(item, EINA_TRUE);
|
|
|
|
elm_gengrid_item_bring_in(item, ELM_GENGRID_ITEM_SCROLLTO_MIDDLE);
|
2017-10-19 05:15:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_gengrid_efl_object_constructor(Eo *obj, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2018-09-21 10:06:04 -07:00
|
|
|
legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
|
2017-10-15 06:35:42 -07: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));
|
|
|
|
|
|
|
|
efl_ui_focus_composition_logical_mode_set(obj, EINA_TRUE);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2012-11-25 22:32:53 -08:00
|
|
|
sd->obj = obj;
|
|
|
|
|
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_TREE_TABLE);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
2019-02-17 08:21:58 -08:00
|
|
|
efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, _gengrid_element_focused, obj);
|
2017-10-19 05:15:08 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
return obj;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_size_set(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord w, Evas_Coord h)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->item_width == w) && (sd->item_height == h)) return;
|
|
|
|
sd->item_width = w;
|
|
|
|
sd->item_height = h;
|
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-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_size_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Evas_Coord *w, Evas_Coord *h)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (w) *w = sd->item_width;
|
|
|
|
if (h) *h = sd->item_height;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_group_item_size_set(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord w, Evas_Coord h)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->group_item_width == w) && (sd->group_item_height == h)) return;
|
|
|
|
sd->group_item_width = w;
|
|
|
|
sd->group_item_height = h;
|
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);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_group_item_size_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Evas_Coord *w, Evas_Coord *h)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (w) *w = sd->group_item_width;
|
|
|
|
if (h) *h = sd->group_item_height;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_align_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, double align_x, double align_y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
double old_h, old_y;
|
2011-07-25 12:51:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
old_h = sd->align_x;
|
|
|
|
old_y = sd->align_y;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
|
|
|
if (align_x > 1.0)
|
|
|
|
align_x = 1.0;
|
|
|
|
else if (align_x < 0.0)
|
|
|
|
align_x = 0.0;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->align_x = align_x;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
|
|
|
if (align_y > 1.0)
|
|
|
|
align_y = 1.0;
|
|
|
|
else if (align_y < 0.0)
|
|
|
|
align_y = 0.0;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->align_y = align_y;
|
2011-07-25 12:51:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((old_h != sd->align_x) || (old_y != sd->align_y))
|
|
|
|
evas_object_smart_calculate(sd->pan_obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_align_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, double *align_x, double *align_y)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (align_x) *align_x = sd->align_x;
|
|
|
|
if (align_y) *align_y = sd->align_y;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_item_append(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Evas_Smart_Cb func, const void *func_data)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it));
|
2013-03-04 03:29:44 -08:00
|
|
|
it->position = sd->item_count;
|
2012-03-07 05:58:30 -08:00
|
|
|
it->position_update = EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_prepend(sd->group_items, it);
|
2011-09-09 05:43:34 -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-10 14:05:23 -07:00
|
|
|
|
2015-10-02 07:44:19 -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-10-02 07:44:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_item_prepend(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Evas_Smart_Cb func, const void *func_data)
|
2010-10-10 14:05:23 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it));
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
_item_position_update(sd->items, 1);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_append(sd->group_items, it);
|
2010-10-10 14:05:23 -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-10 14:05:23 -07:00
|
|
|
|
2015-10-02 07:44:19 -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-10-02 07:44:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_insert_before(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Elm_Object_Item *eo_relative, Evas_Smart_Cb func, const void *func_data)
|
2010-10-10 14:05:23 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Inlist *tmp;
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL);
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it),
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_INLIST_GET(relative));
|
2012-07-10 14:40:38 -07:00
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it));
|
2014-09-27 22:15:37 -07:00
|
|
|
_item_position_update(tmp, relative->position);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_append_relative
|
2014-09-27 22:15:37 -07:00
|
|
|
(sd->group_items, it, relative->parent);
|
2010-10-10 14:05:23 -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-10 14:05:23 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_insert_after(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Elm_Object_Item *eo_relative, Evas_Smart_Cb func, const void *func_data)
|
2010-10-10 14:05:23 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Inlist *tmp;
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL);
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it),
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_INLIST_GET(relative));
|
2012-07-10 14:40:38 -07:00
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it));
|
2014-09-27 22:15:37 -07:00
|
|
|
_item_position_update(tmp, relative->position + 1);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_prepend_relative
|
2014-09-27 22:15:37 -07:00
|
|
|
(sd->group_items, it, relative->parent);
|
2010-10-10 14:05:23 -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-06-03 05:53:14 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_item_sorted_insert(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data)
|
2011-06-25 08:39:05 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2011-06-25 08:39:05 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2011-06-25 08:39:05 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!sd->state)
|
2012-06-14 07:11:04 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->state = eina_inlist_sorted_state_new();
|
|
|
|
eina_inlist_sorted_state_init(sd->state, sd->items);
|
2012-06-14 07:11:04 -07:00
|
|
|
}
|
2011-09-05 13:31:51 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->item_compare_cb = comp;
|
|
|
|
sd->items = eina_inlist_sorted_state_insert
|
|
|
|
(sd->items, EINA_INLIST_GET(it), _elm_gengrid_item_compare, sd->state);
|
|
|
|
_item_position_update(sd->items, 0);
|
2012-03-07 05:58:30 -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, obj);
|
2011-06-25 08:39:05 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_horizontal_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Bool horizontal)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-02-28 22:22:59 -08:00
|
|
|
horizontal = !!horizontal;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (horizontal == sd->horizontal) return;
|
|
|
|
sd->horizontal = horizontal;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
|
|
|
/* Update the items to conform to the new layout */
|
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-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_horizontal_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2011-04-18 03:54:25 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->horizontal;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_clear(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
_internal_elm_gengrid_clear(obj, EINA_FALSE);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2012-02-28 22:44:35 -08:00
|
|
|
EINA_DEPRECATED EAPI const Evas_Object *
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_object_get(const Elm_Object_Item *eo_it)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
return VIEW(it);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
if (!it->realized) return;
|
|
|
|
if (it->want_unrealize) return;
|
|
|
|
|
2013-09-09 03:00:58 -07:00
|
|
|
_elm_gengrid_item_unrealize(it, EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_realize(it);
|
|
|
|
_item_place(it, it->x, it->y);
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
|
|
|
|
_elm_gengrid_item_index_update(it);
|
2010-10-09 12:07:42 -07:00
|
|
|
}
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_fields_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
const char *parts,
|
|
|
|
Elm_Gengrid_Item_Field_Type itf)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
if (!it->realized) return;
|
|
|
|
if (it->want_unrealize) return;
|
|
|
|
|
|
|
|
if ((!itf) || (itf & ELM_GENGRID_ITEM_FIELD_TEXT))
|
|
|
|
_item_text_realize(it, VIEW(it), &it->texts, parts);
|
|
|
|
|
|
|
|
if ((!itf) || (itf & ELM_GENGRID_ITEM_FIELD_CONTENT))
|
|
|
|
_item_content_realize(it, VIEW(it), &it->contents, "contents", parts);
|
|
|
|
|
|
|
|
if ((!itf) || (itf & ELM_GENGRID_ITEM_FIELD_STATE))
|
|
|
|
_item_state_realize(it, VIEW(it), parts);
|
|
|
|
|
|
|
|
_item_place(it, it->x, it->y);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static const Elm_Gengrid_Item_Class *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_item_class_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *item)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2012-07-18 14:03:46 -07:00
|
|
|
if (item->generation < GG_IT(item)->wsd->generation) return NULL;
|
|
|
|
return item->itc;
|
2011-06-25 16:20:22 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_item_class_update(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
const Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2011-10-20 15:45:38 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(itc);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (it->generation < GG_IT(it)->wsd->generation) return;
|
|
|
|
it->itc = itc;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
it->item->nocache_once = EINA_TRUE;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_update(EO_OBJ(it));
|
2011-06-25 16:20:22 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_pos_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
2014-09-27 22:15:37 -07:00
|
|
|
unsigned int *x,
|
|
|
|
unsigned int *y)
|
|
|
|
{
|
|
|
|
if (x) *x = it->x;
|
|
|
|
if (y) *y = it->y;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_multi_select_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool multi)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->multi = !!multi;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_multi_select_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->multi;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_multi_select_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Object_Multi_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
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 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Multi_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_multi_select_mode_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2013-11-03 08:15:58 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->multi_select_mode;
|
2013-11-03 06:58:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_selected_item_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
if (sd->selected) return sd->selected->data;
|
|
|
|
return NULL;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static const Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_selected_items_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->selected;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
Eina_Bool selected)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2016-03-02 04:10:48 -08:00
|
|
|
if ((it->generation < sd->generation) || elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
selected = !!selected;
|
|
|
|
if (it->selected == selected) return;
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
{
|
2012-11-16 06:26:10 -08:00
|
|
|
if (!sd->multi)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2012-11-16 06:26:10 -08:00
|
|
|
while (sd->selected)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_sel, sel);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb(sel);
|
2014-09-27 22:15:37 -07:00
|
|
|
it->unsel_cb(sel);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
it->highlight_cb(it);
|
2014-03-22 03:10:27 -07:00
|
|
|
it->sel_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
}
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->unsel_cb(it);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_selected_get(const Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
|
|
|
return it->selected;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_realized_items_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Gen_Item *it;
|
2014-12-26 01:45:29 -08:00
|
|
|
Eina_Bool done = EINA_FALSE;
|
2012-03-07 05:46:35 -08:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
Eina_List *ret = NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2014-12-26 01:45:29 -08:00
|
|
|
if (it->realized)
|
|
|
|
{
|
|
|
|
done = EINA_TRUE;
|
|
|
|
ret = eina_list_append(ret, EO_OBJ(it));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (done) break;
|
|
|
|
}
|
2012-03-07 05:46:35 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_realized_items_update(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2015-02-03 15:30:06 -08:00
|
|
|
Eina_List *list;
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Object_Item *it;
|
|
|
|
|
|
|
|
list = elm_gengrid_realized_items_get(obj);
|
2015-02-03 15:30:06 -08:00
|
|
|
EINA_LIST_FREE(list, it)
|
2012-03-07 05:46:35 -08:00
|
|
|
elm_gengrid_item_update(it);
|
|
|
|
}
|
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
static Evas_Object *
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_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);
|
2010-09-27 11:18:37 -07:00
|
|
|
if (!label)
|
|
|
|
return NULL;
|
|
|
|
elm_object_style_set(label, "tooltip");
|
2011-06-28 23:41:31 -07:00
|
|
|
elm_object_text_set(label, data);
|
2010-09-27 11:18:37 -07:00
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_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-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_text_set(Elm_Object_Item *it,
|
|
|
|
const char *text)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_text_set(it, text);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_text_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char *text)
|
|
|
|
{
|
2010-09-27 11:18:37 -07:00
|
|
|
text = eina_stringshare_add(text);
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_content_cb_set
|
2014-09-27 22:15:37 -07:00
|
|
|
(EO_OBJ(it), _elm_gengrid_item_label_create, text,
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_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-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_content_cb_set(Elm_Object_Item *item,
|
2010-12-10 05:01:43 -08:00
|
|
|
Elm_Tooltip_Item_Content_Cb func,
|
2012-07-10 14:40:38 -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:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_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)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_GOTO(it, error);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2014-09-27 22:15:37 -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);
|
|
|
|
it->tooltip.content_cb = func;
|
|
|
|
it->tooltip.data = data;
|
|
|
|
it->tooltip.del_cb = del_cb;
|
|
|
|
}
|
2012-07-10 14:40:38 -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_GENGRID_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-11-02 04:26:47 -07: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-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_unset(Elm_Object_Item *item)
|
2012-01-30 02:29:51 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_unset(item);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-01-30 02:29:51 -08:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_unset(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
2012-01-30 02:29:51 -08:00
|
|
|
|
2012-07-10 14:40:38 -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_GENGRID_ITEM_CLASS));
|
2012-07-10 14:40:38 -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-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_style_set(Elm_Object_Item *it,
|
|
|
|
const char *style)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_style_set(it, style);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_style_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const char *style)
|
|
|
|
{
|
|
|
|
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_GENGRID_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-30 02:29:51 -08:00
|
|
|
elm_gengrid_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);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_style_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
|
|
|
return it->tooltip.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
|
|
|
}
|
|
|
|
|
2011-07-26 02:38:23 -07:00
|
|
|
EAPI Eina_Bool
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_window_mode_set(Elm_Object_Item *it,
|
|
|
|
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(it, disable);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_window_mode_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
Eina_Bool disable)
|
|
|
|
{
|
|
|
|
it->tooltip.free_size = disable;
|
|
|
|
if (VIEW(it))
|
2016-08-15 06:44:41 -07:00
|
|
|
return elm_wdg_item_tooltip_window_mode_set(efl_super(eo_it, ELM_GENGRID_ITEM_CLASS), disable);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2011-07-27 19:22:37 -07:00
|
|
|
return EINA_TRUE;
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_tooltip_window_mode_get(const Elm_Object_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_tooltip_window_mode_get(it);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_window_mode_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return it->tooltip.free_size;
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_cursor_set(Elm_Object_Item *it,
|
|
|
|
const char *cursor)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_set(it, cursor);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_cursor_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const char *cursor)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2014-09-27 22:15:37 -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_GENGRID_ITEM_CLASS), cursor);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2010-11-04 17:46:54 -07:00
|
|
|
EAPI const char *
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_cursor_get(const Elm_Object_Item *it)
|
2010-11-04 17:46:54 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_get(it);
|
2010-11-04 17:46:54 -07:00
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_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:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_cursor_unset(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
if (!it->mouse_cursor)
|
2010-09-27 11:18:37 -07:00
|
|
|
return;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
if (VIEW(it)) elm_wdg_item_cursor_unset(efl_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2013-09-08 02:50:00 -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
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_cursor_style_set(Elm_Object_Item *it,
|
|
|
|
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(it, style);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_cursor_style_get(const Elm_Object_Item *it)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_style_get(it);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
2010-09-25 15:03:37 -07:00
|
|
|
EAPI void
|
2015-04-14 03:20:16 -07:00
|
|
|
elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *eo_it,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool engine_only)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2015-04-14 03:20:16 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
|
|
|
it->cursor_engine_only = engine_only;
|
|
|
|
if (it->realized)
|
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
|
2015-04-14 03:20:16 -07:00
|
|
|
elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *eo_it)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2015-04-14 03:20:16 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
|
|
|
if (it->realized)
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_engine_only_get(eo_it);
|
2015-04-14 03:20:16 -07:00
|
|
|
else return it->cursor_engine_only;
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|
|
|
|
|
2015-08-13 23:21:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_mode_start(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Ecore_Pos_Map tween_mode)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
sd->reorder_mode = EINA_TRUE;
|
|
|
|
sd->reorder.tween_mode = tween_mode;
|
2014-07-08 23:09:43 -07:00
|
|
|
sd->reorder.type = ELM_GENGRID_REORDER_TYPE_NORMAL;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2015-08-13 23:21:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_mode_stop(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
sd->reorder_mode = EINA_FALSE;
|
|
|
|
sd->reorder.tween_mode = -1;
|
|
|
|
}
|
|
|
|
|
2015-08-13 23:21:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_type_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Gengrid_Reorder_Type type)
|
2014-07-08 23:09:43 -07:00
|
|
|
{
|
|
|
|
sd->reorder.type = type;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool reorder_mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->reorder_mode = !!reorder_mode;
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_reorder_mode_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->reorder_mode;
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
EAPI void
|
2010-12-10 05:01:43 -08:00
|
|
|
elm_gengrid_bounce_set(Evas_Object *obj,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool h_bounce,
|
|
|
|
Eina_Bool v_bounce)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_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
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_interface_scrollable_bounce_allow_set(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, Eina_Bool h_bounce, Eina_Bool v_bounce)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_interface_scrollable_bounce_allow_set(efl_super(obj, MY_CLASS), !!h_bounce, !!v_bounce);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-12-10 05:01:43 -08:00
|
|
|
elm_gengrid_bounce_get(const Evas_Object *obj,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool *h_bounce,
|
|
|
|
Eina_Bool *v_bounce)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_get(obj, h_bounce, v_bounce);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2010-07-06 14:14:38 -07:00
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
EAPI void
|
|
|
|
elm_gengrid_page_relative_set(Eo *obj, double h_pagerel, double v_pagerel)
|
2010-09-29 09:59:35 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord pagesize_h;
|
|
|
|
Evas_Coord pagesize_v;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_get(obj, NULL, NULL, &pagesize_h, &pagesize_v);
|
|
|
|
elm_interface_scrollable_paging_set
|
|
|
|
(obj, h_pagerel, v_pagerel, pagesize_h, pagesize_v);
|
2010-09-29 09:59:35 -07:00
|
|
|
}
|
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
EAPI void
|
|
|
|
elm_gengrid_page_relative_get(const Eo *obj, double *h_pagerel, double *v_pagerel)
|
2011-04-18 03:54:25 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_get(obj, h_pagerel, v_pagerel, NULL, NULL);
|
2011-04-18 03:54:25 -07:00
|
|
|
}
|
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
EAPI void
|
|
|
|
elm_gengrid_page_size_set(Eo *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
|
2010-12-10 05:01:43 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
double pagerel_h;
|
|
|
|
double pagerel_v;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_get(obj, &pagerel_h, &pagerel_v, NULL, NULL);
|
|
|
|
elm_interface_scrollable_paging_set
|
|
|
|
(obj, pagerel_h, pagerel_v, h_pagesize, v_pagesize);
|
2010-09-29 09:59:35 -07:00
|
|
|
}
|
|
|
|
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_current_page_get(const Evas_Object *obj,
|
|
|
|
int *h_pagenumber,
|
|
|
|
int *v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_current_page_get(obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_last_page_get(const Evas_Object *obj,
|
|
|
|
int *h_pagenumber,
|
|
|
|
int *v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_last_page_get(obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
2014-08-27 01:24:01 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_page_show(const Evas_Object *obj,
|
|
|
|
int h_pagenumber,
|
|
|
|
int v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 07:21:42 -08:00
|
|
|
elm_interface_scrollable_page_show((Eo *) obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
2014-08-27 01:24:01 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_page_bring_in(const Evas_Object *obj,
|
|
|
|
int h_pagenumber,
|
|
|
|
int v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 07:21:42 -08:00
|
|
|
elm_interface_scrollable_page_bring_in((Eo *) obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
2012-03-07 05:46:35 -08:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_scroller_policy_set(Evas_Object *obj,
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Scroller_Policy policy_h,
|
|
|
|
Elm_Scroller_Policy policy_v)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_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 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_interface_scrollable_policy_set(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-03-07 05:46:35 -08:00
|
|
|
if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
|
|
|
|
(policy_v >= ELM_SCROLLER_POLICY_LAST))
|
|
|
|
return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_interface_scrollable_policy_set(efl_super(obj, MY_CLASS), policy_h, policy_v);
|
2012-03-07 05:46:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_scroller_policy_get(const Evas_Object *obj,
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Scroller_Policy *policy_h,
|
|
|
|
Elm_Scroller_Policy *policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
ELM_GENGRID_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 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_elm_interface_scrollable_policy_get(const Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Scroller_Policy s_policy_h, s_policy_v;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_interface_scrollable_policy_get(efl_super(obj, MY_CLASS), &s_policy_h, &s_policy_v);
|
2012-03-07 05:46:35 -08:00
|
|
|
if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
|
|
|
|
if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_first_item_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!sd->items) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
|
|
|
|
while ((it) && (it->generation < sd->generation))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_gengrid_at_xy_item_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret)
|
2013-03-16 23:36:30 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
|
2013-05-10 06:38:28 -07:00
|
|
|
Evas_Coord l = 0, r = 0, t = 0, b = 0; /* left, right, top, bottom */
|
2013-03-16 23:36:30 -07:00
|
|
|
Eina_Bool init = EINA_TRUE;
|
|
|
|
|
|
|
|
while ((it) && (it->generation < sd->generation))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
|
|
|
|
if (it)
|
|
|
|
do
|
|
|
|
{
|
|
|
|
Evas_Coord itx, ity;
|
|
|
|
Evas_Coord itw, ith;
|
|
|
|
evas_object_geometry_get(VIEW(it), &itx, &ity, &itw, &ith);
|
|
|
|
|
|
|
|
/* Record leftmost, rightmost, top, bottom cords to set posret */
|
|
|
|
if ((itw > 0) && (ith > 0) && (itx >= 0) && (ity >= 0))
|
|
|
|
{ /* A scroller, ignore items in negative cords,or not rendered */
|
|
|
|
if (init)
|
|
|
|
{
|
|
|
|
l = itx;
|
|
|
|
r = itx + itw;
|
|
|
|
t = ity;
|
|
|
|
b = ity + ith;
|
|
|
|
init = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (itx < l)
|
|
|
|
l = itx;
|
|
|
|
if ((itx + itw) > r)
|
|
|
|
r = itx + itw;
|
|
|
|
if (ity < t)
|
|
|
|
t = ity;
|
|
|
|
if ((ity + ith) > b)
|
|
|
|
b = ity + ith;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ELM_RECTS_INTERSECT
|
|
|
|
(itx, ity, itw, ith, x, y, 1, 1))
|
|
|
|
{
|
|
|
|
if (yposret)
|
|
|
|
{
|
|
|
|
if (y <= (ity + (ith / 4))) *yposret = -1;
|
|
|
|
else if (y >= (ity + ith - (ith / 4)))
|
|
|
|
*yposret = 1;
|
|
|
|
else *yposret = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xposret)
|
|
|
|
{
|
|
|
|
if (x <= (itx + (itw / 4))) *xposret = -1;
|
|
|
|
else if (x >= (itx + itw - (itw / 4)))
|
|
|
|
*xposret = 1;
|
|
|
|
else *xposret = 0;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} while ((it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next)));
|
|
|
|
|
|
|
|
/* No item found, tell the user if hit left/right/top/bottom of items */
|
|
|
|
if (xposret)
|
|
|
|
{
|
|
|
|
*xposret = 0;
|
|
|
|
if (x < l)
|
|
|
|
*xposret = (-1);
|
|
|
|
else if (x > r)
|
|
|
|
*xposret = (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yposret)
|
|
|
|
{
|
|
|
|
*yposret = 0;
|
|
|
|
if (y < t)
|
|
|
|
*yposret = (-1);
|
|
|
|
else if (y > b)
|
|
|
|
*yposret = (1);
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return NULL;
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_last_item_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2010-07-06 14:14:38 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!sd->items) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
while ((it) && (it->generation < sd->generation))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_next_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
if ((it) && (it->generation == GG_IT(it)->wsd->generation)) break;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_prev_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
|
|
|
if ((it) && (it->generation == GG_IT(it)->wsd->generation)) break;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_show(Eo *eo_it, Elm_Gen_Item *it, Elm_Gengrid_Item_Scrollto_Type type)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-03-24 01:59:50 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((it->generation < sd->generation)) return;
|
2010-09-22 23:33:50 -07:00
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->show_region = EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->show_it = eo_it;
|
2014-01-20 23:54:59 -08:00
|
|
|
sd->scroll_to_type = type;
|
2013-01-03 04:03:55 -08:00
|
|
|
|
|
|
|
_item_show_region(sd);
|
2010-09-22 23:33:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_bring_in(Eo *eo_it, Elm_Gen_Item *it, Elm_Gengrid_Item_Scrollto_Type type)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2010-09-22 23:33:50 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->generation < sd->generation) return;
|
2010-09-22 23:33:50 -07:00
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->bring_in = EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->bring_in_it = eo_it;
|
2014-01-20 23:54:59 -08:00
|
|
|
sd->scroll_to_type = type;
|
2013-01-03 04:03:55 -08:00
|
|
|
|
|
|
|
_item_show_region(sd);
|
2010-09-22 23:33:50 -07:00
|
|
|
}
|
2012-01-04 06:33:39 -08:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_filled_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool fill)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-01-04 06:33:39 -08:00
|
|
|
fill = !!fill;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->filled != fill)
|
|
|
|
sd->filled = fill;
|
2012-01-04 06:33:39 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_filled_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->filled;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static unsigned int
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_gengrid_items_count(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->item_count;
|
2012-03-07 05:46:35 -08:00
|
|
|
}
|
|
|
|
|
2012-02-22 23:36:12 -08:00
|
|
|
EAPI Elm_Gengrid_Item_Class *
|
|
|
|
elm_gengrid_item_class_new(void)
|
|
|
|
{
|
|
|
|
Elm_Gengrid_Item_Class *itc;
|
|
|
|
|
|
|
|
itc = calloc(1, sizeof(Elm_Gengrid_Item_Class));
|
|
|
|
if (!itc)
|
|
|
|
return NULL;
|
2012-03-05 21:02:36 -08:00
|
|
|
itc->version = CLASS_ALLOCATED;
|
2012-02-22 23:36:12 -08:00
|
|
|
itc->refcount = 1;
|
|
|
|
itc->delete_me = EINA_FALSE;
|
|
|
|
|
|
|
|
return itc;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!itc || (itc->version != CLASS_ALLOCATED)) return;
|
|
|
|
|
|
|
|
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
|
|
|
if (itc->refcount > 0) elm_gengrid_item_class_unref(itc);
|
|
|
|
else
|
2012-02-22 23:36:12 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
itc->version = 0;
|
|
|
|
free(itc);
|
2012-02-22 23:36:12 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2012-03-05 21:02:36 -08:00
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-04 18:46:29 -08:00
|
|
|
{
|
|
|
|
itc->refcount++;
|
|
|
|
if (itc->refcount == 0) itc->refcount--;
|
|
|
|
}
|
2012-02-22 23:36:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2012-03-05 21:02:36 -08:00
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-04 18:46:29 -08:00
|
|
|
{
|
|
|
|
if (itc->refcount > 0) itc->refcount--;
|
|
|
|
if (itc->delete_me && (!itc->refcount))
|
|
|
|
elm_gengrid_item_class_free(itc);
|
|
|
|
}
|
2012-02-22 23:36:12 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_select_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Object_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (sd->select_mode != mode)
|
|
|
|
sd->select_mode = mode;
|
2012-03-07 04:43:19 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_select_mode_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-03-07 04:43:19 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->select_mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_highlight_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool highlight)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->highlight = !!highlight;
|
2012-03-07 05:37:18 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_highlight_mode_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-03-07 05:37:18 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->highlight;
|
2012-03-07 05:37:18 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_index_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, -1);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
return it->position;
|
2012-03-07 05:58:30 -08:00
|
|
|
}
|
2012-03-08 05:47:09 -08:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_select_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
Elm_Object_Select_Mode mode)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->generation < GG_IT(it)->wsd->generation) return;
|
2012-03-08 05:47:09 -08:00
|
|
|
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
|
|
|
return;
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->select_mode != mode)
|
|
|
|
it->select_mode = mode;
|
|
|
|
|
|
|
|
if (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_update(EO_OBJ(it));
|
2012-03-08 05:47:09 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_item_select_mode_get(const Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX);
|
|
|
|
|
|
|
|
return it->select_mode;
|
2012-03-08 05:47:09 -08:00
|
|
|
}
|
2012-11-14 08:34:33 -08:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_gengrid_item_efl_access_object_state_set_get(const Eo *eo_it, Elm_Gen_Item *it EINA_UNUSED)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2014-10-09 01:17:09 -07:00
|
|
|
Eina_Bool sel;
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
sel = elm_obj_gengrid_item_selected_get(eo_it);
|
2014-10-09 01:17:09 -07:00
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_TYPE_SELECTABLE);
|
2014-10-09 01:17:09 -07:00
|
|
|
|
|
|
|
if (sel)
|
2019-03-05 14:00:37 -08:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_TYPE_SELECTED);
|
2014-10-03 07:14:37 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
EOLIAN const char*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_gengrid_item_efl_access_object_i18n_name_get(const Eo *eo_it, Elm_Gen_Item *it)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
2016-11-09 17:58:41 -08:00
|
|
|
const char *ret;
|
2014-10-03 07:14:37 -07:00
|
|
|
Eina_Strbuf *buf;
|
2016-11-09 17:58:41 -08:00
|
|
|
char *accessible_name;
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_i18n_name_get(efl_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2015-12-17 00:36:02 -08:00
|
|
|
if (ret) return ret;
|
|
|
|
|
2014-10-03 07:14:37 -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-05-04 02:45:06 -07:00
|
|
|
char *str_markup = it->itc->func.text_get
|
2014-10-03 07:14:37 -07:00
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
|
2015-05-04 02:45:06 -07:00
|
|
|
char *str_utf8 = _elm_util_mkup_to_text(str_markup);
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2015-05-04 02:45:06 -07:00
|
|
|
free(str_markup);
|
|
|
|
|
|
|
|
if (str_utf8)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
|
|
|
if (eina_strbuf_length_get(buf) > 0)
|
|
|
|
eina_strbuf_append(buf, ", ");
|
2015-05-04 02:45:06 -07:00
|
|
|
eina_strbuf_append(buf, str_utf8);
|
|
|
|
free(str_utf8);
|
2014-10-03 07:14:37 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
accessible_name = eina_strbuf_string_steal(buf);
|
2014-10-03 07:14:37 -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-03 07:14:37 -07:00
|
|
|
}
|
|
|
|
|
2012-11-14 08:34:33 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_gengrid_nth_item_get(const Evas_Object *obj, unsigned int nth)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = NULL;
|
|
|
|
Eina_Accessor *a;
|
|
|
|
void *data;
|
|
|
|
|
2014-04-03 08:07:36 -07:00
|
|
|
ELM_GENGRID_CHECK(obj) NULL;
|
2012-11-14 08:34:33 -08:00
|
|
|
ELM_GENGRID_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:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-14 08:34:33 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_efl_ui_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-03 03:19:45 -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-21 01:00:46 -07:00
|
|
|
|
2014-05-09 09:07:57 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2014-05-06 22:13:19 -07:00
|
|
|
if (sd->focused_item)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_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-21 01:00:46 -07: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-21 01:00:46 -07: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-04-03 03:19:45 -07:00
|
|
|
|
|
|
|
if (sd->horizontal)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-03 03:19:45 -07:00
|
|
|
if (item_x < ox)
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.x = ox;
|
2014-04-03 03:19:45 -07:00
|
|
|
}
|
|
|
|
else if (item_x > (ox + ow - item_w))
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.x = ox + ow - item_w;
|
2014-04-03 03:19:45 -07:00
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-03 03:19:45 -07:00
|
|
|
if (item_y < oy)
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.y = oy;
|
2014-04-03 03:19:45 -07:00
|
|
|
}
|
|
|
|
else if (item_y > (oy + oh - item_h))
|
|
|
|
{
|
2017-08-28 23:59:40 -07:00
|
|
|
r.y = oy + oh - item_h;
|
2014-04-03 03:19:45 -07:00
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2017-08-28 23:59:40 -07:00
|
|
|
|
|
|
|
return r;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
2019-02-24 01:57:01 -08:00
|
|
|
_elm_gengrid_elm_widget_item_container_focused_item_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->focused_item;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
EOLIAN static void
|
2017-08-30 00:15:34 -07:00
|
|
|
_elm_gengrid_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool enable)
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
sd->item_loop_enable = !!enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_elm_interface_scrollable_item_loop_enabled_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
return sd->item_loop_enable;
|
|
|
|
}
|
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
EAPI void
|
|
|
|
elm_gengrid_wheel_disabled_set(Eo *obj, Eina_Bool disabled)
|
2014-04-26 21:43:37 -07:00
|
|
|
{
|
2018-02-14 18:14:52 -08:00
|
|
|
elm_interface_scrollable_wheel_disabled_set(obj, disabled);
|
2014-04-26 21:43:37 -07:00
|
|
|
}
|
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_gengrid_wheel_disabled_get(const Eo *obj)
|
2014-04-26 21:43:37 -07:00
|
|
|
{
|
2018-02-14 18:14:52 -08:00
|
|
|
return elm_interface_scrollable_wheel_disabled_get(obj);
|
2014-04-26 21:43:37 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_gengrid_class_constructor(Efl_Class *klass)
|
2014-04-01 04:50:40 -07:00
|
|
|
{
|
2013-05-03 03:53:56 -07:00
|
|
|
if (_elm_config->access_mode)
|
|
|
|
_elm_gengrid_smart_focus_next_enable = EINA_TRUE;
|
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-11-15 18:55:06 -08:00
|
|
|
EOLIAN const Efl_Access_Action_Data *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_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,left,multi", "move", "left_multi", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "move,right,multi", "move", "right_multi", _key_action_move},
|
|
|
|
{ "move,up", "move", "up", _key_action_move},
|
|
|
|
{ "move,up,multi", "move", "up_multi", _key_action_move},
|
|
|
|
{ "move,down", "move", "down", _key_action_move},
|
|
|
|
{ "move,down,multi", "move", "down_multi", _key_action_move},
|
|
|
|
{ "move,first", "move", "first", _key_action_move},
|
|
|
|
{ "move,last", "move", "last", _key_action_move},
|
|
|
|
{ "select", "select", NULL, _key_action_select},
|
2015-02-12 02:15:57 -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-10-03 07:14:37 -07:00
|
|
|
EOLIAN Eina_List*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_gengrid_efl_access_object_access_children_get(const Eo *obj, Elm_Gengrid_Data *sd)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
2015-12-01 07:55:12 -08:00
|
|
|
Eina_List *ret = NULL, *ret2 = NULL;
|
2014-10-03 07:14:37 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
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_GENGRID_CLASS));
|
2015-12-01 07:55:12 -08:00
|
|
|
|
|
|
|
return eina_list_merge(ret, ret2);
|
2014-10-03 07:14:37 -07:00
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_gengrid_efl_access_object_state_set_get(const Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(obj, ELM_GENGRID_CLASS));
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_TYPE_MANAGES_DESCENDANTS);
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2017-11-12 19:08:57 -08:00
|
|
|
if (elm_gengrid_multi_select_get(obj))
|
2019-03-05 14:00:37 -08:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_TYPE_MULTISELECTABLE);
|
2017-11-12 19:08:57 -08:00
|
|
|
|
2014-10-03 07:14:37 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-05-26 23:23:17 -07:00
|
|
|
EOLIAN int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_efl_access_selection_selected_children_count_get(const Eo *objm EINA_UNUSED, Elm_Gengrid_Data *pd)
|
2015-05-26 23:23:17 -07:00
|
|
|
{
|
|
|
|
return eina_list_count(pd->selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eo*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_gengrid_efl_access_selection_selected_child_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_idx)
|
2015-05-26 23:23:17 -07:00
|
|
|
{
|
|
|
|
return eina_list_nth(pd->selected, child_idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_gengrid_efl_access_selection_child_select(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
2015-05-26 23:23:17 -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_gengrid_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_gengrid_efl_access_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
2015-05-26 23:23:17 -07:00
|
|
|
{
|
|
|
|
Eo *item;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(pd->selected, l, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_gengrid_item_selected_set(item, EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_gengrid_efl_access_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
2015-05-26 23:23:17 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
return elm_gengrid_item_selected_get(EO_OBJ(item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_gengrid_efl_access_selection_all_children_select(Eo *obj, Elm_Gengrid_Data *pd)
|
2015-05-26 23:23:17 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
|
|
|
|
if (!elm_gengrid_multi_select_get(obj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_gengrid_efl_access_selection_access_selection_clear(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd)
|
2015-05-26 23:23:17 -07:00
|
|
|
{
|
|
|
|
return _all_items_deselect(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2017-09-18 19:18:22 -07:00
|
|
|
_elm_gengrid_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
2015-05-26 23:23:17 -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_gengrid_item_selected_set(EO_OBJ(item), EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-15 06:35:42 -07:00
|
|
|
EOLIAN static Efl_Object*
|
2018-01-04 11:41:49 -08:00
|
|
|
_elm_gengrid_efl_object_provider_find(const Eo *obj, Elm_Gengrid_Data *pd, const Efl_Object *klass)
|
2017-10-15 06:35:42 -07:00
|
|
|
{
|
|
|
|
if (klass == EFL_UI_FOCUS_PARENT_PROVIDER_INTERFACE)
|
|
|
|
return pd->provider;
|
|
|
|
return efl_provider_find(efl_super(obj, ELM_GENGRID_CLASS), klass);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_efl_ui_focus_composition_prepare(Eo *obj, Elm_Gengrid_Data *pd)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
Eina_List *order = NULL;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (item->base->disabled)
|
|
|
|
continue;
|
2018-04-25 05:00:28 -07:00
|
|
|
if (item->group)
|
|
|
|
continue;
|
2017-10-15 06:35:42 -07:00
|
|
|
|
|
|
|
order = eina_list_append(order, item->base->eo_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_ui_focus_composition_elements_set(obj, order);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_gengrid_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Gengrid_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-10-15 06:35:42 -07:00
|
|
|
{
|
2017-10-23 22:03:46 -07:00
|
|
|
return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj);
|
2017-10-15 06:35:42 -07:00
|
|
|
}
|
|
|
|
|
2017-10-19 02:52:26 -07:00
|
|
|
EOLIAN static void
|
2019-02-21 12:46:32 -08:00
|
|
|
_elm_gengrid_item_efl_ui_focus_object_setup_order_non_recursive(Eo *obj, Elm_Gen_Item *pd)
|
2017-10-19 02:52:26 -07:00
|
|
|
{
|
2017-11-10 06:24:19 -08:00
|
|
|
Eina_List *n;
|
2018-01-07 20:55:35 -08:00
|
|
|
Efl_Ui_Widget *wid;
|
2017-11-10 06:24:19 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(pd->contents, n, wid)
|
2017-10-20 08:21:19 -07:00
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
if (efl_isa(wid, EFL_UI_WIDGET_CLASS))
|
2017-11-10 06:24:19 -08:00
|
|
|
_elm_widget_full_eval(wid);
|
2017-10-20 08:21:19 -07:00
|
|
|
}
|
2017-10-19 02:52:26 -07:00
|
|
|
|
2019-02-21 12:46:32 -08:00
|
|
|
efl_ui_focus_object_setup_order_non_recursive(efl_super(obj, ELM_GENGRID_ITEM_CLASS));
|
2017-11-10 06:24:19 -08:00
|
|
|
}
|
2017-10-19 02:52:26 -07:00
|
|
|
|
2018-11-13 07:34:17 -08:00
|
|
|
EOLIAN static Efl_Ui_Focus_Object*
|
|
|
|
_elm_gengrid_item_efl_ui_focus_object_focus_parent_get(const Eo *obj EINA_UNUSED, Elm_Gen_Item *pd)
|
|
|
|
{
|
|
|
|
return pd->base->widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
/* Standard widget overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_gengrid, Elm_Gengrid_Data)
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_GENGRID_EXTRA_OPS \
|
2017-08-07 00:13:38 -07:00
|
|
|
ELM_LAYOUT_SIZING_EVAL_OPS(elm_gengrid), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_gengrid)
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_gengrid_eo.c"
|
|
|
|
#include "elm_gengrid_item_eo.c"
|